
<p><b>Key facts.</b></p>
<ul>
<li>Step repetition is the most common single failure mode in multi-agent systems, at 15.7% of all failures; "unaware of termination conditions" adds another 12.4% (Cemri et al., <a href="https://arxiv.org/abs/2503.13657" target="_blank" rel="noopener">MAST</a>, 2025).</li>
<li>The waste is large: one 8B model averaged 26.4 redundant steps out of 40 in ALFWorld, and early-exit mechanisms cut redundant steps by 50 to 70% with only minor performance loss (<a href="https://arxiv.org/abs/2505.17616" target="_blank" rel="noopener">early-exit behavior of LLM agents</a>, 2025).</li>
<li>The classic reason-act loop has no built-in progress tracking or cycle detection, so production frameworks hard-code a max-iteration cap precisely to stop runaway loops.</li>
<li>It gets expensive: one documented sandbox agent stuck recursively provisioning cloud clusters ran up about $12,000 before anyone caught it (reported, Towards AI, 2026).</li>
</ul>
<h2>Why does an agent repeat itself at all?</h2><p><!-- conviction-start -->Step repetition was 15.7% in MAST; a stronger model loops without state.<!-- conviction-end --> (<a href="https://arxiv.org/abs/2503.13657" target="_blank" rel="noopener">arXiv:2503.13657</a>)</p>
<p>Your agent loops because it has no memory of its own actions. A reason-act loop runs: think, call a tool, read the result, repeat. The whole transcript gets fed back each turn. If the result is not clearly resolved, the next step sees the task as fresh and picks the same action again. There is no note that says "I already tried this and it failed." Without that, the agent has no reason not to repeat. The model also self-conditions on its own output: once it generates a repetitive thought, that thought is in context as established behavior, and the next turn reinforces it. Step repetition is not an intelligence problem. It is a memory problem.</p>
<h2>Why doesn't it just stop?</h2>
<p>Stopping is left to the model's judgment. In most agent loops, termination is implicit: keep calling tools until you decide to output a final answer. If the prompt never gives crisp completion criteria, or the model does not recognize them, the agent keeps going. The MAST study found "unaware of termination conditions" in 12.4% of failures. Almost entirely in failed runs, not successful ones. The agent that cannot tell it is done is the same agent that fails the task. Leaving the exit decision to a model that is already confused is how a short task becomes an unbounded one.</p>
<div class="fig"><img src="/blog/article6-diagram.png" alt="A 40-step agent run split into 26.4 redundant steps and 13.6 productive steps"/></div>
<h2>How bad does it actually get?</h2>
<p>Worse than it looks, because the loop burns money silently. One 8B model spent 26.4 of 40 steps on redundant actions. Two-thirds of its work was repetition. In production the cost is not just latency. One documented sandbox agent got stuck recursively spinning up Kubernetes clusters to fix a simple error and ran up about $12,000 in cloud charges before a budget alarm caught it at 3 in the morning. A loop with no cap does not fail loudly. It keeps paying the meter until something external stops it, which is why every serious deployment treats an iteration cap as a safety requirement, not an optimization.</p>
<h2>How do you stop the loop?</h2>
<table style="width:100%;border-collapse:collapse;margin:1.5rem 0;font-size:0.97rem;"><tr><th style="text-align:left;padding:10px 12px;border-bottom:2px solid #e5e7eb;color:#5E6AD2;font-weight:600;">Fix</th><th style="text-align:left;padding:10px 12px;border-bottom:2px solid #e5e7eb;color:#5E6AD2;font-weight:600;">What it does</th><th style="text-align:left;padding:10px 12px;border-bottom:2px solid #e5e7eb;color:#5E6AD2;font-weight:600;">How</th></tr>
<tr><td style="padding:10px 12px;border-bottom:1px solid #eee;vertical-align:top;">Step budget</td><td style="padding:10px 12px;border-bottom:1px solid #eee;vertical-align:top;">Guarantees termination</td><td style="padding:10px 12px;border-bottom:1px solid #eee;vertical-align:top;">Hard max-iteration cap; bail out and escalate when hit</td></tr>
<tr><td style="padding:10px 12px;border-bottom:1px solid #eee;vertical-align:top;">Loop detection</td><td style="padding:10px 12px;border-bottom:1px solid #eee;vertical-align:top;">Catches the repeat early</td><td style="padding:10px 12px;border-bottom:1px solid #eee;vertical-align:top;">Track recent actions; if one repeats, block it and force a new approach</td></tr>
<tr><td style="padding:10px 12px;border-bottom:1px solid #eee;vertical-align:top;">Explicit finish</td><td style="padding:10px 12px;border-bottom:1px solid #eee;vertical-align:top;">Removes the guesswork</td><td style="padding:10px 12px;border-bottom:1px solid #eee;vertical-align:top;">A dedicated "submit answer" tool plus clear, checkable done criteria</td></tr>
<tr><td style="padding:10px 12px;border-bottom:1px solid #eee;vertical-align:top;">External state</td><td style="padding:10px 12px;border-bottom:1px solid #eee;vertical-align:top;">Gives it a memory</td><td style="padding:10px 12px;border-bottom:1px solid #eee;vertical-align:top;">Keep a checklist of what was tried and its result, outside the context window</td></tr>
<tr><td style="padding:10px 12px;border-bottom:1px solid #eee;vertical-align:top;">Forced reflection</td><td style="padding:10px 12px;border-bottom:1px solid #eee;vertical-align:top;">Breaks the cycle</td><td style="padding:10px 12px;border-bottom:1px solid #eee;vertical-align:top;">After N stuck steps, trigger a critique step: "what have you tried, what is new"</td></tr>
</table>
<p>Loops are a design gap, not a model defect, so the fixes are cheap and reliable once you treat them as required. Cap the steps, detect repeats, give the agent a real finish signal, and hold its progress in state it cannot forget. Knowing where in your specific workflow an agent is prone to spin, and where it runs clean, is the pattern-level reliability VibeModel builds as the Pattern Intelligence Layer.</p>
<h2>Frequently asked questions</h2>
Why does my agent repeat the same action even after it fails?
Because nothing tells it the action already failed. Its only memory is the transcript, and a basic reason-act loop has no "already tried this" record, so it treats the step as new. Add external state and loop detection so a repeat is caught and blocked.
Will a bigger model stop the looping?
Not reliably. Looping is a memory and termination gap, not raw capability. A stronger model lowers the rate but still loops without a step cap, a finish tool, and progress tracking. The MAST data shows termination-unawareness concentrated in failed runs regardless of model.
What is the simplest fix that always works?
A hard max-iteration cap. It guarantees the agent stops even when it never recognizes completion, which is why production frameworks build it in by default. Pair it with loop detection so you catch the repeat before the cap.
How much waste does looping actually cause?
A lot. One 8B model spent 26.4 of 40 steps on redundant actions in ALFWorld, about two-thirds of its work. Early-exit methods cut redundant steps 50 to 70% with only minor performance loss.

