A single chatbot reply is one model call. An agent is different: it plans, calls tools, reads the results, and decides what to do next, often across many steps. Each of those steps is a model call you pay for, and the cost grows faster than the number of steps suggests.
The hidden multiplier: resending context
At every step the model needs the instructions, the task, and everything that has happened so far, including previous tool results. That whole history is sent again as input tokens on the next call. So input grows with each step, and total input across a run grows much faster than the number of steps.
A worked example
The prices here are illustrative — substitute your provider's current rates. Assume input at $3 per million tokens and output at $15 per million. An agent starts with 2,000 tokens of instructions and task, and each step adds about 800 tokens of tool output to the context. It runs 10 steps and writes about 300 tokens of output per step.
- Input across the run: 2,000 + 2,800 + 3,600 + … up to 9,200 tokens on the last step, totalling 56,000 input tokens — nearly three times the 20,000 you'd get by assuming a flat 2,000 per step.
- Input cost: 56,000 × $3 ÷ 1,000,000 ≈ $0.168
- Output cost: 3,000 × $15 ÷ 1,000,000 = $0.045
- Total ≈ $0.21 per run, or about $210 for 1,000 runs
What else adds cost
Beyond the basic loop, spend rises when:
- The agent retries failed tool calls or goes down unproductive paths.
- Reasoning models produce long internal thinking that's billed as output.
- Several sub-agents run in parallel, each with its own context.
- Tool results are large and get pasted into context in full.
How to keep it under control
The most effective levers are about limiting how much context accumulates:
- Set a maximum number of steps so a stuck agent can't loop indefinitely.
- Summarise or trim old tool output instead of carrying all of it forward.
- Return only the fields a tool result needs, not the full response.
- Use prompt caching for the stable part of the prompt, where your provider supports it.
- Route simple steps to a smaller, cheaper model.
Budget with a range, not a number
Agent runs vary — some finish in three steps, others in twenty. It's safer to estimate an average and a worst case than to rely on one figure, and to log real token usage per run once you're in production.
Estimate your agent's cost
Our AI Agent Cost Calculator lets you set the number of steps, tokens per step, and run volume, so you can see how quickly cost scales before you commit to a design.