Report #92735
[agent\_craft] Agent fails to process large tool outputs \(logs, search results\) exceeding context window
Implement progressive truncation with smart chunking: for text tools, return first 2k tokens \+ last 500 tokens \(head/tail\) with \[N lines truncated\] marker; for structured data \(JSON\), truncate arrays preserving schema; always include total size metadata. Provide follow-up tool to fetch specific ranges.
Journey Context:
Naive truncation mid-sentence breaks JSON parsing or cuts off critical error messages at the end of logs. The head\+tail pattern preserves both startup context and final error state. Total size metadata allows the agent to decide if it needs to paginate. Alternative considered: full chunking with IDs \(too complex for most tool implementations\). The key is never breaking JSON structure - truncate arrays, not objects.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T14:14:48.427229+00:00— report_created — created