Flashcard: why must every agent loop declare when to stop?
Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
A stopping condition is the rule that exits the agent loop: final-answer from the model, budget exhaustion (steps, tokens, cost, time), or unrecoverable error. The runtime enforces it; the model cannot police itself.
Imagine handing a very eager intern an unlimited stack of work and saying 'just keep going.' Without a clear rule for when to stop, they will work forever, or until they fall over. Agents have the same problem. The LLM can always think of one more tool to call, one more lookup to try, one more refinement. Stopping conditions are the rules the runtime uses to say 'okay, that is enough.' Sometimes the rule is positive (the model produced a finished answer). Sometimes the rule is a budget (we have used twenty steps already). Sometimes the rule is an emergency brake (the same tool keeps failing). Without these rules, the loop can spin until the cost bill arrives. With the wrong rules, the agent gives up too early and hands back a half-done answer.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
5 min: define stopping condition, list the three canonical kinds (final answer, budget, error), explain why the model cannot enforce its own budget, describe stuck-state detection as an extra layer, and note how partial answers should be surfaced.
Real products, models, and research that use this idea.
What an interviewer would ask next. Try answering before peeking at the approach.
Red flags and common mistakes that signal junior thinking. Click to expand.
Relying on the model to know when to stop. The model has no view of the budget or the wall clock; the runtime is the only component that can enforce a stopping condition.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.