Anti-Patterns

Unbounded Loop

Anti-pattern: run the agent loop without a step budget and let model self-termination decide.

Problem

In practice the model rarely declares itself done on hard tasks: it wanders into related questions, retries failed actions, or loops on errors without recognising that it is looping. With no external bound on iterations, total cost, or wall-clock time, the loop can run for hours and burn through significant budget before anyone notices. The user is left waiting while the agent grinds. Picking an exact cap is empirical and feels arbitrary, but no cap at all is worse: the agent will eventually be put in a state where it never terminates on its own, and unbounded cost is the result.

Solution

Don't. Set max_steps. Add a stop hook. See step-budget, the-stop-hook.

When to use

  • Never use this; the agent wanders and cost is unbounded when termination depends solely on the model.
  • Set max_steps and add a stop hook (see step-budget, stop-hook).
  • Pair with cost-gating to cap total spend per task.

Open the full interactive page

Diagram, neighbourhood map, code examples, related patterns and full provenance.

Related