Case & CodeA FIELD GUIDE TO AI
Start learning
Intermediate

Agent loop

Also: agentic loop

In plain words

The cycle an agent repeats: look, decide, act, check, until the task is done or it must stop.

An assistant working through a to-do list
  1. Open the folder of letters
  2. Read each letter and note its date
  3. Write the dates into a table
  4. Email the table to the client stop: needs your approval

A chatbot answers one message. An agent keeps going: it decides the next step, does it, looks at the result, and repeats. The important design question is which steps it may take alone and which must wait for you.

The fuller definition

An agent loop repeatedly chooses a next step, invokes an available action, observes its result, and decides whether to continue or stop.

Go deeper

The agent loop
  1. ObserveRead the task, the current state, and the last result.
  2. DecidePropose the next action: a search, a file read, a calculation.
  3. ActThe harness runs the action, if permitted.
  4. CheckStop condition met? If not, loop again.

The model proposes; the surrounding software executes and records. Where the loop may act, and when it must stop and ask, are decisions made outside the model.

A concrete example

An agent searches for an attachment, reads a candidate, and either records it or searches again.

The distinction that matters

A loop needs budgets and stop conditions; repeated activity is not necessarily progress.

Related terms

Where it is taught

Prompts, skills, workflows, and agents

Source and further reading

Anthropic · Building effective agents

The definition and example are written for this library. The link gives background, official documentation or legal authority as labelled. Legal scope depends on the jurisdiction and current text; product features depend on release and settings.

Lessons, terms, practical guides and sources ESC