What a loop looks like
The same tool call, the same arguments, the same failure — over and over. In the Deep Dive trace it reads as a wall of near-identical steps; in the token spend it reads as one task costing more than everything else combined.
Stop it first
- Cancel the run immediately — a loop is pure waste.
- Do not just re-run: the same prompt will loop again.
- Look at the repeated step and write down what the agent was trying to achieve.
The three usual causes
- Ambiguous success: the agent cannot tell when it is done, so it keeps polishing. Fix: define “done” in the prompt.
- A tool that fails the same way: the agent retries instead of changing approach. Fix: tell it to try a different method after two failures.
- No stop condition: the plan is open-ended. Fix: give the task a size limit — steps, time, or token budget.
Make loops cheap when they happen
You cannot prevent every loop, so make them affordable: daily spend caps and spend alerts turn a loop into a stopped run you hear about, instead of a surprise. Related symptoms live in the timeout guide.