Skip to content

Inference 101, lesson 17

Agents and the cost of many steps

An agent makes many trips to the model for one task, and every trip sends everything so far. This lesson shows where those tokens come from, and gives you a worksheet to price one finished task.

What do you run?

Every example below changes to fit what you pick. The businesses are made up for teaching.

The picture, one step at a time

Each box is one stage. The picture lights up as you scroll.

Step 1 of 7

A chat is one trip. An agent is many

An agent is a model working in a loop: it picks a tool, reads what comes back, decides the next move, and goes round again until the job is done. You asked once, but it made many trips to the model. Each trip is paid for.

Anthropic wrote on 13 June 2025 that "agents typically use about 4× more tokens than chat interactions", and its systems of several agents working together about 15 times more.

Step 2 of 7

Every turn sends it all again

The model keeps nothing between trips (lesson 3). So each turn sends the instructions, the list of tools it may use, and everything that has happened so far. Turn ten carries turns one to nine. That is why the tokens grow faster than the steps.

Anthropic's pricing page counts the tools you offer, with their names and descriptions, as input tokens on each request, plus a few hundred tokens of hidden set-up whenever tools are on (read 29 November 2026).

Step 3 of 7

Tool results pile up

When the agent looks something up, the result comes back as input. Then it stays in the conversation, so it is sent again on every later turn. One big result early on is paid for many times over.

Anthropic's pricing page says it of web search: results "count as input tokens, both while Claude keeps searching within a turn and in later conversation turns" (read 29 November 2026).

A lookup on step 2 returns 10,000 tokens. The task runs 10 steps. Roughly how many times are those tokens paid for?

Step 4 of 7

Thinking at every step

A thinking model plans before each move, in hidden tokens billed as output (lesson 4). In an agent that happens on every step. On some models the earlier thinking is also kept in the conversation and sent back in on later turns, so it is paid for again as input.

Anthropic's docs say its newer models "keep prior turns' thinking blocks in context and bill them as input" (read 29 November 2026).

Step 5 of 7

Retries and dead ends

Long jobs go wrong in the middle: a site times out, a test fails, a draft misses the brief. Each attempt again is another full trip with the whole context. And one early mistake can send every later step the wrong way.

In the same June 2025 post, Anthropic wrote that "Agents are stateful and errors compound", and described adding retry logic and regular checkpoints so a failure does not mean starting again.

Step 6 of 7

Work out the task price

Here is the worksheet, for answering customers, with made-up prices of £1 per million tokens in and £5 per million out. Say a task takes 10 steps. The prompt starts at 5,000 tokens and grows by 3,000 a step, so it averages 18,500 tokens: 185,000 tokens in, 18.5p. Each step writes 1,000 tokens, thinking included: 10,000 out, 5p. That is 23.5p a run. If one run in five has to be redone, the task costs about 28p. A single chat with the same start might cost under 1p.

Which number do you compare with what the finished task is worth to you?

Step 7 of 7

Keep it worth it

An agent earns its fare when the finished task is worth more than it costs. To bring the fare down, cut the steps before you change the model. Put the fixed start first so it can be cached. Ask tools for short answers, not whole files. Set a limit on steps. Send easy steps to a smaller model: Part 2 covers caching and routing.

Anthropic's 2025 post makes the same point for its own system of several agents: it needs tasks "where the value of the task is high enough" to pay for the extra tokens.

Which part of the agent bill is that?

Here are four things an agent does in your business. Sort each one into the part of the bill it adds to.

  1. 1The agent's instructions and its list of eight tools go in again on each of its six steps.

  2. 2To answer a question about one order, it pulls the customer's whole history of 40 orders.

  3. 3The output column is far bigger than the replies customers actually read.

  4. 4The courier's tracking site times out, and the agent tries the same lookup three more times.

0 of 4 right so far, 4 to go.

The agent cost worksheet

This is what you keep: five lines to fill in for any agent task, and the rule for when the fare is too high.

The agent cost worksheet

  1. Steps: how many trips a typical task takes. Count real runs, not the best one.
  2. Tokens in per step: the average prompt, which grows each turn as instructions, tools and results are sent again.
  3. Tokens out per step: the words it writes plus any hidden thinking, all billed as output.
  4. Price: tokens in and out times their prices, using the cached price for the fixed start.
  5. Runs per finished task: multiply by the average, then add tool fees and any person's time to check.

Price the finished task, then ask if it is worth that much. If not, cut the steps before you change the model.

Next: Lesson 18: where inference is heading. Four trends, dated and sourced, and what to watch in each.