technical-term · Harness & runtime · maturing · Reviewed

Agent loop

The finite runtime cycle in which an agent interprets state, selects an action, observes the result, updates state, and decides what happens next.

Definition

The agent loop is the control cycle that turns a model call into goal-directed behavior: construct context, reason or plan, choose a tool or response, validate the proposed action, execute inside bounds, observe the effect, update working state, verify progress, then finish, retry, correct, hold, or escalate.

The loop pattern is well established; robust long-running recovery and control remain active engineering areas.

Why it matters

Each loop turn changes the next decision context, so small errors can compound.

Finite verbs and budgets make loop behavior testable: bind, block, correct, hold, release, escalate, stop.

System anatomy

Orient
Construct the current state and bounded context.
Decide
Select a next action or termination state.
Act
Validate and execute through a governed tool.
Observe
Capture the result and environmental change.
Disposition
Continue, correct, finish, hold, or escalate.

Important distinctions

Infinite retry
A production loop has budgets, state changes, and an explicit terminal condition.
Chain of thought
The loop is an observable software control structure; private model reasoning is not the system boundary.

Implementation signals

  • Make each transition and side effect observable
  • Require new evidence before retrying
  • Test completion and failure paths as first-class behavior

Failure modes

  • Retrying the same prompt without changing state
  • Tool side effects occurring before policy and argument checks
  • No durable checkpoint before context loss

Sources and further study

  1. Anthropic — Trustworthy agents in practice

    Describes a self-directed plan–act–observe–adjust loop and the engineering layers needed to make longer-horizon agents more trustworthy.

    Use in this library: Primary definition. This first-party synthesis describes design directions and failure surfaces; it is not a certification scheme or evidence that every described control is sufficient.

    guidance · guidance · Published 2026-04-09
  2. arXiv / ICLR — ReAct: Synergizing Reasoning and Acting in Language Models

    Studies interleaved reasoning traces and environment actions, a foundational pattern for model-driven agent loops.

    Use in this library: Primary definition. Reported benchmark gains do not establish reliability for open-ended production environments or permission for consequential action.

    paper · paper · Published 2022-10-06
  3. OpenAI — A practical guide to building agents

    Defines a practical agent around a model, tools, instructions, and a run loop that continues until an exit condition is reached.

    Use in this library: Primary definition. The guide is first-party product guidance and a simplified starting architecture, not a complete regulated-enterprise control model.

    guidance · guidance · Published 2025