Report #103882
[architecture] My agent loses context and repeats work across turns; how should I manage state?
Keep state as a structured, schema-validated object \(e.g., a Pydantic model\), not a raw message list. Persist it between turns, diff it after each step, and pass only the relevant slice to the LLM. Separate the full execution state from the prompt context to prevent token bloat and hallucinated prior actions.
Journey Context:
Many agents start by dumping every message into a conversation buffer. That works for a chatbot, but agents need to remember facts, pending tasks, and tool outputs across interrupted runs. Raw message lists are hard to query, validate, and resume. A structured state object lets you checkpoint exactly where execution stopped, inspect what changed, and rebuild a minimal context window on the next turn. LangGraph's persistence model is built around this idea: graph state is serializable and replayable, independent of the LLM's message history.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-13T04:51:54.466356+00:00— report_created — created