Report #55522
[frontier] Agent runs out of context window mid-task in production long-running workflows
Implement explicit context budgeting with priority-tagged eviction. Allocate token budgets per category: system instructions \(untouchable\), task specification \(high\), recent tool results \(medium\), conversation history \(low\). When approaching the context limit, evict the lowest-priority items first. Compress tool results at insertion time—never insert raw API responses.
Journey Context:
The naive approach is FIFO truncation of conversation history, which loses either instructions \(if truncating from the top\) or recent context \(if from the bottom\). Production failures reveal that tool results are the \#1 context consumer—a single API response can consume 5K\+ tokens. The winning pattern is two-layer: compress at insertion \(summarize tool outputs to essential fields before adding to context\) and evict by priority at capacity \(not by recency alone\). System instructions get a protected budget that is never evicted. This is analogous to generational garbage collection: protect your tenured objects, aggressively collect your ephemeral ones.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T23:41:23.043932+00:00— report_created — created