# A Catalogue of Loop Failures — Agent Loops, Stop Conditions and Token Budgets

Source: https://www.geekswithgeeks.com/en/agent-loops/fail-catalogue

> Name the common failures and match each to the guard that catches it.

## Name it to fix it

**Repetition**: the same call again and again. **Thrashing**: trying many different fixes that all fail. **Drift**: wandering away from the original goal. **Context bloat**: history grows until quality drops. **Silent overspend**: every step is fine but the total is huge. Each has a different guard, so logging which one happened tells you what to improve.

## What goes wrong

Most loop incidents are one of a few patterns: repeating, thrashing on errors, or quietly overspending.

![Four common patterns, each with its own guard.](assets/figures/agent-loops/section-5-map.svg) — Figure 5.1 — Repeat, thrash, drift and overspend.

## Failure to guard map

Use this table as a checklist when reviewing a loop.

```text
Failure          Guard
Repetition       RepeatGuard on (tool, args)
Thrashing        cap consecutive tool errors; escalate
Drift            restate goal each N steps; verify against goal
Context bloat    clip results, summarise, offload
Silent overspend total token and cost budget
```

**Quiz:** Every step is cheap but the run costs a lot overall. Which failure is this?

- [ ] Repetition
- [x] Silent overspend
- [ ] Drift
- [ ] Syntax error

*Answer:* Silent overspend. Only a total budget notices cost that accumulates across many individually fine steps.
