Back to articles

Why AI agents get expensive (and how to fix it)

Agentic tasks burn far more tokens than chat — mostly from re-sending context every call. Why the bill climbs.

  • Foundations
  • 5 min read

The first month is cheap. Then you start really building with agents, the bill arrives, and it's a shock. Agentic coding can cost an order of magnitude more than you'd expect from the same model in a chat window — and the reason isn't what most people assume.

It's not that the model is pricey per answer. It's the shape of agentic work. Understand where the money actually goes and the fixes are obvious. Here's the breakdown.

The sticker shock

A quick chat with a model costs cents. An agent grinding through a real task can cost dollars per session, and a heavy month runs into serious money. The gap surprises people because they're pricing the answer when they should be pricing the loop.

An agent doesn't make one call. It makes dozens or hundreds — read a file, plan, edit, run a test, react, repeat. Each step is a model call. That alone multiplies the cost. But the bigger driver is hiding inside each of those calls.

Where the tokens actually go (context re-sending)

Here's the part that surprises everyone: every call in the loop re-sends the entire conversation so far. The model is stateless between calls, so to "remember" step one at step fifty, step one gets sent again — and again, every step.

So by the time an agent is deep in a task, each call carries the whole history: the files it read, the output it saw, everything. The Stanford Digital Economy Lab's analysis of how agents spend tokens makes the pattern stark — the dominant cost isn't generating new output, it's repeatedly shipping the accumulated context. By turn fifty you can be sending 100K-200K tokens per call, mostly to re-establish what the agent already knew.

Stuart Leo

You're not paying for the agent's answers. You're paying, over and over, to remind it what it already saw.

Why bigger context costs twice

This is why the "just paste everything in" instinct is so expensive. A bloated context doesn't only cost more on the call you paste it — it costs more on every subsequent call, because it's re-sent each time. Dump a huge file into the window at step three and you pay for that file again at steps four through fifty.

And it costs you twice over, because — as anyone who's hit context rot knows — a fuller window also makes the model worse. So bloated context buys you a higher bill and a dumber agent. Lean context is cheaper and sharper at the same time.

Leaner context, lower bill

This is the good news: the main cost lever is something you control. Keep the working context lean and every call in the loop carries less, so the whole session costs less. That's compaction — digest what matters, drop the raw transcript, load only what the task needs. It's the same discipline that keeps the agent sharp, and it happens to be the biggest cost saver too.

A contextbase helps here in a way that's easy to miss: because the durable knowledge lives in files the agent loads on demand, you're not re-pasting it into the chat and re-paying for it every call. The context is read when needed, not carried forever.

Routing models by task

The second lever is the model itself. Running every step on the most powerful model is the easy way to overpay, because most steps don't need it. Discovery and simple edits run fine on a cheaper, faster model — save the expensive one for genuinely hard reasoning. Matching the model to the task is the single highest-leverage cost move, and it deserves its own playbook.

Most of your agent bill is re-sent context — keep it lean and the cost falls with it. Then route the models, and it falls again.

Start here: see how to route models to cut cost, compaction, or read the method.

Commander in Brief

Sign up to receive the weekly briefing — one real leadership decision in the news, connected to the framework. Fifteen minutes. Free.