Report #49905
[agent\_craft] Agent crashes or truncates mid-task when context window limit is reached
Implement a sliding window with a summarizer that triggers at 70-80% context capacity, keeping the system prompt and the most recent N turns intact, while compressing older turns.
Journey Context:
Waiting until 100% capacity leads to abrupt failures. A proactive compaction strategy ensures the agent never hits the hard limit during a critical tool call. The 70-80% threshold gives enough room for the tool response to fit after the compaction prompt.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T14:14:43.488104+00:00— report_created — created