The agent loop
Plan, act with a tool, observe the result, and repeat until the goal is met.
Read first: Tool use & protocols (MCP).
D1 · StoryFor young children and total beginners
Think of a robot tidying a room: look around, pick one thing up, check where it goes, then look again. It keeps going until the room is tidy.
An AI agent works the same way, using computer tools instead of hands.
Like: A robot tidying a room, one item at a time.
D2 · PictureFor curious beginners
The agent receives a goal. The model reasons about the next step and requests a tool call.
The harness runs the tool, with permission checks, and feeds the result back into the context.
The loop repeats until the model decides the task is done, a limit is reached, or a person steps in.
The agent loop
- Goal: from the user
- Think: choose next step
- Act: call a tool
- Observe: read the result
- Done?: stop or continue
Like: A robot tidying a room.
Where it breaks: A tidying robot can see the whole room. An agent only sees what's in its context, so long tasks need summaries and memory, and details can get lost.
D3 · PlayFor motivated learners
An agent task is a chain of steps: read a file, call a tool, edit, run a test. The whole task only succeeds if every step does.
If each step succeeds with chance p, and steps fail independently, a task of n steps finishes with chance p to the power n. Small per-step errors compound fast.
A check and retry step helps: a test or a second look catches some failures, and the agent gets one more try. Turn it on and watch the curve lift.
Try the interactive version in the map.
Things to try
- Leave each step at 95% and set 20 steps. How often does the whole task finish?
- Set 50 steps. How good must each step be for the task to finish at least half the time?
- Turn on check and retry at 80%. How much does it lift 20 steps? Now drop the catch rate to 0%.
D5 · FrontierFor experts
Open problems: reliability over long tasks, knowing when to stop or ask for help, evaluating agents on realistic work, and containing agents that read untrusted content.