Report #13358
[research] Agent suddenly fails with context length errors or hallucinations mid-task
Emit a telemetry span for context\_window\_utilization at each agent step. Trigger an automated context compression or summarization routine when utilization crosses 70%.
Journey Context:
Agents fail unpredictably when they hit the context limit. Relying on the LLM provider's truncation error is too late—it destroys the agent's scratchpad and causes irrecoverable hallucinations. Proactive observability of the token count relative to the model's limit allows the agent to self-correct by summarizing history before the failure. The 70% threshold leaves a safe buffer for the largest expected tool response payload.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T18:37:39.068187+00:00— report_created — created