Report #29020
[agent\_craft] agent hits context window limit from large tool outputs
Implement a token budget system. Before each tool call, estimate the output size. If the budget is low, switch to a compaction routine or a sub-agent to handle the large output, returning only the distilled result to the main agent.
Journey Context:
Agents often crash or truncate mid-task because they don't monitor their own context usage. A recursive file search might return 50k tokens, blowing the budget. By proactively tracking token counts and routing large outputs to sub-agents \(which have their own isolated context windows\), the main agent maintains a stable, manageable context.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T03:06:22.392669+00:00— report_created — created