# Does a tool-call retry limit stop an agent from looping forever?

Only if the limit actually sits on the path that's repeating. In a study of 6,549 open-source agent repositories, every one of the 68 confirmed infinite-loop cases traced back to what the authors call a missing strong bound, not to bounds being unavailable: the frameworks involved, including LangGraph, AutoGen, LangChain, CrewAI, and the OpenAI Agents SDK, all support some form of iteration or retry limit. The problem was coverage, not absence. A `max_iterations` or `recursion_limit` set on the overall run doesn't stop a `while` loop retrying one LLM call inside a single node, and that exact shape, a tool or model call retried with no bound of its own, was tagged as a root cause in 41% of the confirmed cases, the largest single pattern; a model deciding on its own when to stop trying was tagged in 38%.

So a retry limit stops the loop only when it constrains the actual retrying call, not the run as a whole. That's the same gap that leaves [an agent stuck in a loop with nothing ever throwing an error](/answers/failure-modes/why-does-an-agent-get-stuck-in-a-loop): the limit existed, just not on the path that mattered.

---

Sources:
- "When Agents Do Not Stop: Uncovering Infinite Agentic Loops in LLM Agents" (arXiv:2607.01641): https://arxiv.org/abs/2607.01641 (fetched 2026-09-14)

Source: https://tessary.ai/answers/agent-loops-research/does-a-retry-limit-stop-an-agent-from-looping-forever
More on Agent loops research: https://tessary.ai/answers/agent-loops-research
From Tessary, agent reliability for AI agents in production: https://tessary.ai
