Skip to content
← All posts
ThoughtsAugust 11, 2026

How to Reduce AI Agent Costs

If you want to cut your AI agent bill, start by finding the unit of work you are paying for twice.

I started with a hypothesis that there was repeated work inside sessions. As a parent, I was looking for the software version of a kid asking are we there yet every thirty seconds. More specifically, I was looking to see if the agents were running the same command, re-reading the same file, things like that.

I audited the last 500 sessions our team ran, and exact repeated tool calls were only about 4% of our Claude Code tool calls. Yes, agents repeat themselves, but the real cost was quieter: agents re-reading context they already had, helper agents loading the same files from scratch, permission checks running as their own hidden call stream, and teams solving the same setup problems across sessions because the previous answer never became durable. All parts you can’t see from the bill.

The bigger takeaway here is that every team using agents needs to get their session data now, before the expensive habits become invisible infrastructure.

The thing I got wrong about repeats

We used tapes to record every agent session as a high-fidelity trace, every tool call, every result, and every token, in the order it happened. Then I was able to export the last 500 sessions and analyze the tool calls. For every tool call, we created a fingerprint from the tool name and arguments. If the same tool was called again later in the same session with the same arguments, I counted it as a repeat, which totaled about 4% of our sessions. That didn’t explain where the money was going. I needed to go beyond that and look at the work the agents were doing, and whether it was necessary.

Exact repeats were rare
same tool + identical arguments, within one session
3.6%
932 repeated calls
out of 25,587 Claude Code calls
932 exact repeats24,655 other calls
Byte-level matching undercounts semantic repeats — the 3.6% is a measured floor, not a universal benchmark.
SOURCE 500 exported sessions, Jul 20 – Aug 8, 2026LIVE — switch the measure; hover a segment for exact counts

Read the tail before you cut it

I took a look at one session that made 518 tool calls building a Stripe self-serve flow. 138 of them came after the agent last changed a file. Prorated by call count, that tail cost about $26. Initially, it looked like drift since the work was done and the agent kept going.

In actuality, the agent had deployed the flow to a test environment, clicked through the whole thing, and checked that the data landed. It was double-checking its own work.

This matters because if you decide that tail is waste and cut every call after the last edit, you’ll train your agents to hand you work they never tested. You’ll save $26 today and pay it back the first time a broken checkout ships to customers.

So before you cut a long tail, read it. Counting calls only tells you what an agent did. Reading the session tells you whether the work needed to happen. Only one of those questions saves you money.

Why AI Agent Context Re-Reading Drives Up Your Bill

Every single step an agent takes, it re-reads its whole memory first. Picture a student who, before answering each question on a test, silently re-reads the entire textbook from page one. Re-reading one page is cheap, but re-reading the whole book a few hundred times is not, and that’s most of what a long agent session is doing.

In our most expensive sessions, about two-thirds of the cost was exactly this: the agent re-reading context it already had, over and over, instead of doing new work.

This is what token efficiency actually means: not how often the agent talks, but how many tokens it drags along every time it does.

And it isn’t spread evenly. 70% of our spend lived in 20 sessions out of 500. The typical session cost under two dollars. Averaging cost across all your sessions is like averaging your phone bill across every text you send, when one roaming charge is the whole thing. Don’t audit everything. Audit your biggest sessions and ignore the rest.

The Four Biggest AI Agent Cost Leaks Worth Fixing

Two things reframed this for me. The cost is concentrated in a handful of sessions, and almost none of it is someone prompting badly, it’s the defaults built into the tools.

Long AI Agent Sessions Are Expensive, But Cutting Them Can Cost More

The obvious move is “cut long sessions.” Be careful here. This is the one fix that can cost you more. Cut a session that’s in the middle of one real task and the agent loses the thread, then rebuilds it from scratch, and rebuilding is the expensive part. Keep the notes for the problem you’re solving right now. That’s the work you want to do. The waste is dragging unrelated old context along on every step. So start a fresh session for a genuinely new task, and don’t truncate one that’s mid-task. The enemy isn’t length, it’s carrying context the task doesn’t need.

The Hidden Cost of AI Agent Permission Checks

Before our agents run most tools, a second small model quietly checks “is this allowed?” That’s like a cashier who calls a manager over before every single scan, even for a banana. In my first audit, I could count these but couldn’t price them. The last 500 sessions changed that, because the traces are high-fidelity: every call tagged by kind instead of rolled into one session total. A bill tells you what you spent. A trace like that tells you what you spent it on.

The answer in our sessions: permission checks were one in four of every model call we made, and about $670, roughly 4.5% of the bill. They’re cheap per call, because each one is mostly re-reading text the agent already loaded. The permission-check model was chosen by the harness version, not by how hard the question was, and it was never the cheap one. If you can send that “is this allowed?” question to a smaller, cheaper model that does the same job for less, you can cut the tax without changing the work the agent does. The fix is to make sure the permission-check model is as small and cheap as possible, and that it doesn’t re-read the same context every time.

Permission checks created a second call stream
extra checks per 100 main-thread calls / three measured sessions
Codex nesting fix2,238 / 2,862 calls
78
Phase 3 mega-session2,859 / 4,235 calls
68
Phase 4 supervisor1,158 / 2,020 calls
57
A second call stream
78 means 78 permission checks for every 100 main-thread calls.≈ $670 · 4.5% OF SPEND
Across the last 500 sessions, permission checks were one in four of all model calls.
SOURCE Session rollup call-kind counts, Jul 20 – Aug 8, 2026

Why Helper Agents Waste Money Re-Reading the Same Context

Big tasks get split across helper agents. Each helper wakes up with a blank memory, so each one re-reads the same briefing file from scratch. In one session, the same design doc was loaded cold in 23 separate helpers. The fix: hand the helpers what the main agent already read, instead of making each one fetch it again.

Cross-Session Memory: The AI Agent Cost Leak Teams Miss

The clearest avoidable work happened between sessions. One environment set up twice in two days (that was me 🙄). Four separate sessions installing and logging into the same tool in one afternoon. The same workflow rebuilt three times from a pasted prompt, for $120 total. It’s like solving the same crossword every morning because someone threw out last night’s finished grid. At least $44 of that in nine days, and it scales badly. At 500 sessions, one file got re-investigated across 31 different sessions. One of our repos even has a sensible rule: don’t leave planning documents lying around in the codebase. The side effect is that the agent re-derives that plan every time, because we told it to keep the thinking in the conversation, and the conversation ends. It isn’t that the agent forgot, it’s that we never gave it a place to remember.

The cleanest sessions still repeated old work
identifiable cross-session repeats / nine-day window
Environment setup repeated two days later
second setup session
$5.90
MCP installation and authentication debugging ×4
four sessions in one afternoon
$5.12
Cassette-extraction workflow re-derived ×3
$120.35 total across three sessions — estimated repeated ramp-in
≈ $33
Bug investigated before an existing issue surfaced
human labor embedded in a larger session
Unpriced
Identifiable total
$44+
Excludes human context switching, duplicate-investigation labor, and sessions missing from capture.
SOURCE 500 exported sessions, Jul 20 – Aug 8, 2026

Run your own audit

Capturing your session data is the start here. Export a week or more of your team’s sessions (tool names, arguments, results, timestamps, model usage) and sort what you find into three piles.

AI agent cost audit
One dataset. Three ledgers.
500 sessions / 44,480 tool calls / 19 days / 6 people
01 · Inside sessions
3.6%
Claude Code repeat rate
932 / 25,587 calls574 identical results
Exact matches only. Semantic repetition is undercounted.
02 · Between sessions
$44+
identifiable repeats
setup / debuggingworkflow ramp-in
Plus duplicate-investigation labor and human context switching.
03 · Around sessions
25
checks per 100 calls
20,338 permission checks81,442 model calls
≈ $670 in permission checks roughly 4.5% of total spend.
SOURCE 500 session exports, Jul 20 – Aug 8, 2026. Nine large exports unavailable (server stream errors).
  1. Inside sessions: exact repeats, identical results, retries, and calls after the last real change.
  2. Across sessions: repeated setups, repeated investigations, duplicate tickets, workflows rebuilt from the same prompt.
  3. Around sessions: permission checks, routing calls, evaluators, supervisors, helper agents. Keep the number of calls and the dollars in separate columns until you can trust both.

Then read a sample from every pile, because the count lies on its own. A repeat can be a valid safety check. A long tail can be verification. A tidy-looking session can quietly redo yesterday’s work.

I started this sure the waste was agents repeating themselves inside a session, but the better question turned out to be where does finished work stop being available to the next agent that needs it? The money leaks when an agent re-reads what it already knew, when a helper reloads what another helper already had, and when the team solves the same problem twice because the first answer was never saved.

Token efficiency means making sure finished work does not have to be rediscovered. Find the unit of work you are paying for twice. Record it once, then go read your twenty biggest sessions, because that is where your bill actually lives.

Your agent bill is lying by omission. Get the trace data.

Found this useful? Share it.
ShareY

Start with paper

Turn every session into knowledge at team scale.

Get started