Skip to content
ML Academy

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

  1. Situation

    An agent loop runs "until the task is done" with no limit on iterations, tokens, spend or wall-clock time.

  2. 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.

  3. Reason

    Anthropic's guidance recommends stopping conditions such as a maximum number of iterations, and OWASP lists unbounded consumption as an LLM application risk.

  4. 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