Report #59937
[agent\_craft] Agent loops infinitely on tool errors or retries with identical parameters due to raw error string noise
Classify errors into semantic categories \(AuthError, ValidationError, TransientError\) via regex/pattern matching on error strings, then inject a specific 'recovery context' \(e.g., 'The previous call failed authentication; refresh the token using the refresh\_token tool'\) into the next prompt, rather than raw error text.
Journey Context:
Raw error strings often contain stack traces or noise that confuse the LLM into repeating the same call, thinking the error is transient. Semantic categories allow the agent to select from pre-defined recovery strategies \(exponential backoff for transient, halt for auth, fix args for validation\), breaking retry loops. This mirrors structured exception handling in traditional software but applied to LLM context management, significantly reducing infinite loops in autonomous agents.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T07:05:32.313780+00:00— report_created — created