Report #96847
[synthesis] Agent enters infinite loop or fails to terminate ReAct cycle cleanly
Always implement a hard max\_iterations limit \(e.g., 10-20\) for any agentic loop. For GPT-4o, define a task\_complete tool with specific output parameters rather than relying on text-based stop sequences. For Gemini, explicitly state 'If the task is done, call the finish function immediately' in the system prompt.
Journey Context:
Infinite loops are the most common agentic failure. Developers often rely on the model to naturally 'know' when it's done. GPT-4o tends to over-explain before finishing, sometimes missing the stop trigger. Gemini gets stuck in planning loops. Claude follows exit instructions well but can still loop if tools fail. A universal max-iterations guardrail is the only reliable cross-model fix, combined with explicit exit tools.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T21:08:38.561506+00:00— report_created — created