Agents and automation

Agent loop

stable definition
Machine-readable Download Markdown

Definition

An agent loop is the repeated control cycle in which an agent observes its state, selects an action, invokes a model or tool, receives a result, updates state, and decides what to do next. A useful loop also has explicit outcomes for completion, handoff, pause, timeout, budget exhaustion, and failure.

The loop can be only a few lines of code. Its operational behavior still depends on the surrounding harness: which observations enter context, how tool errors are represented, what state persists, who can approve an action, and how the system detects that it is no longer making progress.

Without bounded retries and a termination policy, a loop can turn one plausible mistake into repeated cost or damage. Durable loops record attempts, distinguish transient failures from semantic failures, and escalate when another iteration is unlikely to help.

Distinguish it from nearby terms

The loop is the local cycle of observe, act, and update. A workflow defines a larger sequence of work. Orchestration coordinates tasks, runs, agents, and lifecycle around one or more loops. A control graph may contain loops as cycles.

Check your understanding

An agent retries the same failing API call with slightly different wording until its budget is gone. It has a loop, but no useful progress test or failure policy.