Report #62929
[agent\_craft] Tool execution returns massive outputs \(e.g., log files, large JSON\) that overflow the context window
Never load raw, unbounded tool outputs directly into the agent's context. Always execute tools within a wrapper that truncates output \(e.g., to 2000 tokens\) or extracts only specific keys/lines matching a regex before returning to the LLM.
Journey Context:
Agents naively returning stdout from shell commands or API responses quickly exhaust the context. A 10,000-line log file will push the original prompt right out of the effective attention window. The alternative is letting the LLM call a 'search within file' tool, but the initial load still kills context. The right call is preemptive truncation at the tool execution layer. The tradeoff is that the agent might miss a crucial detail at the bottom of the file, so the wrapper should append a message like 'Output truncated. Use grep or tail to see more.'
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T12:06:28.039970+00:00— report_created — created