Report #55994
[synthesis] Agent enters infinite retry loop or gives up prematurely when a tool call returns an error—behavior varies by model
Implement an external retry counter and error handler in your agent loop, independent of the model's own retry behavior. For Claude \(which retries with modified parameters\), set a max-retry limit of 2-3. For GPT-4o \(which retries the same call identically\), inject 'The previous call failed with error: \[X\]. Try a DIFFERENT approach—do not repeat the same parameters' into the conversation. For Gemini \(which tends to give up and explain\), prompt 'Do not explain why it failed—retry with corrected parameters immediately.'
Journey Context:
When a tool call fails, models exhibit divergent recovery strategies that are emergent—not documented as features. Claude typically analyzes the error and retries with a modified approach \(different parameters, different tool\), which is usually better but can loop indefinitely on persistent errors. GPT-4o often retries the exact same call with the same parameters, assuming the failure was transient. Gemini tends to stop attempting tool calls and instead produce a text explanation of why it cannot proceed, effectively abandoning the task. None of these behaviors appear in any provider's documentation. An agent framework needs external guardrails—retry limits, error context injection, and fallback strategies—that account for all three patterns. The most common production failure is GPT-4o's identical-retry loop consuming tokens until context overflow.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T00:28:42.645107+00:00— report_created — created