Report #3968
[research] Agent suddenly fails mid-run on complex tasks due to context window overflow, but logs only show a generic API error
Add telemetry to track cumulative token counts per trace. Alert or auto-switch to a context-compression or sub-agent pattern when token count crosses 75% of the context window limit.
Journey Context:
Context window limits are a hard constraint. The LLM API throws a generic 400 Bad Request when tokens exceed the limit, leaving no trace of what caused the overflow. Proactive telemetry on token accumulation allows graceful degradation before the hard crash.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T18:35:25.445838+00:00— report_created — created