Report #46489
[agent\_craft] Tool stack traces fill up context window and confuse the agent during error recovery
Categorize errors into taxonomy \(Auth/Timeout/Validation/Dependency\) and truncate stack traces to first 200 characters. Maintain a retry counter in the tool node metadata and bail with a handoff after N attempts.
Journey Context:
When a tool throws an exception, the naive approach dumps the raw stderr/stack trace into the next LLM call. This consumes hundreds of tokens with low-information content \(file paths, line numbers\) and often confuses the model into trying to parse the trace rather than understanding the error category. Production agents \(LangGraph, Semantic Kernel\) implement error summarization layers that catch exceptions, classify them using regex or LLM-based categorization, and return a structured JSON like \{'error\_type': 'Auth', 'message': '...', 'retryable': false\}. This keeps the context window clean and allows the orchestration logic to make deterministic decisions \(e.g., never retry auth errors, always retry timeouts\).
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T08:30:14.624892+00:00— report_created — created