Designing Stopping Conditions for Autonomous Agent Loops

Model-generated stop signals are unreliable; orchestrators need independent termination checks.

· 10 min read
Cover illustration for “Designing Stopping Conditions for Autonomous Agent Loops”
Agent Failures · October 15, 2026 · 10 min read · 2,148 words

The agent loop is the reason–act–observe cycle that drives every step an autonomous system takes: the model reasons, the runtime executes, observation feeds back in, and the loop iterates until a termination condition fires. When that condition is absent or vaguely specified, the loop iterates past the point where any value is being produced, and the system continues spending time, tokens, and money. A free-form loop with no upper bound and no progress signal is not a fringe case. It is the default shape of most agent deployments today.

A termination failure has a recognizable signature. A web scraping agent starts a routine extraction, finishes it, and keeps running. The model has decided the task is done, but the orchestration layer has no independent check to confirm that the decision is right. The loop keeps iterating. No error appears, no timeout fires, no resource threshold trips. The system simply continues working, producing output that no one asked for and consuming budget that was never authorized. This is not a hypothetical scenario but a documented pattern that recurs across agentic systems, and it is the reason termination deserves its own design discipline rather than a line in a prompt.

Why delegating the stop decision to the model is a structural reliability gap

Taking a model-generated signal as the authoritative decision to terminate is not a minor oversight. It places a critical control decision inside the component least qualified to make it reliably. Models can and do emit false declarations of success. The evidence-grounded taxonomy of 32 failure modes across eight families published by Sahir Maharaj at Microsoft in August 2026, known as AFT-32, includes "verification and termination" as its own family precisely because this failure pattern is distinct enough and frequent enough to warrant dedicated categorization. The model's judgment about its own completion is itself an agent output, subject to the same failure modes as any other output. It cannot serve as the authoritative stop signal.

Liu, writing in June 2026, formalizes this problem as the Entropy Principle. Silent failures, the principle argues, are not implementation defects but the inevitable consequence of intrinsic properties of language-based systems operating without external deterministic constraints. System disorder increases monotonically with interaction rounds whenever a sufficient subset of the system's intrinsic properties co-exist. The model's claim that it has finished is one more interaction round, one more output, one more opportunity for the entropy to express itself. A monitoring system built to audit traces against agent instructions rather than relying on implicit success codes can catch the moment a model's completion claim diverges from what the agent was actually supposed to do. That is the function Lemma serves: the completion signal gets treated as a claim to be checked, not a fact to be trusted.

The strongest objection to orchestrator-level termination is that modern reasoning models are good enough at self-assessment that a well-prompted completion signal works in practice. The answer is that even well-prompted models fabricate tool inputs when required information is absent, and reasoning models in particular tend to prioritize action over seeking clarification. The self-assessment pathway fails exactly when the situation is most ambiguous. And ambiguity is precisely when a reliable stop decision matters most. A model that cannot reliably tell whether it has enough information to proceed is also the model that cannot reliably tell whether it has enough information to stop.

What "verification and termination" failures actually look like in a running system

Termination failures have a recognizable signature in traces, and that signature is systematically different from the crashes that traditional monitoring catches. A useful distinction separates two broad failure types. Security failures result in loss of confidentiality, availability, or integrity. Safety failures affect responsible implementation and often result in harm to users or society. Termination failures sit in the safety column, so they pass all availability checks while causing user harm. The observable signature, documented by Liu in June 2026, is stark in its ordinariness: the task completes with subtly degraded output, there is no error message, no timeout, no resource bottleneck. The failure is detectable only through systematic measurement after the fact.

The multi-agent coordination dimension compounds the problem. In a pipeline of agents, a false completion signal from one agent becomes the input assumption for the next. The failure propagates silently across the network before any node reports an error. Agent A declares success without producing the validated output Agent B requires. Agent B consumes that output as authoritative context and proceeds on a foundation that does not exist. No exception is raised at any point. Traditional application performance monitoring tools cannot catch this category. They are built for explicit exceptions, stack traces, and error codes, but these failures return HTTP 200 OK throughout. The system looks healthy to every tool watching it. Lemma surfaces safety failures by comparing trace outcomes against agent instructions, detecting and grouping verification breakdowns into actionable patterns before users are affected.

The four stopping conditions every agent loop needs at the orchestration layer

Diagram: The Four Stopping Conditions Every Agent Loop Needs. Visualizes: Visualize a priority-ordered sequence of four termination checks that every agent loop must evaluate at the orchestration layer.

Effective termination requires three distinct conditions encoded in the runtime, evaluated in priority order, and a terminal reason is recorded so the next execution understands why the loop ended. The priority ordering matters. Evaluate completion first: does the output contain the expected result and pass validation? Then progress: did state, evidence, or the decision change since the last turn? Then budget: are steps, time, or tokens exhausted? Each layer is a distinct check, and collapsing them into a single model-side prompt is what creates the gap in the first place.

The completion condition demands an independent check. The model may suggest that it is done, but code must check the condition and validate against expected output shape rather than the model's self-report. A completion signal without an independent validator is not a completion condition at all. It is a suggestion. The progress signal serves a different purpose. The absence of progress is a stopping condition, not a reason to retry. If state, evidence, and the decision have not changed across N consecutive steps, the loop is not converging, and continuing it is waste. This is the condition that would have stopped the scraping agent: nothing in its state, evidence, or decision had changed for turns, yet the loop continued because no mechanism existed to notice the stasis.

The budget gate is a hard upper bound on steps, time, and tokens, and it is not a fallback but a mandatory component. Google Cloud's agent architecture guide warns that a termination condition that is not correctly defined, or subagents that fail to produce the state required to stop, can leave the loop running indefinitely. The budget gate is the last line of defense when the completion and progress checks both fail to fire. A repeated-action guard complements the budget gate: when the same tool with similar arguments has fired more than a configurable threshold of times per trace, the system treats that as a termination trigger rather than a retry opportunity. Together these conditions mean that a production agent supports exits for successful completion, refusal, hard iteration limit, deadline, and repeated actions at minimum. You may also need cancellation, approval denial, budget exhaustion, and invalid-output exits. Each exit type should produce a distinct terminal reason code that downstream systems can read.

The terminal reason record is not optional. Without it, a retry or a human reviewer has no basis for understanding what the prior run decided, and the same loop failure recurs. The reason code closes the loop between execution and observability, and it is the bridge to the orchestration-layer trace visibility that the next section examines.

Escalation triggers and human-approval gates as first-class stopping conditions

Stopping the loop is not always the right termination. Sometimes the right outcome is pausing and routing to a human, and treating that as an afterthought rather than a designed condition is a separate class of reliability gap. Microsoft's AI Red Team taxonomy update from June 2026 adds Goal Hijacking and Inter-Agent Trust Escalation as distinct failure mode categories. Both describe situations where the agent is technically completing steps but pursuing the wrong goal, or operating with escalated authority it should not have. These failures are not catchable by a step cap or a token limit. They require a semantic check against what the agent was authorized to do in the first place.

A bypass attack removes or circumvents approval gates. The taxonomy has covered it from the original version and the update reinforces it: removing or circumventing approval gates is itself a documented threat vector. An agent that can be instructed by its own context to skip an approval gate has no approval gate. Escalate rather than terminate when the agent resolved ambiguous instructions by assumption rather than clarification, when actions cross an irreversibility threshold such as deletions or financial commitments or external communications, and when tool calls exceed the agent's declared authority scope. A deletion operation, once executed, cannot be rolled back by retrying the loop. That is the irreversibility threshold in its clearest form. Conditions that should trigger a hard approval gate are equally specific: any action the agent has not previously been authorized to take in this context, any output that contains a commitment on behalf of the user or organization, and any step that cannot be rolled back. Escalation and approval conditions must be specified at the same layer, and with the same explicitness, as step caps.

Why these conditions cannot be observed without orchestration-layer trace visibility

Encoding stopping conditions in the orchestration layer is necessary but not sufficient. A team cannot know whether conditions are firing correctly without end-to-end trace visibility. You need to capture the full execution, not just per-call logs. The artifact that matters in an agentic system is the full execution trace: the tool that was called, the arguments passed, the external state that changed, the retry that silently masked a failure. A green dashboard trace with a false completion signal is indistinguishable from a genuine completion without tool input/output capture and schema validation.

Liu's Entropy Principle makes the observability requirement structural. Because silent failures are the inevitable consequence of intrinsic system properties rather than implementation bugs, they can only be managed through deterministic governance. And deterministic governance requires measurement, not inspection. A working observability stack must capture specific stopping-condition data for every run: the terminal reason code, the step count and token spend at termination, the tool call sequence with input/output pairs, and any repeated-action pattern that preceded the stop. In a multi-agent pipeline, a false completion in Agent A becomes a valid input assumption for Agent B. Catching that failure requires trace context that flows across agent boundaries, not just per-agent logging. Auditing every trace against the agent's own instructions, grouping deviations into actionable issues automatically, and surfacing them in the developer's existing workflow rather than a separate console makes stopping-condition failures visible and addressable without forcing a context switch. That is the audit model Lemma employs, and it applies directly to the terminal reason codes and progress thresholds the previous sections specified.

Building stopping conditions into the development workflow, not as a post-ship retrofit

Stopping conditions retrofitted after a production failure are almost always incomplete, because the failure mode that surfaced is not the full population of failure modes that exist. The right point to encode these conditions is before the agent ships. The design sequence that produces reliable stopping conditions is straightforward but demanding: specify the completion condition before writing the planner prompt, define the authority scope before wiring tool access, set the budget and progress thresholds before the first production trace runs, and wire escalation and approval gates before the agent can take irreversible actions.

CI-gated eval pipelines are an emerging production standard that applies directly to this problem. Evals run on every pull request, results post to the pull request itself, and merges are blocked when agent quality degrades. A regression in termination behavior should block a merge the same way a regression in task success does. What this means in practice is that a stopping-condition eval suite contains cases drawn from real failures. Production traces convert into reusable eval cases, so each incident that reveals a missing or misfiring condition becomes a test the next pull request must clear. The suite grows from incidents rather than from imagination, which is the only way it can cover the failure modes that actually occur.

Shipping an agent without encoded stopping conditions is not an early-stage shortcut. It is a structural bet that no production incident will expose the gap before the team has time to add the conditions. That bet rarely pays. The practical implication of the Entropy Principle closes the argument: because disorder increases monotonically with interaction rounds, retrofitting stopping conditions after a failure catches one failure mode while the underlying structural entropy continues to accumulate. Only deterministic governance applied from the start keeps the curve flat.

Sources

  1. A Taxonomy of Failure Modes in Autonomous Agentic Systems by Sahir Maharaj :: SSRN
  2. Silent Failure in LLM Agent Systems: The Entropy Principle and the Inevitable Disorder of Autonomous Agents
  3. Updating the taxonomy of failure modes in agentic AI systems: What a year of red teaming taught us
Filed underAgent Failures

More in Agent Failures