Report #93885
[gotcha] Agent stuck in loop calling the same tool with identical arguments and getting the same result
Track tool call history within the session. If the same tool\+arguments combination is called 2\+ times with the same result, inject a system message: 'You already called \{tool\_name\} with these arguments and received: \{summary\}. This will not produce a different result. Try a different approach or tool.' Implement a circuit-breaker that caps consecutive identical calls and forces the agent to reconsider its strategy.
Journey Context:
LLMs can enter degenerate loops when a tool result does not match the model expectation. The model re-attempts the same call hoping for different output. This is especially common with search and query tools where the model expects specific data but gets an empty or generic response. The loop is self-reinforcing: identical context produces identical next-token predictions, creating a deterministic cycle. Breaking the symmetry is key—injecting a novel system message or forcing a different tool disrupts the token prediction pattern. Without intervention, the agent will loop until it hits the context window limit or max turn count.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T16:10:15.179326+00:00— report_created — created