n. / Agents and tools
Definition
The agent loop is the repeating cycle in which an agent calls the model, runs any tools it requests, adds the results to the context, and calls the model again until it produces a final answer or hits a limit.
In more detail
Every pass adds tokens and time, and a loop with no stopping rule can run until it hits a budget. Good agents have a maximum number of steps, a spend limit and a way to notice repeated identical calls. In a trace, one pass of the loop appears as a model span followed by its tool spans.
Example
Pass 1: the model asks to search. Pass 2: it reads a result. Pass 3: it writes the answer. The trace shows three model spans and two tool spans under one run.
Related terms
