← All posts

What an AI agent costs to run: tokens, caching and failed runs

The running cost of an AI agent is the tokens each task consumes, times the model's price, times the number of tasks, plus the retries, the failures and the minutes a person spends reviewing. Agents use far more tokens than a chat reply, because every step resends the whole conversation and the tool results. On my own benchmark of thirty real tasks on a low-cost model, one task execution cost between USD 0.009 and 0.013 in tokens. Prompt caching can cut an agent loop's bill by a factor of 2.5 to 3.7, and Greek text roughly doubles the input side. In most businesses the tokens turn out to be the small line. The expensive ones are failed runs and human review.

What goes into the running cost of an AI agent?

Six things go into the running cost of an AI agent, and only the first two appear on the model provider's invoice:

  • Input tokens: the system instructions, the tool descriptions, the conversation so far and any retrieved documents, sent again at every step.
  • Output tokens: the model's replies and tool calls, including its internal reasoning, which is billed as output. On current Claude and OpenAI models, output costs about five times the input price.
  • Retries: a failed tool call or a timeout that is tried again bills its tokens again.
  • Failures: a task that ends wrong still bills everything it used, then costs the time to find and fix the mistake.
  • Infrastructure: hosting, logs, the database and any paid APIs the tools call.
  • Human review: the minutes a person spends approving drafts, which is often the largest cost of all in the first months.

Anthropic's engineers report that agents typically use about four times the tokens of a chat interaction, and multi-agent systems about fifteen times (Anthropic, multi-agent research system).

What does one agent task cost in practice?

One agent task can cost about a cent in tokens on a low-cost model, and several times that on a flagship. I measured seven versions of one production agent on the same thirty tasks, 270 task executions in all, and published every result in What an agent actually costs. At the model's uncached prices of USD 0.435 per million input tokens and 0.87 per million output, the cost per task execution ranged from USD 0.00920 to 0.01309 across versions. A thousand such tasks cost about ten to thirteen dollars.

Two caveats keep that number honest. These were well-defined tasks on a machine, not long research jobs, and they ran on a cheap model. A flagship model can cost ten times more per token, and longer tasks multiply the tokens. The method transfers even when the number does not: measure your own tasks, then multiply.

Why should you price an agent per finished task, not per token?

You should price an agent per finished task because a cheap model that fails still bills its tokens, then the retry, then the cost of the mistake. A more expensive model that finishes in fewer steps and fails less can be cheaper per result. Anthropic published an example on a software engineering benchmark in which a model with a five times higher token price was both more accurate and cheaper per solved task, 88.6% at USD 0.54 against 77.4% at USD 0.84. That is a vendor's own measurement on its own models, so treat it as an illustration of the principle rather than a buying guide, and measure on your own tasks.

How much does prompt caching save on an agent?

Prompt caching saves the most of any single measure on an agent, because an agent resends the same long beginning, the instructions and tool descriptions, at every step. Providers charge a fraction of the normal input price for the part of a prompt they have seen recently. Anthropic's own runs measured agent-loop costs falling by a factor of 2.5 to 3.7 at cache hit rates of 81 to 90% (Anthropic, prompt caching). Three rules make it work: put what never changes first and what changes last, never put a timestamp or a request number at the top of the prompt, and check the cache fields in the provider's usage data after every change, because a broken cache fails silently and only the bill moves.

What else cuts the cost of an AI agent?

Several other measures cut the cost of an AI agent, in roughly this order of effort:

  1. Batch processing for anything that does not need an answer within the hour: both OpenAI and Anthropic price batch jobs at half the normal rate (OpenAI Batch API).
  2. Fewer tools per call. Every tool description rides along on every step. In one of my own agents, sending only the 18 tools a simple request needs instead of all 31 saves about 4,300 tokens per call, a technique covered in MCP explained.
  3. Shorter outputs, by asking for structure instead of prose where a program reads the result.
  4. Lower reasoning effort before a smaller model. A lower effort setting on the same model keeps the same cache and the same behaviour, while a switch to another model starts cold.
  5. Hard budgets per task, so a loop that goes wrong stops at a known cost instead of running all night.

Why did two of seven agent versions get worse?

Two of my seven agent versions got worse because every change to an agent is an experiment, and some experiments fail. Across six version transitions, two lowered the score, and one of them was caught and fixed within twenty minutes only because every version ran the same benchmark. The record also held a trap: halfway through, the benchmark started running each task three times instead of once, so the last version looked 3.3 times more expensive than the one before when it actually cost 10% more per execution. The lesson for a business is simple. Budget for iteration, keep a fixed test set, and compare cost per execution, never totals from runs that were measured differently.

How do you estimate an agent's cost before building it?

You estimate an agent's cost before building it by running a small prototype on real cases and multiplying:

  1. Run twenty real tasks through a prototype and log the input and output tokens of each.
  2. Multiply by the model's prices and by the monthly volume.
  3. Add 20 to 30% for retries and for the tasks that take longer than average.
  4. If the content is Greek, count the tokens on Greek text: on current models Greek needs about twice the tokens of English, as measured in Greek in AI models.
  5. Add the review minutes per task times the hourly cost of the person reviewing, and watch that line fall as the agent earns autonomy.

The written blueprint I deliver before any build prices exactly these lines, for AI agents for business that run in production.

Frequently asked questions

How much does an AI agent cost per month to run?

It depends on volume and model. As an order of magnitude, 3,000 short tasks a month at about one cent each is around thirty dollars in tokens on a low-cost model, and a few hundred on a flagship. Build, hosting and human review usually cost more than the tokens.

Is a cheaper model always cheaper?

No. A cheaper model that fails more often costs more per finished task once retries, mistakes and review time are counted. Compare models on cost per correct result on your own tasks.

Does an agent cost more in Greek?

Yes, on the token side. Greek needs about twice the tokens of English on current OpenAI vocabularies for the same content, so the input cost of a Greek agent is roughly double the English estimate.

If you want a cost estimate built on your own tasks rather than a vendor's slide, send me twenty examples of the task and the monthly volume. What an agent is, and when one is worth building, is in agentic AI explained.