Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
Canonical stops are a final-answer signal, a step budget, and a cost or time budget. Tool-count and logit-confidence are not real termination conditions.
Imagine giving a kid a treasure hunt. They keep going until they find the treasure, that is the happy ending. But you also need backup rules so they do not wander forever. So you say: stop after twenty clues, or stop when you have spent all your allowance, or stop when it is dinner time. Those backup rules do not care whether the kid is smart or close to the answer. They just count steps, money, or minutes and call time. A bad rule would be stop once you have touched every tool in the shed, that has nothing to do with finishing. Another bad rule is stop when you feel ninety-nine percent sure, because a confident kid can be confidently wrong. An agent loop works the same way. It stops on success or on a hard limit, never on a vibe.
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.
Name the three canonical stops, separate the agent-signalled final answer from the runtime-enforced step and cost budgets, argue why a hard cap is a mandatory backstop, then explain why tool count and logit confidence both fail as termination criteria, and finish with repeated no progress and human-stop as the realistic extensions.
| Condition | Who controls it | Valid stop? | Why |
|---|---|---|---|
| Final-answer signal | Agent | Yes | Designated done token or action marks task complete |
| Step budget | Runtime | Yes | Hard cap on iterations, the primary backstop |
| Cost or time budget | Runtime | Yes | Bounds token spend and wall-clock latency |
| Tool count used | Runtime | No | Coverage of tools is unrelated to goal completion |
| Logit confidence over 0.99 | Agent | No | Token probability is not calibrated to task success |
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.
Picking confidence score because it sounds rigorous. Token logits are not calibrated task-success signals, so a high probability says nothing about whether the agent actually finished the job.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.