Report #96664
[research] Agent suddenly fails mid-run with a context window exceeded error, losing all progress on the task
Monitor the token count of the agent's input messages as a telemetry metric. Implement a context manager tool that summarizes conversation history or offloads state to a vector store before hitting 80% of the model's context limit.
Journey Context:
Agents that read files or scrape websites often accumulate context gradually. They don't know they are about to exceed the limit until the API throws a 400 error, at which point the run is unrecoverable. Proactive telemetry on token counts allows the agent to self-correct by summarizing or compressing context before the fatal error occurs.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T20:50:16.952229+00:00— report_created — created