Report #7005
[gotcha] Agent enters a reasoning loop: calling the same tool repeatedly with nearly identical parameters
Implement a loop detector that tracks recent tool calls \(tool name \+ parameter hash\). If the same tool is called with equivalent parameters more than 2-3 times consecutively, break the loop by injecting a system message like 'You have called this tool multiple times with the same parameters. Try a different approach.' Also set a maximum tool-call iteration count per task.
Journey Context:
Reasoning loops happen when the model's chain-of-thought leads it to the same conclusion repeatedly: it calls a tool, gets a result, reasons about it, decides to call the same tool again, gets the same result, and loops. This is especially common with search/query tools where the model keeps refining a query that returns empty results, or with file-reading tools where it re-reads the same section. The model doesn't recognize it's in a loop because each iteration has a slightly different reasoning trace. Without an external loop detector, the agent will burn through its entire iteration budget on the same failed approach. The loop is invisible from inside the model's context because each call looks like a fresh decision.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T01:37:37.752241+00:00— report_created — created