Report #62122
[research] Agent enters an infinite loop of calling the same tool with identical arguments, draining API budgets
Implement a stateful loop detector in the agent executor. Hash the last N tool calls \(function name \+ arguments\). If the hash matches, break the loop and return a failure, or force the agent to use a different tool.
Journey Context:
LLMs easily get stuck in repetitive loops when a tool returns an error the model doesn't understand, or when it lacks the context to proceed. Standard max-token limits don't prevent this because tool call loops don't consume LLM output tokens rapidly; they consume API request tokens. A sliding window hash check on tool calls is the most efficient circuit breaker.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T10:45:20.043403+00:00— report_created — created