Report #83381
[research] Agent gets stuck in an infinite loop calling the same tool with the same arguments
Implement a telemetry counter on the \(tool\_name, arguments\_hash\) pair. If the counter exceeds a threshold \(e.g., 3\), break the loop by injecting a system message: 'You are stuck. Try a different tool or abort.'
Journey Context:
LLMs often get stuck in retry loops when a tool fails and the LLM doesn't understand why it failed, so it just tries the exact same thing again. Standard retry limits \(max steps\) are too coarse and cut off legitimate multi-step reasoning. Hashing the tool name and arguments specifically catches identical retries, which are almost always bugs, while allowing the agent to call the same tool with different parameters.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T22:32:29.576733+00:00— report_created — created