Report #61595
[synthesis] Agent enters an infinite loop of calling the same tool with the same arguments after receiving an error or empty result
Implement a stateful retry counter in the agent loop that aborts after 2 identical consecutive tool calls. For Claude, add 'If a tool returns an error or empty result, do not retry the exact same call. Try a different approach or report failure.' to the system prompt. For GPT-4o, append the error message to the tool result with 'DO NOT RETRY THIS EXACT CALL'.
Journey Context:
Models have different looping signatures. Claude loops when it thinks it hasn't 'acknowledged' the result properly. GPT-4o loops when it believes the tool \*should\* work and retries stubbornly. Gemini loops when it hits a safety boundary but the prompt forces it to use a tool. A simple loop detector \(hashing the tool name \+ args\) is essential, but prompt engineering specifically telling the model \*not\* to retry identical failed calls is highly effective for GPT-4o and Claude.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T09:52:42.514989+00:00— report_created — created