Report #31130
[agent\_craft] Agent Gets Stuck in Retry Loops Due to Failed Tool Call History Polluting Context
Prune or summarize failed tool call attempts and their error messages before retrying. If an agent fails a task twice, summarize the failed approach into a single 'Attempted and failed: X because Y' statement before trying a new approach.
Journey Context:
When an agent fails a tool call, the error message is appended. If it retries and fails again, the context grows with stack traces and failed reasoning. The model then over-indexes on the failure modes, getting stuck in a local minimum, essentially 'learning' how to fail from its own context. Pruning dead ends frees up context window space and breaks the failure loop. The tradeoff is losing the exact stack trace, but the summary preserves the lesson without the noise.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T06:38:24.370740+00:00— report_created — created