LLMs, GenAI, RAG, agents, evaluation · insight-0630
Give every agent run hard budgets and explicit stopping conditions
- Evidence type
- practitioner heuristic
- Difficulty
- easy
- Roles
- Applied AI, ML engineer
- Industries
- cross-industry
Summary: situation, action, reason, boundary
Situation
An agent loop runs "until the task is done" with no limit on iterations, tokens, spend or wall-clock time.
Action
Set limits on steps, tool calls, tokens or cost, and elapsed time; detect repetition (the same tool and arguments twice); on any limit, stop and return a partial result with the reason and state.
Reason
Anthropic's guidance recommends stopping conditions such as a maximum number of iterations, and OWASP lists unbounded consumption as an LLM application risk.
Boundary
Every agent loop, including internal ones.
Symptom or risk
A confused agent repeats the same failing tool call or wanders through hundreds of steps, burning budget and sometimes repeating side effects.
Exceptions
Batch research jobs may get higher budgets, but still finite ones.
Trade-offs
Tight budgets cut off legitimately long tasks; set them from the distribution of steps on successful evaluation runs.
Pitfalls
Silently returning a half-finished result as if complete.
Lessons and concepts
Claims and their sources
Anthropic's agent guidance recommends stopping conditions such as a maximum number of iterations to keep control of agent loops.
OWASP's Unbounded Consumption entry (LLM10:2025) lists timeouts, throttling, quotas and monitoring among its mitigations.