AI 101

Agent loop

Also known as: perceive-act loop · run loop

Agents

The agent loop is the cycle at the heart of every agent:

  1. Perceive — read the task and latest observations.
  2. Decide — the model picks the next step (an answer or a tool call).
  3. Act — the harness executes the step.
  4. Observe — the result comes back in.
  5. 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.