Skip to content
be-human.ai
← Back to the journal

Harness fundamentals

Stop Conditions for AI Agent Loops: When to Halt and Escalate

Set halt rules for AI agent loops: stop after repeated tool failures or scope drift, and route each stop to a named owner who decides the next step.

Be Human typographic cover with the title: Stop Conditions for AI Agent Loops: When to Halt and Escalate
Conceptual illustration created with AI · Be Human

A stop condition is a rule in the agent harness that ends a loop before it repeats failed actions, leaves its approved scope, or keeps spending time and tokens without progress. Every halt should hand the work to one named person who decides what happens next, so the agent never settles that question on its own. The rules that matter most cover four triggers: repeated tool failures, scope drift, budget exhaustion and missing progress.

Key takeaways

  • Write halt rules before the first live run, not after the first incident.
  • Trigger halts on observable signals: identical tool errors, actions outside the task contract, budget ceilings and no change in state.
  • Make stopping the default. The agent halts, saves state and reports, rather than retrying with a new idea.
  • Give every escalation one named owner, a backup and a written response window.
  • Test each rule in staging with deliberately broken tools before the agent touches real customers, records or money.

Why agent loops need halt rules the model cannot override

An agent loop repeats one cycle: read the current state, choose an action, call a tool, read the result and decide again. Each step can look reasonable on its own, which is why a loop can fail for a long time without any single step looking wrong. A prompt that says to keep going until the task is done gives the model no reliable way to notice that the task is impossible or that a tool has been broken for every attempt. The model can propose the next step, but the harness should decide whether that step is allowed. Anthropic's guidance on building effective agents treats stopping conditions and human checkpoints as part of agent design, and the OWASP Top 10 for LLM Applications lists excessive agency as a risk, meaning a system that takes more action than its purpose requires. If you want the mechanics first, how an agent decides its next step explains where the loop gets its direction.

The four halt triggers and how to set them

Each trigger should be measurable, written down and checked by the harness, not by the model's own judgment.

  • Repeated tool failure: the same tool returns the same class of error on consecutive attempts. Use a lower threshold for write actions than for reads, for example two identical failures on a write and three on a read. A write that times out is the most dangerous case, because the agent cannot know whether the action happened.
  • Scope drift: an action touches a record, recipient, amount or system outside the task contract. Any out-of-contract action halts at once. It does not wait for a count.
  • Budget exhaustion: the run reaches its step, token or elapsed time ceiling. The stop should preserve state rather than discard it. The step and token budget guide covers how to set these ceilings and the alerts that come before them.
  • No progress: the state has not changed after a set number of steps, or the agent proposes a plan it has already tried. Repetition is a signal even when no error appears.

Treat every threshold as a starting point. Tune it in a test environment and review it after real stop records show whether the rule was too strict or too loose.

A step-by-step halt and escalation plan

When a trigger fires, the harness should run the same sequence every time, so that a halt looks the same whether it happens at night or during a busy afternoon.

  • Stop issuing new tool calls. Do not let the agent try a variant of the failed action.
  • Protect side effects. If a write may have partly completed, mark it as unknown, not failed.
  • Save a checkpoint with the last confirmed state, the inputs and the pending action.
  • Write a stop record: the trigger, the evidence, the actions attempted and what was deliberately not done.
  • Send the stop record to the named owner through a channel that person actually watches.
  • Let the owner choose one outcome: resume with a changed instruction, finish the work by hand, or close the task.
  • Log the decision. If the trigger was a false alarm or missed a real case, update the rule and record the change.

OpenTelemetry's observability concepts are a useful reference for what a stop record should let someone reconstruct: the sequence of steps, the inputs at each point and the outcome. A stop record that only says the agent failed is not enough for the owner to decide anything.

Who owns the escalation path

An escalation sent to the whole team is not an escalation, because everyone assumes someone else will act. Name one primary owner for each agent and one backup, and write down the response window. The business owner of the task decides whether the work should be done at all. The technical owner decides whether the tool failed, whether the trigger is set correctly and whether the harness can resume safely. Only the owner can resume a halted write, and that decision should be recorded in the stop record. Checkpoints and resume make this practical, because a resumed run can continue from the confirmed state instead of repeating steps that already completed.

Illustrative scenario: a refund follow-up that keeps timing out

The following scenario is illustrative and does not describe a real company. An agent reads support tickets and issues refunds through a payment tool, but only for orders that meet written criteria. The payment provider times out twice on the same refund. Without a halt rule, the agent may retry with altered parameters, and a retry could create a second refund if the first one succeeded. Under the rules above, the write halts on the second timeout and the refund is marked unknown. The stop record goes to the finance operations lead, who is the named owner, with the technical owner as backup. The owner checks the provider's record for that order, finds that no refund was issued, and resumes the action with the same idempotency key so the provider cannot apply it twice. The record is then closed with a note about the timeout pattern for the next review.

Testing halt rules before live work, and how Be Human handles it

Test halts in staging by breaking things on purpose. Return errors from a tool, slow responses until the budget runs out, and a write that times out after it has already succeeded. Check three things: the agent stops without trying a variant, the saved state is complete, and the stop record reaches the right person within the response window. The NIST AI Risk Management Framework treats risk management as an ongoing practice of mapping, measuring and managing risk, which fits halt rules that need review as the work changes. In Be Human's managed operations, halt rules are part of the first engagement definition, alongside the role, the memory and tools the agent needs, its approval boundaries and the named escalation owner. Monitoring watches stop records, recurring evaluations check whether the triggers still fit the work, and permission review removes tools the agent no longer needs. Changes to a rule go through controlled improvements, so the owner can see what changed and why.

If you are not yet sure which of your workflows deserves an agent first, the free Be Human AI diagnostic can help you find the first task worth handing to an agent.

Frequently asked questions

Should an agent ever retry a failed action on its own? Sometimes, but only for reads or for actions the harness can prove are idempotent, meaning a repeat cannot change the outcome. Any retry should be allowed by a written rule with a limit, not by the model's judgment in the moment. For writes that time out, the safe default is to halt and check whether the action happened before anything else runs.

How many failures should trigger a halt? There is no universal number, and any figure presented as correct for every workflow would be guesswork. Start with a low threshold for write actions, a higher one for reads, and an immediate halt for any action outside the task contract. Review the thresholds with the stop records after the first weeks of real work.

Who should own the escalation for an agent? One named business owner should decide whether the work continues, and one technical owner should handle the harness, with a named backup for each. The owner needs authority to resume, change or stop the agent, plus a response window written into the operating notes. If the owner cannot be reached, the agent should stay halted rather than continue.

Is a stop condition the same as a budget or a guardrail? They overlap but are not identical. A budget limits how much an agent can spend or run, a guardrail limits what it is allowed to do, and a stop condition ends the loop when a trigger fires and hands the decision to a person. A well-designed harness uses all three, so that each one catches a failure the others might miss.

Your next step

See where an AI agent fits in your company first.

Take the free Be Human AI diagnostic. A few questions about your work show which task to hand to an agent first, what it needs to know and where a person approves.

Be Human editorial guidance. Examples are illustrative unless explicitly attributed. Sources provide background; implementation choices depend on your workflow.

Less busywork. More room for you.

Bring us the work you wish you had time for.

Book a call to try a personalized AI agent free for 7 days ↗Or take the free AI diagnostic →