Agents and AutomationLesson 7 of 72

Contents

Agents and Automation

Lesson 7 of 72. Sign in to keep your place.

Module 1 · Before you build: script, workflow, or agent

What one run costs, and what it is worth

9 min read

The same agent, priced by chain length5 steps1910 steps60.515 steps124.520 steps211thousand input tokens per runA 2,000-token prefix, 900 tokens added per step. Only the number of steps changes. Ten steps to twentymore than triples the input, because every step re-sends everything before it.
A 2,000-token prefix, 900 tokens added per step. Only the number of steps changes. Ten steps to twenty more than triples the input, because every step re-sends everything before it.

Figure

Put a number on it before you build it

You have already seen why an agent’s context grows: every step re-sends the whole transcript. Here we turn that into money, because “it is only a few cents” and “it is four thousand dollars a month” are the same sentence at different volumes.

Take a modest agent. Assumptions, stated openly so you can substitute your own:

  • system prompt plus tool definitions: 2,000 tokens, sent every step
  • each step adds roughly 700 tokens of tool result and 200 tokens of model text
  • the run takes 10 steps

Step n therefore sends about 2,000 + 900 × (n − 1) tokens. Across ten steps:

  • fixed part: 10 × 2,000 = 20,000
  • growing part: 900 × (0 + 1 + … + 9) = 900 × 45 = 40,500
  • total input: about 60,500 tokens, plus maybe 2,000 tokens of output

At illustrative prices of $3 per million input tokens and $15 per million output tokens, that is $0.18 + $0.03, about 21 cents a run.

Twenty-one cents feels free. Ten thousand runs a month is $2,100, which is a person’s salary in much of the world. Both numbers are true; only the second one gets you asked about it in a meeting.

Two levers that actually move the number

Cut steps. The growing part scales with the square of the step count, so it is the first thing to attack. The same agent at five steps: 5 × 2,000 + 900 × 10 = 19,000 tokens, under a third of the cost. Removing five steps beats any amount of prompt tuning.

Cache the prefix. Providers let you mark a stable prefix (system prompt and tool definitions) as cacheable. Cached reads typically cost around a tenth of normal input tokens; writing the cache costs slightly more than normal. In our example that turns the 20,000 fixed tokens into roughly 2,000 chargeable ones.

The catch is exact and worth memorising: the cached prefix must be byte-identical. Put a timestamp, a session id or a shuffled tool list at the top of your system prompt and the cache never hits, silently, forever. Nothing errors. Your bill is several times what you expected. Sort your tool definitions, freeze the wording, and put anything that varies after the cached block.

Latency is a budget too

Each step is a network round trip: model call, tool call, model call. Three to eight seconds per step is normal. Ten steps is a minute or more.

Nobody waits a minute at a text box. So a ten-step agent is a background job with a notification, not a chat feature, and if you need it to feel interactive, the answer is again fewer steps, not a faster model.

What it replaces

Finish the sum on the other side. If the task takes a person four minutes and you value that at ₹300 an hour, the human cost is ₹20. If your run costs ₹18, gets it right 80% of the time, and a person checks every output anyway, you have added a step and saved nothing.

Automation pays when it removes the human minutes entirely, or when it makes something possible that was not: every invoice checked instead of a sample.

Measure, do not estimate

Every provider returns token usage in the response. Write one row per run from day one: run id, steps, input tokens, output tokens, cached tokens, wall-clock seconds, outcome. That is a CSV, or a small table, and it takes twenty minutes.

Without it you will argue about cost from memory. With it you can point at the one step that doubled last Tuesday.

Every lesson here is open. Your progress is recorded once you pass the Context Engineering exam.

Check your understanding

An agent averages 12 steps at about $0.30 a run. A team proposes two changes: (a) enable prompt caching on the 3,000-token system prompt and tool block, or (b) restructure so the same work takes 6 steps. Which is likely to cut cost more, and why?

Pick the one you would defend. Your answer stays private.

Next lesson · 8 minBuy it, build it, or wait for it

Stuck on something?Ask Mai, your AI tutor

How to cite: Addaly (2026) ‘What one run costs, and what it is worth’, in Agents and Automation. Edited by M. Mun. Addaly. Available at: https://addaly.com/learn/agents-and-automation/unit-economics-of-a-run (Accessed: 13 October 2026).