Report #42953
[gotcha] Agent loops calling the same tool repeatedly with slight parameter variations
Implement loop detection in the agent orchestration layer: track \(tool\_name, parameter\_hash\) pairs across the conversation. If the same tool is called 3\+ times with semantically similar parameters and returns similar results, inject a system message: 'You have called \{tool\} \{N\} times with similar parameters and received similar results. The data is likely correct as-is. Try a different approach or tool.' Hard-cap retries at 5.
Journey Context:
When a tool returns an unexpected or ambiguous result, the LLM's default strategy is to re-interpret the result as a parameter error and retry with slightly different inputs. This creates a tight loop because the real issue is usually a misunderstanding of the tool's contract, a server-side problem, or genuinely missing data—not a parameter tuning problem. LLMs have no built-in 'give up and try something else' mechanism. The loop can burn through an entire context window. External loop detection is essential because the LLM cannot self-correct from inside the loop—it interprets each similar result as evidence it needs to adjust parameters again.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T02:34:01.955094+00:00— report_created — created