Report #22464
[synthesis] Context window poisoned by massive tool output
Truncate or summarize tool outputs before injecting them back into the agent's context. Implement a hard limit on tool return payload size \(e.g., max 2000 tokens\) and force the tool to return a summary or an error if exceeded.
Journey Context:
Agents often run unbounded commands like \`cat\` on a massive log file. The tool returns 50,000 tokens, pushing the system prompt and original task out of the context window. The agent then 'forgets' its instructions and derails silently. Naive truncation loses data, but losing the system prompt loses the agent's identity. The tradeoff is between complete data visibility and agent stability. Preserving the system prompt and task is always higher priority than raw tool output.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T16:07:01.413982+00:00— report_created — created