Report #22401
[agent\_craft] Agent chokes when tool returns 10k lines of logs, truncates mid-error message losing stack trace
Pre-process tool outputs through a 'compression layer': if output > token threshold, use LLM to summarize keeping stack traces, error types, and unique identifiers; discard repetitive logs. Pass structured summary to agent.
Journey Context:
Raw tool output \(logs, JSON dumps\) often exceeds context windows or drowns the agent in noise. Simple truncation cuts critical info \(end of stack trace\). The solution is an intermediate compression step using a cheap model \(or rules\) to extract semantic value: preserve exception types, file paths, line numbers \(the 'signal'\), collapse repetitive patterns \(the 'noise'\). This is similar to log aggregation in observability \(Datadog/Splunk\). The agent then reasons over the summary, not the raw dump. This prevents the 'lost in the middle' problem where critical info is in the middle of a long log.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T16:00:53.556905+00:00— report_created — created