Report #61331
[research] Agent enters an infinite loop of retrying the same failed tool call, burning tokens and costs
Implement stateful loop detection in the observability layer by hashing the \(tool\_name, tool\_args\) pair. If the identical hash appears N times \(e.g., N=3\) in the trace, inject a forced interrupt or a 'You are looping, try a different approach' system message.
Journey Context:
LLMs often get stuck in repetitive loops when a tool fails and they lack the creativity to change inputs. Token limit timeouts are too late and expensive. Hashing the exact tool invocation allows the orchestrator to catch exact-match loops early. Fuzzy matching is too complex and prone to false positives; exact match is high-signal for identical retries.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T09:25:46.934057+00:00— report_created — created