stop condition
In plain wordsThe rule that tells an AI agent when to stop working — because the task is done, a time or cost limit has been reached, or something has gone wrong.
A rule that ends an agent loopagent loop, n.: The repeating cycle at the heart of an AI agent: the model decides what to do next, software carries it out, the result is shown to the model, and the cycle repeats until the task is finished.. The natural stop is the model returning a final answer without requesting more tool callstool call, n.: A single request from an AI model to use one of its tools — naming the tool and filling in the details — which the surrounding software then carries out and reports back on.; harnesses add hard limits — maximum turns or iterations, token, cost or time budgets — and external checks such as a passing test suite, a verifierverifier, n.: A program or AI model that checks whether a proposed answer is correct — by running tests, comparing with a known result or judging the reasoning — so that good answers can be picked or rewarded.'s approval, a human interrupt, a hookhook, n.: A user-supplied script or check that runs automatically at set moments in an AI agent's work — before a command, after a file edit, when it tries to stop — enforcing rules the AI cannot skip. that refuses to let the agent finish, or detection of loops and repeated failures. Well-chosen stop conditions guard against two opposite failures: premature stopping, where an agent declares success on unfinished work, and runaway loops that burn budget or take harmful actions. Anthropic's 2024 guidance on building agents recommends that autonomous agents carry limits such as a maximum number of iterations.
Set the stop condition to all tests passing or 40 turns, whichever comes first.
Origin
Termination criteria are standard in iterative algorithms and search, and terminal states in reinforcement learningreinforcement learning, n.: A way of teaching a computer program by trial and error: it tries actions, earns points for good results and penalties for bad ones, and gradually learns which choices pay off over time.. Early language-model agents such as AutoGPTAutoGPT, prop. n.: A 2023 open-source program that gave GPT-4 a goal and let it run on its own — planning, searching the web and writing files in a loop — becoming the first viral 'autonomous AI agent'. (2023) became notorious for looping without finishing, which made explicit stop conditions a basic element of agent design.
Usage note
Do not confuse with a stop sequencestop sequence, n.: A piece of text that tells an AI model to stop writing as soon as it produces it — for example, stopping at a blank line or just before the next question., a string that halts token generation within a single model call.
Related
- agent loopagent loop, n.: The repeating cycle at the heart of an AI agent: the model decides what to do next, software carries it out, the result is shown to the model, and the cycle repeats until the task is finished.
- harnessharness, n.: The software around an AI model that gives it instructions and tools, carries out its actions and decides when it stops. The model is the engine; the harness is the rest of the car.
- hookhook, n.: A user-supplied script or check that runs automatically at set moments in an AI agent's work — before a command, after a file edit, when it tries to stop — enforcing rules the AI cannot skip.
- verifierverifier, n.: A program or AI model that checks whether a proposed answer is correct — by running tests, comparing with a known result or judging the reasoning — so that good answers can be picked or rewarded.
- long-horizon tasklong-horizon task, n.: A job that takes many steps and a long time — hours or days of work rather than a single answer — so an AI must stay on track and recover from its own mistakes.
- AutoGPTAutoGPT, prop. n.: A 2023 open-source program that gave GPT-4 a goal and let it run on its own — planning, searching the web and writing files in a loop — becoming the first viral 'autonomous AI agent'.
- stop sequencestop sequence, n.: A piece of text that tells an AI model to stop writing as soon as it produces it — for example, stopping at a blank line or just before the next question.
Sources
- Schluntz, E. & Zhang, B. (2024). Building effective agents. Anthropic. anthropic.com/research/building-effective-agents
Mentioned in
agent loopagent loop, n.: The repeating cycle at the heart of an AI agent: the model decides what to do next, software carries it out, the result is shown to the model, and the cycle repeats until the task is finished., AutoGPTAutoGPT, prop. n.: A 2023 open-source program that gave GPT-4 a goal and let it run on its own — planning, searching the web and writing files in a loop — becoming the first viral 'autonomous AI agent'., stop sequencestop sequence, n.: A piece of text that tells an AI model to stop writing as soon as it produces it — for example, stopping at a blank line or just before the next question., hookhook, n.: A user-supplied script or check that runs automatically at set moments in an AI agent's work — before a command, after a file edit, when it tries to stop — enforcing rules the AI cannot skip., Ralph Wiggum loopRalph Wiggum loop, n.: A blunt way of using AI coding assistants: feed the same instructions to the AI again and again in an endless loop until the software gets built.