Module 5 · Lesson 2 of 6 · Emerging

A model in a loop

Think, act, read, repeat

An agent loops: it decides a step, calls a tool, reads the result, and repeats until it can answer.

Scene 1 of 5 · Think first

The agent starts by deciding its plan: find a restaurant with a table for 4 on Friday.

Agent (model)Agent (model)decidingToolsToolsYouYou
  • Agent (model) — healthy — deciding
  • Tools — healthy
  • You — healthy
"Book a table for 4 on Friday"
StepWhat happened
1. Think (highlighted)Plan: find a restaurant with a table for 4 on Friday.
Steps
not shown yet
Tool calls
not shown yet
  1. Think first. The agent starts by deciding its plan: find a restaurant with a table for 4 on Friday.
  2. Call a tool. It asks for the search tool; the result comes back as new text for it to read.
  3. Read, then repeat. Reading that result, it picks the closest place and checks it with a second tool.
  4. Ask, book, answer. It asks you to confirm, books with a third tool, and ends the loop with its answer.
  5. Slower than one answer. That took 7 steps and 3 tool calls, where a plain answer is a single model call.
  6. Now you try. Tap the moves in the order the agent loop makes them; a round can repeat. For example, tapping Call a tool, Think about the next step, Read the result and Answer the user gives this: Not quite. Each round goes think, call a tool, read the result. The model decides each step from what the last tool returned, so it must read before it thinks again.

Scene 1 of 5: Think first. The agent starts by deciding its plan: find a restaurant with a table for 4 on Friday.

Key points

  1. Each round starts with the model deciding what to do next.
  2. The result of one tool call shapes the next step.
  3. Every round is another model call, so agents are slower and cost more.
  4. If the steps never change, a fixed workflow does the job for less.

An is a model that can call tools, such as a search or a booking system. It decides what to do next from the results.

It works in a loop: think about the next step, call a tool, read the result, and repeat until it can answer.

Each turn of the loop is another model call, so an agent is slower and costs more than a single answer.

Example. Asked to book a table, an agent searches for restaurants, checks one for a free table, asks you to confirm, and then books it.

In system design: Use an agent only when the steps depend on each other; when the steps are known in advance, a fixed workflow is cheaper.

Check yourself

Why does an agent cost more than a single answer?