All glossary terms
Cross-cutting

Agent loop

An agent loop is the orchestration pattern where an LLM iteratively reasons, calls tools, observes results, and continues — until a terminal condition is met (task complete, max iterations reached, error). The loop is the foundation of any non-trivial AI agent: the LLM produces actions, the host executes them, and the result feeds back as context for the next iteration.

Agent loops vary in sophistication. The simplest is ReAct (Reason + Act): the model produces a thought, an action, and (after execution) observes the result before the next thought. More sophisticated patterns add planning (the model produces a full plan up-front), reflection (the model critiques its own progress), and hierarchical orchestration (a high-level agent delegates to specialist sub-agents). The engineering concerns are universal: max-iteration caps to prevent runaway, error handling on tool failures, observability into the trace, and cost controls. Production agent loops typically run 5-50 iterations per task; chains beyond that signal a problem in either the task or the agent design.

Related terms