AI coding glossary
Agent Loop
Also known as: react loop, reason-act-observe loop, tool-use loop
In one sentence
The core iteration cycle of an AI agent: think → call a tool → observe the result → think again, repeating until the task is done or a halt condition fires.
Full definition
The agent loop is the runtime that drives any AI coding agent. The canonical form is ReAct (Reason + Act + Observe): the model produces a thought, then a tool call, runs the tool, feeds the observation back as the next turn, and repeats. Modern variants add reflection (a critique step), planning (decompose at the top), and parallelism (fan-out subagents). The halt conditions: task complete (model says so), step limit hit (default ~50), token budget exhausted, or a guardrail triggered. Claude Code's loop adds explicit sub-agent spawning; Cline's loop pauses for per-step approval; Aider's loop commits per turn. Every agent has a loop; the differentiator is the orchestration layer above it.