Agent loop
Also known as: perceive-act loop · run loop
The agent loop is the cycle at the heart of every agent:
- Perceive — read the task and latest observations.
- Decide — the model picks the next step (an answer or a tool call).
- Act — the harness executes the step.
- Observe — the result comes back in.
- Repeat until the task is done or a stop condition hits.
Why it matters: a chatbot answers once and stops. An agent *keeps going* — the loop is what lets it recover from a failed tool call or dig deeper. It's also where cost and runaway risk come from.