Definition: Stop conditions are the rules that tell an AI agent when to end its loop: the task is done, it is stuck, it hit a step or cost limit, or it needs a person. Agents without clear stop conditions either loop on the same step or quit before the job is finished, two of the most common agent failures.
TL;DR: Every agent loop needs four exits: done, stuck, over budget, and hand off. In the MAST study of 1,642 agent traces, step repetition (15.7%), not knowing when to stop (12.4%), and stopping too early (6.2%) together made up about a third of failures. Write a done test the agent can check. See the agent loop for the cycle these rules end.
Think of a cleaner you hire for a house. You do not say "clean until you feel like stopping". You say "do the kitchen, two bathrooms, and vacuum downstairs, you have three hours, and call me if you find a leak." That one sentence holds all four stop conditions: what done looks like, a time budget, and when to hand back to you. If the cleaner gets stuck on a stain, they do not scrub it for three hours. They move on and mention it. AI agents need the same instructions, written down, because they do not have the cleaner's common sense about when to stop.
Why Stop Conditions Matter in 2026
Stop conditions matter because an agent decides its own next step, so it also has to decide when there is no next step. A chat answer ends when the text ends. An agent in a loop can call tools, read results, and call more tools for as long as it likes. Without a rule, it keeps going.
Anthropic put the rule plainly in Building effective agents (December 19, 2024): "The task often terminates upon completion, but it's also common to include stopping conditions (such as a maximum number of iterations) to maintain control." The same post says agents "pause for human feedback at checkpoints or when encountering blockers."
The research shows what happens without good rules. In Why Do Multi-Agent LLM Systems Fail? (NeurIPS 2025), Cemri and colleagues labeled failures across 1,642 traces from seven open-source multi-agent frameworks. Three of the 14 failure modes are stop-condition failures:
| MAST failure mode | Share of failures | Paper definition, in short |
|---|---|---|
| Step repetition | 15.7% | "Unnecessary reiteration of previously completed steps" |
| Unaware of termination conditions | 12.4% | No recognition of "the criteria that should trigger the termination" |
| Premature termination | 6.2% | Ending "before all necessary information has been exchanged or objectives have been met" |
Together that is 34.3% of all labeled failures. Step repetition alone was the largest single mode in the study. Users see the same thing. On Hacker News in October 2026, one user testing a small open-weight model reported that "it looped on variations of the same paragraph for five minutes before running out its turn budget" (thread). The budget was the only thing that stopped it.
The Four Ways a Loop Should End
A well-built agent loop has four exits. Each one needs its own rule.
| Exit | What triggers it | What the agent returns | Example rule |
|---|---|---|---|
| Done | The done test passes | The final result | "Stop when every row in the table has a price and a source link" |
| Stuck | No progress for a set number of steps, or the same action repeated | What it tried and where it got stuck | "Stop if the last 3 steps produced no new information" |
| Budget | A step, time, token, or cost limit is reached | The partial result and what is left | "Stop after 25 tool calls or 10 minutes" |
| Hand off | A decision, a fact, or a permission the agent does not have | A question or a draft for a person | "Stop and ask before any payment over $100" |
The order matters when two fire at once. Done comes first, so a finished job is never reported as stuck. Hand off comes before budget for anything risky, so the agent asks before it spends.
The diagram shows the exits only. Inside "Working", the agent runs its normal loop of reason, act, and observe, and checks the four rules after every step.
The check order after each step can be written as a short decision path:
Looping and Quitting Early
Looping and quitting early are opposite failures with the same cause: the agent does not know what done looks like.
Looping happens when the agent cannot tell that it already did something, or that it is making no progress. It searches for the same thing again, rewrites the same paragraph, or retries a tool that keeps failing. Models make this worse over time. In The Illusion of Diminishing Returns (ICLR 2026), Sinha and co-authors found that models make more mistakes when their context holds their own earlier errors, an effect they call self-conditioning. A loop full of failed attempts makes the next attempt more likely to fail.
Quitting early happens when the agent decides the job is done before it is. It answers after the first search, writes three rows of a ten-row table, or reports success without checking. The agent loop page calls this silent wrong-completion: the one failure that produces a confident report instead of an error.
SIGNS OF A LOOP SIGNS OF AN EARLY STOP
------------------------------------ ------------------------------------
same tool call with the same input final answer after one tool call
same text drafted again with a output shorter than the spec asks
few words changed "done" with items still unchecked
a retry after the same error no check step before the answer
step count rising, result unchanged success reported, nothing verified
The fix for both is a done test the agent can check, plus a progress check after each step.
Budgets: Steps, Time, and Cost
A budget is the last line of defense. It does not make the agent smarter, but it caps the damage when the other rules fail. Agent frameworks ship one by default:
| Framework | Budget setting | What happens at the limit | Source |
|---|---|---|---|
| OpenAI Agents SDK | max_turns |
Raises MaxTurnsExceeded, or returns a controlled final output from an error handler |
Running agents |
| LangGraph | recursion_limit, default 1,000 steps since version 1.0.6 |
Raises GraphRecursionError |
Graph API docs |
| Anthropic guidance | "a maximum number of iterations" | The loop ends and control returns | Building effective agents |
The OpenAI docs also define the done exit precisely: the loop ends when the output is "text output with the desired type, and there are no tool calls." That is a mechanical done test. It says the model chose to stop. It does not say the work is correct.
Set three kinds of budget, because each one catches a different failure:
- Steps catch loops. Count tool calls or model turns. Pick a number a little above what a good run needs, and look at every run that hits it.
- Time catches slow tools and stuck waits. A run that should take one minute and has taken ten is wrong, even if it is still making calls.
- Cost catches expensive loops. A cap on tokens or spend per run keeps one bad run from using a month's budget.
When a budget fires, return the partial result and a short note on what is left. A run that stops with "found 7 of 10 prices, 3 suppliers did not answer" is useful. A run that stops with an error is not.
Write a Done Test
A done test is a short checklist the agent can verify against its own output. It turns "stop when finished" into something a model can check.
Good done tests have three properties:
- Each item is checkable. "Every row has a source link" can be checked. "The research is thorough" cannot.
- They check the goal, not the format. MAST found that many verifiers "perform only superficial checks", such as whether code compiles. A done test for a chess program must test the rules of chess.
- They live outside the prompt. Put the checklist in a document the agent reads at the start and checks at the end. Then every run, and every person, uses the same definition.
For example, a done test for a weekly competitor summary might read:
DONE WHEN
[ ] one section per competitor on the list (5 sections)
[ ] each section has the date of the newest change found
[ ] each claim links to the page it came from
[ ] "no change this week" is stated, not skipped
[ ] summary is under 400 words
STOP AND ASK IF
[ ] a competitor page cannot be read
[ ] a change affects our pricing
A separate checker, as in the reflection pattern, can run the test so the agent does not grade its own work.
A Short History of Stop Conditions
| Year | Milestone | What it added |
|---|---|---|
| 2022 | ReAct, Yao et al. | A "finish" action that ends the reason-act loop |
| 2024 | Anthropic, Building effective agents | Completion plus "a maximum number of iterations", and pauses at blockers |
| 2025 | MAST, Cemri et al. | Step repetition, unaware of termination, and premature termination as measured failure modes |
| 2025 | Levels of Autonomy for AI Agents, Feng et al. | At the approver level, the agent stops and asks only when it hits a blocker it cannot resolve |
| 2025 | The Illusion of Diminishing Returns, Sinha et al. | Errors in context cause more errors, so long loops degrade |
How Stop Conditions Show Up in Taskade
Every Taskade run has a clear exit. An automation ends at its last step, a loop step ends when its list ends, and a branch step can hand a failed check to a person. A chat agent stops when it answers or asks you a question. For long jobs, keep the done test in a project the agent reads.

| Exit on this page | Where it lives in Taskade |
|---|---|
| Task done | The last step of a Taskade automation |
| List exhausted | A loop step that runs once per item |
| Hand-off to a person | A branch step that creates a task for a person when a check fails |
| Ask instead of guess | Taskade EVE pauses to ask you a question during a build |
| Done test | A checklist project attached as agent knowledge |
A weekly competitor summary that someone writes by hand on Friday is the plain use. In Taskade you keep a project with the competitor list and the done checklist above. A scheduled automation runs on Friday morning. A loop step goes through each competitor, and an AI agent with web search reads their pricing and changelog pages and writes a short section. A second Agent step checks the draft against the checklist. If it passes, the summary goes to the team channel. If a page could not be read or a change touches pricing, a task goes to a person instead. The run always ends, and it always says why. Taskade Genesis builds the first version of that app from one prompt. To start from a working example, clone the Content Workflow kit, an app kit with projects, AI agents, and automations you can clone. The Free plan covers 3 apps and 1 agent and starts with 0 AI credits.
Describe yours and build it free →
Related Concepts
- The Agent Loop: the cycle stop conditions end
- Why AI Agents Fail: the MAST failure modes, including the three above
- ReAct Pattern: the reason-act loop and its finish action
- Plan-and-Execute Agents: when a replanner should give up
- Circuit Breaker: stopping repeated calls to a failing tool
- Agentic Exception Handling: what to do when a step fails
- Agentic Goal Monitoring: tracking progress toward the goal
- Resource-Aware Optimization: spending budget where it matters
- Human-in-the-Loop: the hand-off exit in detail
- Long-Horizon Agents: agents that need stop rules most
- Agent harness explained: the code around the model that enforces these rules
- Ambient Agents: agents that run on events in the background
- AI Agent Autonomy Levels: how much a person stays involved
- AI Agents: the hub for agent concepts in this wiki
Frequently Asked Questions About Agent Stop Conditions
What are stop conditions for AI agents?
Stop conditions are the rules that end an agent's loop. There are four kinds: done, when the task passes its check; stuck, when the agent stops making progress; budget, when a step, time, or cost limit is hit; and hand off, when the agent needs a person. Each needs its own written rule.
Why does my AI agent keep looping?
An agent loops when it cannot tell that it already did a step, or that it is making no progress. Step repetition was the largest single failure mode in the MAST study, at 15.7% of failures. Add a step budget, track completed steps where the agent can read them, and stop when several steps in a row add nothing new.
Why does my AI agent stop before the job is done?
It stops early when it has no clear definition of done, so it treats its first plausible answer as finished. Premature termination was 6.2% of failures in the MAST study. Give the agent a checklist of checkable items and have a separate step verify the output against it.
How many steps should an AI agent be allowed?
There is no single number. Run the job a few times, see how many steps a good run needs, and set the limit a little above that. Framework defaults vary: LangGraph's recursion limit is 1,000 steps, and the OpenAI Agents SDK raises an error at its max_turns setting.
What should an agent return when it hits a budget?
Return the partial result and a short note on what is left, not only an error. For example: found 7 of 10 prices, 3 suppliers did not answer. That gives a person something to act on and makes the next run easier to fix.
How do stop conditions work in Taskade?
A Taskade automation ends at its last step, and a loop step ends when its list of items ends. A chat agent stops when it answers or asks you a question. For long jobs, keep the done checklist in a project the agent reads, and use a branch step to send failed checks to a person.
Further Reading
- Anthropic, Building effective agents, December 19, 2024
- Cemri et al., Why Do Multi-Agent LLM Systems Fail?, arXiv 2503.13657, NeurIPS 2025
- OpenAI, Running agents, OpenAI Agents SDK docs
- LangChain, Graph API: recursion limit, LangGraph docs
- Sinha et al., The Illusion of Diminishing Returns, arXiv 2509.09677, ICLR 2026
- Feng, McDonald, and Zhang, Levels of Autonomy for AI Agents, arXiv 2506.12469, 2025
- Yao et al., ReAct: Synergizing Reasoning and Acting in Language Models, arXiv 2210.03629, 2022
- Hacker News, user report of a looping model, October 2026