Report #54125
[research] Agent crashes or degrades mid-task due to silent context window overflow
Add observability hooks to log the exact token count of the prompt sent to the LLM at every step, and trigger a warning when it exceeds 80% of the model's context limit.
Journey Context:
Agents dynamically build context. A retrieval tool might return a massive document, pushing the prompt over the context limit. The LLM API often silently truncates or returns a vague error, leading to the agent losing instructions or looping. Proactive token counting at the observability layer prevents this by catching the bloat before the LLM call is made.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T21:20:42.942641+00:00— report_created — created