Skip to content
Back to Agents for everyone

Agents for everyone · Chapter 2 of 8

The loop: look, decide, act

Every agent runs the same loop: it looks at what it knows, decides the next step, acts, and looks again.

12 minutes0 of 3 goals done

Goals

  • Make three decisions as if you were the model.To do
  • Bring the agent to its goal.To do
  • Put the steps of one turn in order.To do

Step 1 of 4: The read

One loop, again and again

In chapter 1 you saw an agent work in steps. Each step follows the same loop of three parts.

Look: the agent gathers what it has so far, which is your request and the result of its last step. Decide: the model reads all of that and chooses the next step, or decides that the goal is reached. Act: the agent takes the step, usually by using a tool, and a result comes back. Then it looks again.

One pass through look, decide and act is called a turn. A small job can take three or four turns; a large one can take dozens.

Why it looks again

What a tool returns is new information. If a search shows that one plumber is away all month, the next decision can take that into account. This is how an agent changes course without being told: it reads the result before it chooses again.

When it stops

An agent stops for one of three reasons. The goal is reached. It needs you: it asks a question or asks for your approval, and waits. Or it hits a limit, such as a maximum number of turns.

How loops go wrong

A poor decision costs a turn. Booking before anyone has been found, for example, achieves nothing. Worse is a runaway loop: the agent repeats the same step, gets the same result, and repeats it again. Without a limit it could go on for ever, and every turn uses the model, which takes time and often costs money. That is why real agents count their turns and stop at a limit.

Your turn

Below, you play the model. The agent looks, then you decide, then the agent acts and shows you what came back. Try a poor choice or two, and see what they cost.

Step 2 of 4: Try it: You are the model

You are the model

You decide each step for the agent. Watch what each action returns, and see how a poor choice costs an extra turn.

Mode:SimulatedSimulated: you make the decisions a model would. No AI runs, and no one is booked.

Step 3 of 4: Check

Check

Put the parts of one turn of the loop in order.

Drag the items, or use the arrow buttons, to put them in order.

  1. Position 1: Use a tool to take that step.
  2. Position 2: Read the request and the result of the last step.
  3. Position 3: Read what the tool returned.
  4. Position 4: Decide the next step, or decide the goal is reached.

Step 4 of 4: What you can do now

What you can do now

  • Describe the loop every agent runs: look, decide, act.
  • Name three reasons an agent stops: goal reached, it needs you, or a limit.
  • Explain why agents need a limit on how many steps they take.