Guide

AI agent stuck in a loop burning tokens? How to spot it early

The short answer: a loop shows up in your logs before it shows up on your bill. 120 of the 656 public cases in our library mention a loop, a runaway or repeated retries. Watch for the same call repeating, the same command failing again and again, and subagents that start more subagents.

Three signs of a loop

Stop it in Claude Code

  1. 1

    Interrupt and find what keeps firing. In Claude Code 2.1.242 and later, /usage has a “Loops” row for heavy /loop and scheduled tasks.

  2. 2

    Add a loop breaker. Tell the agent to stop after the same failure twice instead of retrying: add “If the same command fails twice, stop and tell me instead of retrying.” to CLAUDE.md. For headless runs, also pass --max-turns.

  3. 3

    Keep a hard limit outside the agent. Set a spend limit at the provider as well. One report shows a $5 extra-usage limit charged at 250% with no stop (#59858), so treat each limit as one layer, not the whole answer.

Why loops get expensive fast

Each turn resends the conversation, so every round of a loop costs more than the one before. Claude Code's docs also note that thinking tokens are billed as output tokens. Clearing between unrelated tasks and using a cheaper model for simple subagents both shrink the cost of a loop that slips through.

FAQ · AI agent stuck in a loop burning tokens? How to spot it early

How do I know my agent is looping?

Look for the same tool call with the same input several times in a row, or the same command failing again and again. In Claude Code 2.1.242 and later, /usage also has a Loops row for heavy /loop and scheduled tasks.

Will the agent stop by itself?

Not reliably. In the public cases we hold, loops ran until something outside the agent stopped them: the user, a limit or a crash.

What stops a loop for good?

A hard limit outside the agent. Set the spend limit at the provider, then check the bill — the free check shows what the loop already cost. If you would rather have the limit set up for you, that is a paid job on Upwork.

Sources

Case counts on this page come from our research library of 656 verified public AI billing dispute cases (170 curated cases plus 486 collected on 2026-11-24). Counts are keyword counts over the case texts; one case can match more than one pattern.

Fireborn finds and stops surprise charges for free, and the appeal templates are free too. The paid service is a hard spend cap set up for you, sold on Upwork. It does not promise refunds or log in on your behalf. Figures on this page follow the sources cited. Last verified: 2026-11-27. By Fireborn (6hn68).

Still seeing a gap? Generate a day-by-day reconciliation in /app Get a hard cap set up for you on Upwork