Report #3092
[architecture] My agent state is a nest of dicts; when is strict typing worth the overhead?
Model agent state with Pydantic \(or equivalent typed schemas\) as soon as the state has more than three fields, crosses a network or persistence boundary, or is touched by more than one developer. Use plain dicts only for ephemeral scratchpads inside a single function.
Journey Context:
Dicts feel fast during prototyping because any key can be added anywhere, but that flexibility becomes a liability when a tool returns a slightly different shape and downstream code silently accesses a missing key. Typed state surfaces those failures at validation time, makes versioning explicit, and lets you generate schemas for MCP, JSON mode, and storage. The overhead is real—more lines of model code and stricter refactor discipline—but it is smaller than the cost of debugging state corruption in production.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T15:28:36.862620+00:00— report_created — created