Back to the index
28/ 55

AGENTS & TOOLS

Loop.

Agent loop · feedback loop · loop engineering

A repeated cycle in which an AI system acts, observes the result, and decides what to do next.

In plain words

A loop repeats a process until a stopping condition is met. An agent loop commonly alternates between a model deciding on an action, software executing it, and the model receiving the result.

A closer look

The important ingredient is feedback. A failed search can trigger a better query; a test failure can trigger a code revision. The harness carries state between iterations and determines which actions are available. Loop engineering focuses on making these cycles productive through checks, retries, useful feedback, and clear exit conditions.

An agent loop is different from a training loop, which updates parameters from a learning signal. Most tool-using agent loops perform repeated inference with unchanged model weights. “Human in the loop” means a person participates at one or more points, for example to review a consequential action.

ObserveDecideActCheck
Repeat with feedback, or stop when the exit condition is met.

In practice

AN EXAMPLE

A coding agent edits a function, runs tests, reads the failure, revises the function, and tests again. It stops when the required checks pass or a defined limit or blocker is reached.

A useful distinction

Repeating a prompt does not guarantee improvement. Without new evidence, a useful evaluation signal, or a stopping rule, a loop can repeat the same mistake while consuming time and resources.

Sources & further reading

LangGraph — Create and control loops (opens in a new tab)Towards Agentic Cloud Engineering: Graph and Loop Engineering (opens in a new tab)