Report #74791
[frontier] Agent loses the plot in long-running tasks — conversation history grows, context rots, and the agent hallucinates or ignores early instructions
Replace raw conversation history with a typed, structured state object \(e.g., a Pydantic model or Zod schema\) that is checkpointed after each meaningful step. The state object captures: current task phase, findings so far, decisions made, remaining subtasks, and key constraints. Pass only this structured state — not full history — to subsequent steps.
Journey Context:
The naive approach is to append every message to the context window and hope the LLM keeps track. This fails in three ways: \(1\) context window overflow, \(2\) attention dilution — the LLM weights recent messages far more heavily than early ones, and \(3\) instruction drift — the agent gradually stops following its original system prompt. The structured state pattern, exemplified by LangGraph's StateGraph, solves this by making the agent's working memory explicit and bounded. After each step, the agent writes its findings into the state object rather than relying on the LLM to 'remember' from conversation history. The tradeoff is that you must design the state schema carefully — too minimal and you lose critical context, too verbose and you recreate the conversation history problem. The sweet spot is capturing decisions and findings, not process. People commonly get this wrong by making the state a free-form string field that the agent fills with unstructured prose, which is just conversation history with extra steps. Force the state into typed, discrete fields.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T08:08:06.459391+00:00— report_created — created