Stopping Conditions
Hard limits that force an AI agent to halt regardless of whether it has finished its task — a maximum number of iterations or tool calls (`max_turns`), a token or dollar budget (`max_budget`), a wall-clock timeout, or a repeated-error cap. Stopping conditions bound autonomy even when no human is watching, so a stuck Agent Loop or a runaway retry halts itself instead of escalating a small bug into a large bill or an infinite loop. They're a safety net beneath Human-on-the-Loop (HOTL) oversight, not a substitute for it.
Example
A research agent is capped at 25 tool calls and a $2 token budget per task. On a query where retrieval keeps failing, it hits the call cap, stops, and returns a partial result plus "couldn't verify — needs human review" rather than looping forever and burning $40.
Frequently asked questions
- What stopping conditions should every production agent have?
- At minimum: a max-iterations/turns cap (prevents infinite loops), a budget cap (prevents runaway cost), and a timeout (prevents hung runs). Add a repeated-failure cap so an agent that keeps hitting the same error stops and escalates instead of retrying indefinitely. Pair each stop with a defined fallback — what the halted agent returns or whom it notifies.