Jarvis Osorio Answers: Why Is My AI Agent Stuck Repeating Itself?
Jarvis Nelson OsorioI am Jarvis Nelson Osorio—Jarvis Osorio—a technology entrepreneur and innovator based in Miami Beach, Florida. Builders keep asking why a capable agent will retry the same failing step until the bill hurts. Here is a direct FAQ, based on ideas I originally shared on LinkedIn in Why Is Your AI Agent Looping?.
Is the model broken?
Usually not. Looping is more often a design problem. The agent is doing what a fluent system does when nobody defined "stop," "success," or "escalate."
Why does it retry instead of asking for help?
Three common reasons. First, it is grading its own work, so it cannot see the real mistake. Second, the instructions say something like "keep refining until it is optimal," which has no finish line. Third, a tool returned an odd error or an empty result, and the agent treated that as a puzzle to poke rather than a signal to halt.
Can a better prompt fix it?
A clearer task helps. A prompt cannot replace a hard step limit, an independent check, or a written recovery path. If your only control is more language, you still have a conversation, not a production system.
Why does this get expensive so fast?
Each retry can add tool calls and more context. The window grows, the same failure is re-described, and the meter runs. There is also a cost in trust: after one bad night, teams become reluctant to delegate anything that matters.
What is the first practical fix?
Cap the number of tool calls in the orchestrator and make a cap-hit a visible failure. Then take the pass/fail decision away from the actor. A separate judge or a real test should decide whether the step worked.
Do I need a whole "multi-agent" setup?
Not always. Sometimes a unit test, a schema validator, or a simple policy check is the judge. The principle is separation: the process that proposes is not the only process that approves. That is the same institutional habit I defend in Breaking the Centralized Order.
When should a human get involved?
When the cap is hit, when a recovery playbook is exhausted, and before any irreversible action—spend, delete, external message, production change. Always-on execution is fine. Unbounded retry of a write is not.
Is looping more common as agents get more tools?
Yes, because each tool can return a surprise. More tools without playbooks means more ways to misread a result and try again. Give the agent fewer tools at first, and a script for the failures you already expect.
What does "done" look like?
Something a machine or a person can verify: tests green, a document with sources, a draft sitting in review, a digest sent at a set time. If you cannot point to done, the agent will invent more work. That is not initiative. That is a missing stop condition.
If your agent is stuck repeating itself, do not take it personally, and do not only scold the prompt. Give the system a constitution: limits, an independent verdict, and a way to quit.
Where to go next
This expands on ideas I originally shared on LinkedIn in Why Is Your AI Agent Looping? The Root Cause, Economic Cost, and Architectural Fixes.
More essays, books and profiles: jarvisosorio.com and the hub Jarvis Nelson Osorio — articles, books, videos and profiles. For a human-scale version of systems that never say stop, see The Compliant Mind.