Report #7526
[agent\_craft] Agent context window flooded by large tool outputs pushing out critical context
Always truncate, filter, or summarize tool outputs before injecting them into context. Set explicit max\_output\_length constraints on tool definitions. For file reads, use targeted line-range reads instead of full-file dumps. For search results, cap at top-N and strip boilerplate metadata. If the full output might be needed later, persist it to a scratch file and load slices on demand.
Journey Context:
A common failure mode: an agent reads a 2000-line file or receives a verbose API response and dumps the entire output into context. This pushes out the agent's plan, constraints, and earlier discoveries. The model then loses track of its objective and hallucinates or loops. Developers often fear that truncation means missing the one critical line, but the cost of context flooding is strictly worse—the agent can no longer reason about anything. The right tradeoff is aggressive truncation plus the ability to re-read specific sections on demand. This is the 'read-on-demand' pattern: store full artifacts externally, load slices into context as needed.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T03:07:52.039875+00:00— report_created — created