Why Do AI Agents Waste So Many Tokens?
One of our engineers watched a single autonomous refactor burn $4,200 in a weekend. The model wasn't doing more work — it was re-reading the same files, re-sending the same instructions, and re-arguing with itself. This is the hidden tax on every AI agent in production, and the new science of fixing it.
The $4,200 Weekend
Here's a story that will sound familiar if you've run AI agents in production. A developer on an engineering team sets up an autonomous refactoring run on Friday afternoon. Nothing ambitious — read a few files, propose some changes, clean up the code. He goes home. Monday morning, the API bill shows $4,200 for one developer, in one weekend [1].
His manager's first instinct was that the model was doing too much work. It wasn't. It was doing the same work over and over. By step 200 of the loop, the agent was paying for the same system prompt, the same conversation history, and the same file contents more than a hundred times [1]. The machine wasn't working harder. It was repeating itself and being charged for the privilege.
We run one of these systems at scale — an autonomous AI organism with dozens of workers and thousands of tasks a week. We've seen worse. Last month, two of our workers spent hours fighting over the same file. One patched it. The other, operating from an older view of the world, reverted it. Then the first worker inspected the damage, re-patched, and re-verified. The file was fine in the end. The token bill for the argument was not.
Here's the thing we've learned, and it's the whole point of this post: token waste is not a billing problem. It's a cognition problem. It happens when an agent doesn't know what it already knows, doesn't know what changed, and doesn't know what it's allowed to touch. And in 2025 and 2026, the research community started producing real, verified answers for every piece of it.
Why an Agent Burns Tokens Like a Chatbot Never Could
Start with the difference between the two. A chatbot gets one message and gives one answer. Done. One call, one context, one bill. An agent is a loop: perceive → reason → act → observe → repeat. Every step calls the model again, and every call re-sends the entire accumulated context — system prompt, tool definitions, conversation history, file contents, results of previous steps [1].
The maths is brutal and it compounds. Take a simple task: read a 2,000-line file and propose a refactor. The first step costs about 1,700 input tokens. By step 5 — after the file is read, analysed, planned and edited — the loop is sending 11,950 tokens per call. Total: 45,700 input tokens for a task a chatbot could do in 9,700. That's 3.2x for a five-step loop [1]. At 50 steps the multiplier passes 30x. At 200 steps — a normal autonomous debugging session — it exceeds 100x [1].
Why does this happen? Because LLM APIs are stateless. The provider does not remember your previous turn. So the agent re-sends everything, every time [1]. Engineering teams that have audited their pipelines report that re-sent context is 62% of the bill [1] — nearly two-thirds of what you pay is the machine reminding itself of what it already knows.
There's a hardware layer underneath this worth understanding, because it explains why "just buy more context" is the wrong answer. Every token you send becomes a key-value pair in the model's KV cache — the attention state that lets the model remember what it has seen. The cache grows with context length, eats memory, and costs money to write and read [4][10]. Bigger context windows don't fix waste; they just let you waste more per call. As one 2026 analysis of the "missing memory hierarchy" put it, the active generation window is small, fast, and expensive per token — and most agents treat it like a dumpster [10].
The New Science of Spending Less
Here's the part that should give anyone running agents genuine hope. In the last eighteen months, the field has stopped treating token waste as an accepted cost of doing business and started treating it as an engineering problem with measurable solutions. Five strands of research matter most — all published, all verified, all from 2024-2026.
Prompt Cache: build the stable parts once, reuse them forever
Prompt Cache treats overlapping prompt segments — system messages, tool schemas, constitutional prefixes — as reusable modules whose attention states can be computed once and reused across calls [4]. The reported results are stark: up to 8x speedup on GPUs and 60x on CPUs, because the model stops recomputing what it has already processed [4]. The architectural lesson for anyone running agents: structure your prompt into stable modules and put the dynamic parts last, because caching is exact-prefix matching — one changing field before the cache boundary drops your hit rate to zero [11].
ACON: compress the agent's own history, on the fly
ACON (Agent Context Optimization), published as ICML 2026 research, attacks the long-horizon problem directly: agents in dynamic environments accumulate unbounded context, and that growth costs money and degrades reasoning [5]. ACON compresses both observations and interaction history into concise representations, using failure-driven guidelines refined in natural language — no fine-tuning required. On AppWorld, OfficeBench and Multi-objective QA, it reduced peak token usage by 26-54% while improving task success over existing compression baselines, and it enabled smaller models to perform as long-horizon agents with up to 46% better results by removing context distraction [5].
Active Context Compression: the agent decides what to forget
The newest work goes further: agents that actively decide when to consolidate and prune their own history. In one 2026 implementation ("Focus"), agents prompted to consolidate learnings into a persistent knowledge block every ten to fifteen tool calls achieved a 22.7% overall token reduction — 14.9M to 11.5M tokens — while maintaining identical task accuracy [6]. Compression becomes a first-class operation, as ordinary as a tool call: summarise the resolved, drop the superseded, keep the live [6].
FINCH and Quest: compress the cache, not just the text
Two more strands attack the KV cache itself. FINCH compresses input contexts by iteratively identifying the relevant key-value pairs, achieving up to 93x compression without fine-tuning — letting models process far longer inputs within GPU memory [7]. Quest is query-aware: instead of treating every token as equally important, it estimates which KV cache pages actually matter for the current query, achieving 2.23x self-attention speedup and 7.03x latency reduction with negligible accuracy loss [8]. The shared principle: not every token deserves equal attention, and a machine that can tell the difference spends less [8].
Look at what these five strands have in common. They all converge on a single principle that the entire industry is slowly waking up to: context is a budget, not a dump. The best agents of 2027 won't be the ones with the biggest context windows. They'll be the ones that know exactly what they need, retrieve it, use it, and let the rest go.
Memory Is Not Context
This is the conceptual shift that makes all the techniques above coherent, and it's the one we've had to learn the hard way. Five distinctions, each of which costs real money when you blur it:
- Memory is not context. What you store is not what you must send. Store richly, send minimally.
- Context is not evidence. Material in the conversation is not proof about the world. Proof comes from observation and verification.
- Evidence is not reality. Evidence describes reality; it is not reality itself. It can be stale the moment it's written.
- Reality is not history. What was true last Tuesday is not necessarily true now. An agent reasoning from an old world-view is the exact failure that started this post.
- Cached context is not automatically current. A cached representation doesn't become epistemically valid just because it's computationally reusable [10]. Every cacheable fact needs a source, a version, a timestamp, and a validity state — current, stale, expired, or unknown [10].
Once you accept those distinctions, a cleaner mental model follows. Every token you spend is one of three kinds. Productive tokens — perception, reasoning, decision, action, verification. These are the point. Redundant tokens — repeated context, duplicate objectives, stale instructions, avoidable retries, and the tokens two clobbering workers spend fighting. These are the enemy. And protective tokens — security, verification, recovery, adversarial testing. These are sacred. The discipline is simple to state and hard to keep: eliminate redundant spend with prejudice; never cut protective spend to save a penny [9].
There's also a structural habit worth stealing: reference instead of repetition. Instead of injecting an entire document into every call — a constitution, a specification, a decision log — send an ID, a version, a content hash, and a one-line relevance note, then retrieve only the section you need. The organism operates on canonical references plus selective retrieval rather than repeated textual duplication. It's the difference between carrying a whole library around and knowing exactly which shelf to walk to.
And when you do build context, build it in layers: an immutable core (identity, governing principles, security boundaries), then stable system state, then current reality, then the active objective, then only the evidence relevant to this decision, then retrieved history on demand — and raw interaction history in cold storage, never in the active window. Minimum sufficient context, not maximum available context. That one sentence, applied consistently, fixes most of the waste in most agent architectures.
What Happened on Our Watch
We're not writing this from a library. We run an autonomous AI organism in production — multiple workers, shared state, continuous operation — and in 2026 it taught us the most expensive lesson on this page.
The incident: two sibling workers were assigned overlapping work on the same file. Neither knew the other existed. Worker A patched the file. Worker B, working from state that predated the patch, overwrote it. Worker A detected the regression, investigated, re-patched, re-verified. Worker B did the same in the opposite direction. For hours, the system was paying for an argument between its own components — every cycle was inference, tool calls, file operations, and re-analysis, all spent on reverting rather than building [1][9].
This is the failure mode the industry calls clobbering, and the point we want to land is this: it is not just a correctness defect. It is a resource-efficiency defect. Every lost patch triggers re-inspection, re-reasoning, re-execution and re-verification. The token cost of the fight is often larger than the cost of the work itself. One analysis of this exact class of failure put it plainly: concurrent mutation without ownership causes lost work, patch reversal, repeated inference, and wasted tokens [9].
What we changed, in order of impact:
- Canonical ownership. Every shared resource has exactly one owner at a time. If you don't own it, you don't mutate it.
- Work leases and fencing. A worker's authority to mutate expires on a timer. When the lease lapses, the worker is fenced — it cannot write, only read and report. A worker must never keep mutating a resource after its authority has expired [9].
- Generation checks and atomic writes. Before any write, the worker checks the current generation of the file. If it's newer than the worker's view, the write is refused, not merged.
- Semantically-aware deduplication. This is the subtle one. Naive dedup would have suppressed one of the two workers as a "duplicate" — and would have been wrong, because the second execution was required to reconcile reality. We now distinguish five cases: a true duplicate (same objective, same reality → suppress), required re-verification (same claim, reality changed → execute), retry (previous execution failed → execute per policy), recovery (interrupted → resume), and regression/adversarial tests (intentionally repeated → execute). Deduplication must never suppress required verification or recovery. [9]
The result wasn't just cleaner state. It was a measurably smaller bill for the same verified output — because the machine stopped paying for its own arguments.
The Forecast: Token Economics Becomes a First-Class Signal
Here's where this is going over the next 24 months. Token economics is about to become what CPU and memory utilisation were to the last generation of systems — a first-class metric that architects design for, not an afterthought that finance complains about [3].
Concretely: cache-aware runtimes become the default, with stable prompt modules designed for reuse rather than rebuilt cognitive environments on every call [4][11]. Self-compressing agents become standard, consolidating their own histories under governance rather than carrying them everywhere [5][6]. Model cascades route easy work to cheap models and reserve expensive reasoning for genuinely hard decisions. And every serious agent platform will report the metrics that matter: cache hit ratio, tokens per verified outcome, model calls per objective, cost per failure class — because you can't govern what you don't measure [9].
The one warning we'll put in bold, because the industry will over-correct: do not optimise the wrong thing. A system that uses 50% fewer tokens but produces worse decisions is a regression, not a win. The primary metric is verified useful outcome per unit of resource — quality, truth, safety and verification first, cost second. Efficiency is subordinate to correctness, but efficiency must itself be governed [9].
What It Means for Your Team
You don't need a research lab to start. You need five habits, in this order:
- Measure before you optimise. Track tokens per task, re-sent context share, cache hit rate, and retries for a week. The biggest waste source is usually the one you haven't looked at — the context re-sent across a long loop [1].
- Stabilise your prefixes. Put everything stable (identity, rules, tool contracts) at the front and everything dynamic at the end. One random field before the cache boundary kills your hit rate [11].
- Retrieve, don't inject. Replace wholesale document injection with references plus selective retrieval. Your agent should walk to the shelf, not carry the library [9].
- Make dedup semantic. Suppress true duplicates; never suppress re-verification, retries, recovery or tests [9].
- Coordinate every writer. Ownership, leases, fencing, generation checks. Prevent the argument before you pay for it [9].
The Honest Counterpoints
"Compression means losing information. That's dangerous."
The risk is real, and it's why compression must be a governed subsystem, not a shortcut. Good compression preserves identity, objectives, constraints, current reality, evidence, open gates and failure state. What it must never do is silently convert hypothesis into fact, stale into current, or planned into executed. The ACON and active-compression results show accuracy is preserved when the compression is task-aware and failure-driven [5][6] — but any team adopting these techniques should treat the compression layer itself as something to test adversarially, not trust blindly.
"My provider caches automatically. I don't need to do anything."
Automatic caching is real — Anthropic, OpenAI, and Google all cache prompt prefixes to varying degrees [11][12]. But automatic is not structured. Hit rates depend on your prompt being a stable, repeated prefix; one dynamic field before the cache boundary and you're paying full price on every call [11]. Providers also stop caching after their cache boundary — everything after it is uncached. If your entire context is dynamic, your provider's cache is a feature you're not using.
"Smaller context means a dumber agent."
The research says the opposite. ACON's most striking result wasn't the token savings — it was that smaller models, freed from context distraction, performed up to 46% better on long-horizon tasks [5]. Irrelevant context doesn't just cost money; it actively degrades reasoning. Minimum sufficient context is usually the smarter agent, not the weaker one.
"We're too small for this to matter."
The multiplier applies at every scale. A five-step loop is already 3.2x the cost of the equivalent single call [1]. The $4,200 weekend started as "one small refactor" [1]. Token waste is a percentage tax on everything you do with agents — the sooner you stop paying it, the more budget you have for the work that actually matters.
"This is the vendor's problem. They should fix pricing."
Token prices will keep falling. The multiplier won't. Cheaper tokens times the same 100x repetition is still waste — it's just cheaper waste. The architecture that decides what goes into the context window is yours. Sixty-two percent re-sent context isn't a market condition; it's a design decision [1].
"I'll wait for the models to get better."
Models are getting better — at reasoning, not at self-awareness. A model doesn't know it's repeating itself any more than a contractor knows he's digging the same hole twice; that's what systems are for. The teams that adopt token economics now will have a measurable cost advantage and cleaner systems when the next model generation arrives. The practice, not the price, is the durable edge.
Why We Wrote This
We run one of these organisms in production, and token economics is now a governing principle of our architecture — every token classified as productive, redundant or protective; every cache measured; every worker coordinated; every optimization gated on evidence rather than vibes [9]. We wrote this because the techniques above stopped being theory for us and became survival.
If you're running agents and the bill is climbing faster than the output, that's not a pricing problem. It's usually one of four things: context duplication, execution duplication, coordination failure, or history growth [1][9]. All four are fixable, and all four are cheaper to fix than to ignore.
🔍 Want to see where your agent pipeline is leaking tokens? We'll audit the loop and show you the re-sent context, duplicate work, and coordination failures — with numbers.
Get a Token Audit →Sources & Evidence
References
- LeanOps — Ravi Kanani, "Agentic AI Cost Runaway: Why One Cursor User Burned $4,200 in a Weekend (And How to Stop It)." May 14, 2026. Source. Agents burn 10-100x chatbot tokens; re-sent context is 62% of the bill; 3.2x at 5 steps, 30x at 50, 100x at 200.
- Oplexa — "AI Inference Cost Crisis 2026: Why Your AI Bill Is Exploding." March 31, 2026. Source. Citing Gartner's March 2026 analysis: agentic models require 5-30x more tokens per task than standard chatbots.
- Portal26 — "AI Agent Cost Control: Stop Agents Burning Budget." 2026. Source. Citing Gartner: worldwide AI spending forecast at $2.52 trillion in 2026, up 44% year over year.
- Ginart, A. et al. — "Prompt Cache: Modular Attention Reuse for Low-Latency Inference." arXiv:2311.04934, 2023 (updated 2024). Source. Reusing attention states across overlapping prompt segments; up to 8x GPU / 60x CPU speedup.
- Kang, M. et al. — "ACON: Optimizing Context Compression for Long-horizon LLM Agents." arXiv:2510.00615, ICML 2026. Source. 26-54% peak token reduction; up to 46% performance improvement on long-horizon tasks by removing context distraction; no fine-tuning required.
- Bojkowski, P. — "Active Context Compression: Autonomous Memory Management in Long-Running AI Agents." 2026. Source. The "Focus" implementation: 22.7% token reduction (14.9M → 11.5M) with identical task accuracy; consolidation every 10-15 tool calls.
- FINCH — "FINCH: Prompt-guided Key-Value Cache Compression for Large Language Models." 2024. Source. Iteratively identifies relevant KV pairs; up to 93x compression without fine-tuning.
- Tang, J., Zhao, A. et al. — "Quest: Query-Aware Sparsity for Efficient Long-Context LLM Inference." arXiv:2406.10774, ICML 2024. Source. Query-aware KV cache page selection; 2.23x self-attention speedup, 7.03x latency reduction, negligible accuracy loss.
- Sovael engineering — first-party case study: the sibling-worker clobbering incident and the Token Economics programme (productive / redundant / protective token classification; semantically-aware deduplication; worker leases and fencing; reference-over-repetition). Full analysis and implementation notes on the Sovael Learnings page. Primer video: How LLM Tokens Work (YouTube).
- "The Missing Memory Hierarchy: Demand Paging for LLM Context." arXiv:2603.09023, 2026. Source. The active generation window is small, fast, expensive per token; context pruning and prompt caching as first-class operations; cached representations must not silently become current.
- Vercel — "Prompt caching across providers: automatic vs explicit." 2026. Source. Prompt caching is exact prefix reuse of KV tensors; one request-specific field before the cache boundary drops the hit rate to zero.
- Mishra, N. — "Prompt Caching: Reducing Latency and Cost." 2026. Source. Provider caching mechanics: Anthropic cache_control, OpenAI automatic caching, vLLM prefix caching, SGLang RadixAttention.
- mem0 — "The 2026 Token Optimization Playbook: Cut AI Agent Memory Costs 3-4X." 2026. Source. Modern memory architectures as the lever for 3-4x token cost reduction.
- GOV.UK — DSIT Supplementary Estimates Memorandum 2025 to 2026. Source. The UK government's package of AI investment: skills, compute capacity, and dedicated AI growth zones — the public sector is betting heavily on the same technology that operators are currently wasting.
💬 Running agents and not sure where the waste is? Message us — real engineers, quick reply, no pitch.
Chat on WhatsApp →