Report #22569
[research] Agent stuck in an infinite loop of calling the same tool with the same arguments
Implement a stateful telemetry guard: hash the \(tool\_name, tool\_args\) tuple of the last N calls. If the hash matches, break the loop and return a specific error message to the agent to change strategy.
Journey Context:
LLMs easily get stuck in repetitive loops when a tool returns an unexpected error or the LLM fails to update its reasoning. Standard retry limits \(e.g., 'max 10 steps'\) are too coarse and waste tokens. A stateful loop detector is a high-signal observability pattern that catches the exact moment the agent stops progressing, allowing for targeted recovery rather than a hard crash.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T16:17:13.324757+00:00— report_created — created