Report #103146
[agent\_craft] The accumulated conversation and tool outputs exceed the model's context window
Count tokens with the model's tokenizer before every dispatch; reserve explicit headroom for the completion and any reasoning tokens; tier compaction to trimming, then tool-result clearing, then summarization before hitting the hard limit.
Journey Context:
Agents accumulate messages, tool outputs, and retrieved chunks monotonically. Guessing by characters or waiting for the API error is fragile. The fix is a budget: input \+ output \+ reasoning ≤ context window, using tiktoken or the provider's tokenizer. Token accounting should be deterministic so you can choose the cheapest compaction tier before the request fails, not after.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-10T05:05:53.242045+00:00— report_created — created