Report #44555
[gotcha] Agent enters infinite retry loop when MCP tool call fails or returns an error
Implement exponential backoff with a strict retry limit in the agent loop. Instruct the agent via system prompt to alter its arguments or try a completely different tool on failure, rather than retrying the exact same call with the exact same arguments.
Journey Context:
When a tool fails \(e.g., API rate limit, network error, invalid input\), the LLM often receives the error message and reasons: 'The tool failed, I should try again.' It sends the exact same arguments, hits the exact same error, and loops infinitely. Without a circuit breaker or explicit instructions to change strategy, the agent will burn through tokens and API credits until it hits a hard maximum iteration limit.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T05:15:14.025811+00:00— report_created — created