BlogAI agents

What an AI agent really costs to build and run

There is no honest single price for an AI agent. The cost has three parts: building it (mostly integration, evaluation and hardening, not prompts), running it (tokens per task multiplied by volume, plus tools, infrastructure, monitoring and human review) and maintaining it as models, data and edge cases change. You can estimate the run cost of one task with ten minutes of arithmetic, and this article shows how.

Why there is no single price

Any figure quoted for “an agent” hides the three variables that move the answer most: how many systems the agent touches, how costly a wrong action is, and how many tasks it runs. An agent that answers questions from one document store for twenty staff, and an agent that issues refunds across a billing system, a CRM and a payment provider, are different projects that share a name.

So we do not publish a number, and we are wary of anyone who offers one before asking those three questions. What we can give you is the structure: where the effort goes, what drives each line, and how to work out the part that is plain arithmetic.

What it costs to build, phase by phase

Phase What happens What drives the effort
Discovery Map the process, fix the task boundary, collect real examples, define a correct outcome. How well the process is documented, and access to the people who do the work.
Integration Give the agent its tools: APIs, databases, document stores, sometimes a browser. Authentication, permissions, error handling. The number of systems, the quality of their APIs, security review.
Evals Build a test set from real cases, write graders, run the agent against it on every change. How subjective a good outcome is, and whether domain experts have time to label cases.
Hardening Guardrails, approval steps, retries, rate limits, fallbacks, logging, cost caps, staged rollout. The risk of the actions, compliance requirements, volume.

In the builds we run, integration and hardening together take more effort than everything people picture when they think of building an agent. The prompt and the control loop are written in days. Getting clean, permissioned access to a legacy billing system can take weeks, much of it spent waiting.

Two opinions. First, do not thin out the evals to save build cost. The test set is the one asset that outlives every model and framework choice, and without it each later change is a guess. Second, discovery is cheap and skipping it is expensive. A week spent learning that the task boundary is wrong costs far less than a build that proves it.

What it costs to run

Tokens per task and what drives them

Model providers charge per token, with separate prices for input and output. On the three price lists we checked for this article (Anthropic, OpenAI and Google), output tokens cost five to six times as much as input tokens on the same model, and the gap between a provider’s largest and smallest model is far wider than that.

What makes an agent different from a single chat reply is that one task is many model calls, and each call sends again what came before. Four things drive the total.

  • The fixed prefix. The system prompt and the tool definitions go out on every call. Ten tools with long descriptions can be several thousand tokens before the task has started.
  • The number of steps. Each tool call means another model call, and the history grows with every one. Doubling the steps more than doubles the input tokens.
  • The size of tool results. A tool that returns a whole customer record when the agent needed one field is paid for again on every later step.
  • Reasoning and output. Models that reason before answering bill that reasoning as output. Google’s price list says in terms that its output prices include thinking tokens. A higher reasoning setting is a cost setting too.

Two levers cut the bill without changing behaviour. Cached input, where the provider recognises a prompt prefix it has seen recently, is listed at a tenth of the normal input price or less. Batch processing, for work that can wait, is listed at about half price on all three. Our guide to cutting LLM costs goes through these and the rest.

One trap: the same text is a different number of tokens on different models. Anthropic’s token counting documentation notes that its recent models produce roughly 30 per cent more tokens for the same input than older ones. Count with the model you intend to use.

Tool calls

Your own APIs cost what they cost to run. Provider-hosted tools are billed on top of tokens: web search, for example, is listed at 10 US dollars per thousand searches by both Anthropic and OpenAI as we write. Third-party services the agent calls, such as document parsing, telephony or data lookups, have meters of their own. List every tool with its unit price.

Retries and failed runs

A run that fails at step six has paid for six steps. Timeouts, rate limits, malformed tool results and the occasional loop all spend tokens and produce nothing. Set a step cap and a spend cap per task, and put a retry allowance in the estimate. Then measure the real rate, which is also one of the better signs of how healthy the agent is.

Infrastructure and observability

Orchestration, queues, a database, perhaps a vector store, sandboxes for code or browsers. For an agent that calls hosted models this is usually a modest line. It becomes a large one only if you host models yourself and pay for GPUs whether or not they are busy, which is a decision to make with whoever owns your cloud and LLMOps budget.

Observability is not optional and not free. Every run has to be traced and kept where you can search it, or you cannot debug a failure or defend a decision. Add the cost of running the eval set, which spends tokens on every release, and spends them twice if a model grades the results.

Human review time

This is the line most estimates leave out, and for most business agents it is the largest. Someone reviews a share of the outputs, handles the escalations and investigates the failures. The sum is the share of tasks reviewed, times the minutes per review, times what that person’s time costs you. Start with a high review share and bring it down on purpose as evidence accumulates.

How do you estimate token cost per task?

Here is a worked example with illustrative numbers. A subscription software company wants an agent for billing queries: look up the account, read the invoice history, check the refund policy, then act or escalate.

Read a few real transcripts and write down assumptions:

  • 7 model calls per task: 6 tool calls, then the final reply.
  • A fixed prefix of 6,000 tokens (system prompt and tool definitions).
  • A customer message of 1,000 tokens.
  • Each step adds 1,800 tokens to the history: a 1,500-token tool result and 300 tokens of the model’s own output.
  • Output of 300 tokens per intermediate step and 500 for the final reply.
Input tokens
  call 1:  6,000 + 1,000                        =  7,000
  call 2:  7,000 + 1,800                        =  8,800
  ...
  call 7:  7,000 + 6 x 1,800                    = 17,800
  total:   7 x 7,000 + 1,800 x (0+1+2+3+4+5+6)  = 86,800

Output tokens
  6 x 300 + 500                                 =  2,300

Cost at illustrative prices
($2.00 per million input tokens, $10.00 per million output tokens)
  input:   86,800 x 2.00 / 1,000,000            = $0.174
  output:   2,300 x 10.00 / 1,000,000           = $0.023
  per task                                      = $0.197

With the 6,000-token prefix read from cache on calls 2 to 7
(illustrative cached price: $0.20 per million tokens)
  saving:  36,000 x (2.00 - 0.20) / 1,000,000   = $0.065
  per task                                      = about $0.13

The prices are round numbers chosen for easy arithmetic. They are not a quote and they will be out of date when you read this, so take the current figures from the provider’s pricing page and redo the sum. We have also left out the small premium some providers charge to write to the cache.

Three things in that arithmetic hold whatever the prices are.

  1. Input dominates. 86,800 input tokens against 2,300 output. In an agent the cost is in what you send again, so trimming the prefix and the tool results is worth more than shortening replies.
  2. Steps are worse than linear. Run the same task in 15 calls and the input becomes 15 x 7,000 + 1,800 x 105 = 294,000 tokens. About twice the steps, 3.4 times the input.
  3. Model choice multiplies everything. A model priced five times higher makes the answer five times higher. Keep the expensive model for the steps that need it.

Now scale it. At 4,000 tasks a month and $0.20 a task, the model bill is $800, or $920 with a 15 per cent allowance for retries. Compare that with review. If staff check one task in five and spend three minutes on each, that is 4,000 x 0.2 x 3 = 2,400 minutes, or 40 hours a month. Price those 40 hours at your own staff cost and put the two figures side by side. For many teams the second is the larger.

What does maintenance cost?

An agent is not finished at launch. Four kinds of work continue for as long as it runs.

Model changes. Providers retire models on a schedule. Anthropic’s deprecations page commits to at least 60 days’ notice before a publicly released model is retired, and OpenAI’s deprecations page states at least six months for generally available models and far less for previews. You will migrate. Each migration means running the eval set again, fixing the prompts that regress and re-checking the cost model.

Drift. The world the agent works in changes: a new product line, a revised refund policy, a field renamed in an upstream API. None of these throws an error. Quality slips, and you find out only if you sample production runs against the same criteria as your evals.

New edge cases. Every week of production brings inputs nobody imagined. Each becomes a test case and some need a fix. This is steady work, not a phase.

Knowledge upkeep. If the agent answers from documents or policies, someone has to keep them current and remove what is superseded.

We would budget for a named owner with real hours every month, not for attention when someone has time. An agent nobody owns gets worse without anyone noticing.

Where does the money get wasted?

The same few places, in most of the systems we are asked to review:

  • The largest model on every step, when a smaller one would handle the routine calls.
  • Tool definitions the agent never uses, sent on every call.
  • Tool results returned whole when a few fields would do.
  • No cap on steps, so a task stuck in a loop keeps spending until something else stops it.
  • Reviewing every output for ever, where sampling by risk would do once the numbers justify it.
  • Building all ten integrations before two of them have proved the case.

How to start: a one-page cost model

In the first week, collect nine numbers.

  1. Tasks per month, now and in a year.
  2. Model calls per task. Read ten real cases and count the lookups a person makes.
  3. Tokens in the fixed prefix, in a typical input and in each tool result.
  4. Current input, cached-input and output prices for two candidate models.
  5. Per-call charges for hosted tools and third-party services.
  6. A retry allowance, to be replaced by the measured rate.
  7. The share of tasks reviewed, minutes per review and the cost of that time.
  8. Owner hours per month, and the effort of one model migration.
  9. What the task costs today, done by people.

Put them in a spreadsheet and treat every figure as an assumption waiting to be replaced by a measurement. A short proof of concept on real data is the cheapest way to get those measurements: log the tokens and steps of every run and the model fills itself in. If the per-task figure comes out above what the task costs today, the first decision is to narrow the task, not to haggle over the price. Scoping and costing agents this way is part of our AI agents work.

Questions

Asked often.

How much does it cost to build an AI agent?

It depends on how many systems the agent must work with, how risky its actions are and how much evaluation the task needs. The model work is the small part. Most of the effort goes on integration, building the test set, and hardening for failures, permissions and monitoring, so scope those before asking anyone for a price.

How do I estimate the token cost of one agent task?

Count the model calls in a typical task. For each call, add the fixed prompt and tool definitions, the task input and every earlier tool result, because all of it is sent again each time. Multiply the input and output totals by your model's current prices, add an allowance for retries, then replace the estimate with measurements.

What is the biggest running cost of an AI agent?

For most business agents it is people, not tokens: the time staff spend reviewing outputs, handling escalations and investigating failures. Token spend becomes the largest line only at high volume, or with long multi-step tasks on expensive models. Budget review time explicitly and plan to reduce it as measured quality improves.

Why do agent costs go up after launch?

Usage grows, tasks get longer as tools are added, and prompts collect extra instructions. Providers also retire models, which forces a migration and a full re-test, and a new model can count tokens differently. Without a budget per task and a regular cost review, spend drifts upwards without anyone deciding that it should.

Not on the list? Ask us directly

Keep reading

More notes from the build.

All blogs

Let’s build your stack.

Send a brief and we’ll reply with next steps.