A tidy desk with a calculator, an open notebook, a pencil and a small plant

How Much Does It Cost to Build and Run an AI Agent?

One sum, last month's volume and the official pricing pages tell you what an AI workflow will cost to run, and which design choices keep it low.

By Willy Candra
•December 1, 2026
•8 min read
#ai-engineering#ai-for-business#AI costs#AI agents#model pricing#workflow automation

Most owners I talk to can tell me roughly what an AI project will cost to build. Far fewer know what it will cost to run each month once it is live. That second number decides whether the project keeps paying for itself, and the good news is that you can estimate what it costs to build and run an AI agent before anything is built, with one sum and last month's numbers.

This post walks through that sum in plain English, shows how the same workflow can cost a few dollars or over a hundred dollars a month depending on how it is designed, and ends with a section for engineers on how to keep the number low in production.

First, the build cost. It is mostly hours: mapping how the task is done today, building the workflow and its checks, testing it on past cases, and connecting it to your inbox, accounting software or booking system. A single step that reads one kind of document and drafts an entry for approval is a much smaller build than a multi-step agent that looks things up in several systems, because every extra step needs its own checks, error handling and tests. Ask any builder to quote the build and the monthly running cost separately, so you can weigh both against what the task costs you now.

What you are actually paying for

AI models from OpenAI, Anthropic (Claude) and Google (Gemini) are billed by the token. A token is a small piece of text, roughly three quarters of an English word. You pay for the tokens you send in (the instructions, the document, the customer message) and, at a higher rate, for the tokens the model writes back.

Prices are listed per million tokens on each provider's official pricing page. As of early November 2026, for example:

  • Anthropic lists Claude Sonnet 5.5 at $2 per million input tokens and $10 per million output tokens, and Claude Haiku 5.5 at $0.10 input and $0.50 output for prompts up to 100,000 tokens.
  • OpenAI lists gpt-6-luna, its small GPT-6 model, at $0.10 input and $0.50 output.
  • Google lists Gemini 3.5 Flash-Lite at $0.30 input and $2.50 output.

These change often, and sometimes on announced dates: Google's page already shows some Gemini prices rising from 1 December 2026 and 1 January 2027. Always check the current page before you budget. The point here is not the exact figure but the gap: a capable mid-sized model can cost around twenty times more per token than a small one.

The one sum behind what it costs to build and run an AI agent

For one workflow, the monthly model cost is:

cases per month × tokens per case × price per token, plus an allowance for retries and testing.

A "case" is one unit of work: one supplier invoice read, one customer message answered, one daily report written. Here is an illustrative example with round numbers, not a real client figure.

Illustrative example: reading supplier invoices

Say a business receives 2,000 supplier invoices a month and wants AI to read each one and draft the accounting entry for a person to approve. Each invoice plus the instructions comes to about 3,000 input tokens, and the drafted entry is about 500 output tokens.

  • Input: 2,000 × 3,000 = 6 million tokens. At $2 per million, that is $12.
  • Output: 2,000 × 500 = 1 million tokens. At $10 per million, that is $10.
  • Total on Claude Sonnet 5.5: about $22 a month.

Run the same single step on Claude Haiku 5.5 and it comes to about $1.10 a month. Either way, the model bill is small next to the hours of typing it replaces. That is the usual picture for a simple, well-designed workflow.

Why agents cost more than single calls

An AI agent is a workflow where the model takes several steps on its own: look up the supplier, check the purchase order, compare totals, then write the entry. Each step is a separate call, and each call usually re-sends the context gathered so far.

Keep the same 2,000 invoices but make it a five-step agent where each step sends about 4,000 tokens and writes about 500. Per invoice that is 20,000 input and 2,500 output tokens. On Sonnet 5.5 the month becomes roughly $80 for input plus $50 for output: about $130, six times the single-call version. Nothing is wrong with that, as long as the extra steps earn their keep. Often they do not, and a single well-prepared call does the job.

The extras people forget

  • Retries. Calls occasionally fail or return something that does not pass a check and are run again. Allow 10 to 20 percent on top.
  • Testing and evaluation. Every time you change the instructions you should re-run a set of past cases to confirm nothing got worse. That is real token spend, though small.
  • AI graders. Some workflows use a second model to check the first one's output. That roughly adds another call per case.

Three design choices that change the bill

The same business task can be built cheaply or expensively. Three decisions matter most.

  1. Use a small model for simple steps. Sorting a message into one of five categories or pulling a date out of a document rarely needs the most capable model. Reserve the larger one for the steps that need judgement.
  2. Reuse what does not change. Most providers offer prompt caching: if the start of every request is identical (your instructions, your chart of accounts, your price list), the repeated part is billed at a fraction of the normal rate. Anthropic lists cached reads for Sonnet 5.5 at $0.10 per million tokens instead of $2.
  3. Batch what is not urgent. If a job can wait a few hours, such as overnight report writing, batch processing is cheaper. Anthropic's pricing page says "Save 50% with batch processing", and Google's lists its Batch API at a 50% cost reduction.

Speed follows the same pattern. Small models usually answer faster, and fewer steps mean less waiting. For a customer reply that matters; for a nightly report it does not.

What to do this week

Pick one task you are considering for AI and do this in about 30 minutes:

  1. Count last month's volume. How many invoices, messages, bookings or reports? Your accounting software, inbox or WhatsApp export will tell you.
  2. Take three typical examples and paste them into a word counter. Multiply the word count by about 1.3 to get tokens, and add 1,000 for instructions.
  3. Estimate the output length the same way.
  4. Run the sum with one mid-sized and one small model from the official pricing pages, then add 20 percent.
  5. Put that next to what the task costs you now in staff hours, using the method in my post on calculating AI ROI.

You can do this estimate alone. Where it becomes builder work is deciding the steps: which parts need a model at all, which can be plain rules, and where a person approves. Many good workflows use AI only for the messy reading step and ordinary automation, for example in n8n, for everything else.

Under the hood: keeping running costs predictable in production

This section is for engineers and technical leads. It describes the approach I use, not results from a specific deployment.

Log cost per case from day one

Every model response returns token usage. Store input tokens, cached tokens, output tokens, model name and a case ID for every call, in the same database as the business records. A simple table in PostgreSQL is enough. From that you can report cost per case, cost per workflow and cost per customer, and spot a prompt change that quietly doubled the bill before the invoice arrives.

Route by difficulty

Put a cheap classification step first. Easy, well-formed cases go to a small model or straight to deterministic code; ambiguous or high-value cases go to a larger model. Validate every output against a schema (required fields, totals that add up, dates in range). A case that fails validation escalates to the larger model once, then to a human, rather than retrying in a loop.

Structure prompts for caching

Put stable content first and variable content last: system instructions, then reference data such as the chart of accounts, then the specific document. Caching works on identical prefixes, so a timestamp or customer name near the top breaks it for every request. Note cache lifetimes and write costs; Anthropic's listed cache prices reflect a five-minute lifetime, so caching pays when requests are frequent.

Control context growth in agents

Agent costs grow because each step carries the history of every previous step. Pass each step only what it needs, summarise tool results instead of forwarding raw output, and set a hard limit on steps and tokens per case. If a case hits the limit, stop and hand it to a person with what was gathered so far.

Choose models on your own data

Run a fixed set of past cases with known answers through two or three candidate models and record accuracy, cost per case and response time side by side. The cheapest model that meets your accuracy bar is the right one, and the same test set tells you when a new model or a price change is worth switching for. My own Flowstate AI runs on the Gemini API, and model choice there is a trade-off between reasoning quality and response time, the same trade-off most business workflows face.

Set a budget alarm

Set spending limits in each provider's console and add your own daily check against the cost log. A runaway loop should page someone within hours, not show up at month end.

Done this way, the monthly AI bill becomes one more line you can predict and plan for, much like hosting. For more on fitting AI into daily operations rather than bolting it on, see my post on AI adoption for small business.

If you would like help estimating the running cost of a workflow you are considering, or designing it so the number stays low, feel free to get in touch at willycandra.dev/ContactMe.

Share this article:

Need a website that brings results?

Let's talk about building a site that works for your business.

Contact Me →
How Much Does It Cost to Build and Run an AI Agent? | Willy Candra - Web Developer & SEO Expert | Willy Candra