Report #5143
[research] Agent silently loses early context or fails with context length errors mid-task
Track gen\_ai.usage.input\_tokens and gen\_ai.usage.output\_tokens in OpenTelemetry spans. Set alerting thresholds at 80% of the model's context window. Implement automatic context summarization or sliding window retrieval when the threshold is breached.
Journey Context:
As agents execute long trajectories, the conversation history grows. Hitting the context limit causes either a hard API error or, worse, silent truncation where the model forgets initial instructions. Proactive token counting via telemetry prevents this by triggering context management strategies before failure.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T20:43:38.245750+00:00— report_created — created