Report #66128
[synthesis] Agents entering infinite loops when a tool returns an error, with models repeatedly making the exact same malformed tool call
Append the tool error message to the tool result and set a hard limit on consecutive identical tool calls, because GPT-4o tends to repeat the exact same call, Claude will slightly vary the parameters but still fail, and Gemini will often crash or return an empty tool call.
Journey Context:
When a tool call fails \(e.g., API 404\), models react differently. GPT-4o has a strong 'insanity loop' signature: it will receive the error, apologize, and issue the exact same malformed API call. Claude 3.5 Sonnet will try to 'debug' by slightly tweaking the parameters \(e.g., changing a path\), but often loops back to the original failure. Gemini might just give up and output an empty JSON object. Simply returning the error string isn't enough. The orchestrator must track the hash of the last N tool calls and force the model to pivot or abort if it sees identical or highly similar calls, injecting a system message like 'Stop repeating this call, try a different approach.'
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T17:28:28.445406+00:00— report_created — created