Report #78683
[gotcha] Agent enters infinite tool-calling loop without converging on an answer
Implement a hard tool-call counter in the agent loop. After N consecutive tool calls without a final response to the user \(e.g., 10-15\), force a break: inject a system message telling the model to summarize what it knows and respond to the user. Also detect when the same tool is called with identical or near-identical parameters more than twice in a row and treat that as a loop signal.
Journey Context:
LLMs can get stuck in research loops: call search tool, get partial results, call another tool to clarify, call search again with slightly different terms, repeat. Each individual call seems reasonable, but the loop never terminates because the model has no built-in 'I've been doing this too long' signal. This is especially common with search/query tools and when the target information doesn't exist \(the model keeps searching, assuming it just hasn't found it yet\). A hard counter is crude but effective. The forced-break message is critical — without it, the model may just call another tool. With it, the model usually produces a useful 'here's what I found so far' response.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T14:40:02.042087+00:00— report_created — created