# Agent Stop Condition

> A rule that tells an AI agent when to stop. A turn limit is one.

**Field:** Artificial Intelligence  
**Category:** AI Agents  
**Also known as:** Max Iterations (Agent), Agent Turn Limit, Agent Budget Limit

## Think of it like

It is like a timer on an oven. It stops the cooking even if no one is watching.

## Definition

An agent stop condition is a rule that tells an AI agent when to stop working. The best stop is the goal being met, such as all the tests passing. Agents also need hard limits in case they get stuck, such as a most number of turns, a time limit or a spending cap. When a limit is hit, the agent stops and says why. Without one, a stuck agent can loop for hours and run up a large bill.

## Example

Jack runs a coding agent with a limit of 30 turns. On a hard bug it hits turn 30, stops and reports what it tried, instead of looping all night.

## Why it matters

Agents can get stuck in loops. A stop rule caps the time and money a bad run can waste.

## Common mistake

Setting only a goal and no limit. If the goal can never be met, the agent never stops.

## Three principles

- **Goal met.** The best reason to stop.
- **Hard limits.** Turns, time or money as a backstop.
- **Say why.** Report which rule ended the run.

## Related terms

- [Agent Loop](https://learn.benibix.com/term/ai/agent-loop)
- [maxTurns Option](https://learn.benibix.com/term/ai/max-turns-option)
- [--max-turns Flag](https://learn.benibix.com/term/ai/max-turns-flag)
- [Long-Running Agent](https://learn.benibix.com/term/ai/long-running-agent)
- [Token Pricing](https://learn.benibix.com/term/development/token-pricing)

![A long row of numbered agent steps, read, run, edit, run, running for hours. Under it a log records every step. At the end a stop sign lists goal met, turn limit and budget. Above, a slider runs from suggests only, to asks first, to acts and reports.](https://learn.benibix.com/diagrams/ai7-agent-run.svg)

---

Source: https://learn.benibix.com/term/ai/agent-stop-condition
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-19
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
