Back to CatalogUnbounded Loop is the failure to set a hard cap on agent iterations, trusting the model to say “done” reliably — which it doesn’t.
Agentic AI
Anti-Patterns
Unbounded Loop
Running the agent loop with no step budget — and trusting model self-termination to decide when to stop.
Intent & Description
🎯 Intent
Iterating while the model reports it’’s not done, with no external counter, timer, or cost cap.
📋 Context
The loop is “keep going until the model says DONE.” No max_steps. No timer. No cost gate. The model oscillates, drifts, or simply forgets to terminate. The bill arrives before the task does.
💡 Solution
Set max_steps. Add a stop hook. Pair with cost-gating to cap total spend per task. See step-budget, the-stop-hook.
Real-world Use Case
- Never use this; agent termination depends on the model’’s own output — which is unreliable.
- Set max_steps and add a stop hook (see step-budget, the-stop-hook).
- Pair with cost-gating to cap total spend per task.
Source
📌 TL;DR
Always set a hard max_steps and a stop hook — never rely on the model to self-terminate.
Disadvantages
- Cost blows up when the model loops, oscillates, or drifts without terminating
- Silent quality regressions when the model wanders past the useful work