A 30-step AI workflow doesn’t cost 30 times a single API call. It costs closer to 465 times, because the model re-reads every previous message on every single turn. That’s not a quirk you can optimize around at the margins. It’s baked into how stateless LLM APIs work, and if you’re building anything non-trivial with agents, it’s quietly eating your budget in a way that compound interest would recognize immediately.
I’ve been thinking about this as a form of debt, and I think the framing matters more than it might seem.
The Math Most People Miss
Here’s the actual shape of the problem. Each turn of an agent loop, the API doesn’t “remember” where it left off. It re-reads the entire conversation history from scratch. So if your workflow has 30 steps, and each step adds roughly 500 tokens of context, you’re not sending 30 × 500 = 15,000 tokens total. You’re sending 500 + 1,000 + 1,500 + … + 15,000, which is a triangular number series. That sum is 232,500 tokens — roughly 15.5x the naive estimate, or about 465x the cost of a single 500-token call.
At current rates on something like Claude Sonnet ($3.00 per million input tokens), a single 30-message agent loop runs around $0.70 in context re-reading alone. Not terrible in isolation. But if you’re an enterprise running 500 conversations a day, analysts estimate roughly 70% of your API spend is the model re-reading the same static context it already processed on the previous turn. You’re not paying for intelligence at that point. You’re paying for a very expensive re-read.
This is O(N²) scaling against what most people are treating as an O(N) problem. And the standard response — just expand the context window — makes it worse, not better. Longer contexts increase latency, cost, and what researchers are calling “context rot”: the gradual degradation in model recall accuracy as the window bloats. You can’t brute-force your way out of a quadratic.
Token Debt Is Real Debt
Technical debt is the idea that shortcuts taken now accumulate interest over time, slowing you down later. Token debt works the same way, except the interest compounds immediately, per-call, in dollars.
The discipline engineers apply to actual technical debt — tracking it, budgeting it, making explicit tradeoffs about when to take it on — is exactly what’s missing from how most teams think about agent context. People design workflows based on what works functionally, then get surprised when the cloud bill arrives. They’ve been treating tokens as approximately free, which they aren’t, and they’ve been treating context accumulation as a necessary feature of long-running agents, which it isn’t.
Some of the more thoughtful teams I’ve seen approach this are doing something they’re starting to call context engineering: treating the token budget as a hard constraint from the start, the same way you’d treat memory in an embedded system. That means deliberately resetting context windows at checkpoints, storing persistent state externally in databases or files, and spawning clean sub-agents instead of letting a single thread balloon. It also means using prompt caching aggressively — provider-level caching on static system prompts can cut prefix costs by up to 90%, which starts to look very important once you understand the triangular math.
The broader infrastructure reality makes this more urgent, not less. OpenAI is projected to lose $14 billion on a non-GAAP basis in 2026, with inference costs alone running $7 billion — a 3.5x increase from the prior year. The industry is spending something like $725 billion on AI infrastructure in 2026 against revenues that don’t yet justify it. That financial pressure flows downstream to pricing, and the teams that have built workflows assuming cheap-to-free inference are going to feel it.
The Analogy That Keeps Sticking
In my experience, the teams that manage technical debt well are the ones who made it visible. They have dashboards. They talk about it in planning. They know which parts of the system are carrying the most of it.
Token debt is almost entirely invisible right now. You see a monthly API bill but not a per-workflow breakdown. You see aggregate token usage but not which agent loops are the worst offenders. You definitely don’t see the 70% that’s going to re-reading context you already paid to process last turn.
The tooling to make this visible is starting to emerge — platforms that break down AI spend by team, by workflow, by efficiency — but it’s not standard yet. Until it is, most teams are flying blind, which is precisely when debt compounds fastest.
The question I keep returning to: if you knew, in real time, what percentage of your agent loop’s cost was re-reading versus generating new reasoning, would you build differently? I think most people would. The fact that we’re not seeing that number by default tells you something about how the industry has been pricing this, and probably how it will have to change.
Sources
- Less Context, Better Agents: Efficient Context Engineering for Long-Horizon Tool-Using LLM Agents — arXiv · AI
- INFRAMIND: Infrastructure-Aware Multi-Agent Orchestration — arXiv · AI
- Cost-Effective Agent Harnesses for Abstract Reasoning and Generalization on ARC-AGI-1 — arXiv · AI
- When Does Learning to Stop Help? A Cost-Aware Study of Early Exits in Reasoning Models — arXiv · AI
- The Harness Effect: How Orchestration Design Sets the Token Economics of Enterprise Agentic AI — arXiv · AI
- Akashic: A Low-Overhead LLM Inference Service with MemAttention — arXiv · AI
- Why Solve It Twice? Hierarchical Accumulation of Skills for Transfer-Efficient ML Engineering — arXiv · AI
- Memory chip giant SK Hynix jumps nearly 13% in Wall Street debut as AI frenzy powers biggest initial share sale in the U.S. by a foreign company — Fortune
- The AI economy could crash on mounting chip costs — and those token costs won’t help — Fortune
- How SK Hynix just pulled off the second-largest U.S. share sale by quietly powering the AI boom — Fortune
- Even Apple supply chain maestro Tim Cook couldn’t dodge the memory chip ‘RAM-ageddon’ crisis. Here’s why PC prices are soaring this summer — Fortune
- Big AI thins out the competition as startups quit the race to build large language models — Fortune
- ‘Getting control where we can’: Europe wants sovereign AI, but most of the chips are from the U.S. — Fortune
- Exclusive: A former Apple engineer thinks AI infrastructure is built for the wrong future. Investors just gave him $80 million to fix it — Fortune
- Now You Gotta Buy a Second Computer Just for Your AI Agent, Nvidia Declares — Futurism
- Meta So Desperate for Compute That It’s Building “Data Centers” That Are Just Tents Filled With AI Chips — Futurism
- South Korea to spend $1T on more memory chip production and humanoid robots — Hacker News
- Google to pay SpaceX $920M a month for compute capacity at xAI data centers — Hacker News
- What is Z-Angle Memory and why is Intel developing it? — Hacker News
- Mesh LLM: distributed AI computing on iroh — Hacker News
- https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQE2UDSJMREz31rA-rPxD99KGH3zgzoe8OtI_CVaGLPWF1xIVocqXDQM4oC_WhsuDIuRe2pH5kUaKDKFxJa6SpjAddBOlrqG1YGRbvxRlovFXCU5nctgjEu12GXVT8Lc4zFZAGNMAOu_2JT-EfvKZBHaCQ== — Gemini Deep Research
- https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQHMRkEG6Wj_I4Cy3BzNqOZLV55R13Mok0yOMZvXXaJfCTz8Y9zcnhLbdunnsCIrdqNp3a-qf9l5R7TZQGl1ccoWmpRvcODuPsdsR81EwOEgJ1Hl8gG32c8–9HyCAQVI8ojR0KJcwuZdsnOYQ9rgdtusJM= — Gemini Deep Research
- https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQGzU_nOvbksDHVgvEwEQq7sl295qe-QU7_zTos7VwFUTYZoCKNPH0bDVSF8sMU40bRAdsfnXrSIJKqdJ02MU0OUTV9omm4Psyc9NMqh_p5_HHfiWCEZSuAaG_FGjvtpZMAzxvu7Q7p1qw== — Gemini Deep Research
- https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQEIHVOTAjFmaX3XHeaQWZjiuSacpZ2WpVAzeXa8K-ixQaHNE7mSxG6iSAUfz7Zf2wzFqi4eCfhaQg-5ysEm-tkN4buu4LHCZoX2YPSfcuc3UdXLkmGnrpOFJPdVbWNAo3YeDUu8-NJtnrZtruQedZxQQIptLOSR56RaPLFmje2_LxwYD_B-Kh_i — Gemini Deep Research
- https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQFtgbg34VID_obBbfDIMKiSMmQ6hW0WT8mqN8lqyJZU1tklbbqgsvO4rYhysmV5_EQFVZ5T4DRu8E8HRsWhtq4tJkX8oe2lrE6G1P15v3V5LyxPcuEPftPTqo2ACHkWkulc9heHjjwYq-KZMgPwiZgzdqEFljqHqU54hldH8jyVEy5pVlgN5-aQHke-9O0M2g== — Gemini Deep Research
- https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQHLOdjka1F6hRuWObf_5zktcMmZgeOG9bh8jH0sOe5ybUAIFRljDBhi0YxGjeLhw8YNx8ZJ6zFXQ3dsLVcaeeMBntfY04voJzvYPQ9KtEITeOboHvxfZ460H3DhiLYAyTCXwYkIa_3jAQXyoVoaTluBdxAUDQbHanhGL9Xl-3Ph6J-S1voToPUKCbdGJEPQeOAfuz9V8K7D — Gemini Deep Research
- https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQEB-H7jUUfDpLohRFElgknzlVtyck3yF7kdNGXWiTdWqUHdVAeQrb7Z9-GKDD3ioEgDACDf21fyMk5ISVgWf_X4pkyhvUfslE_rtcL5Sr2v2UdDzte2JXYI11xY786VGk51x38-Td9Blvmj2mhTyE1pZ3dsh_4GsHkt2jqkOtnAHgk4A1AC — Gemini Deep Research
- https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQGJUIIcQrI1Gzc1fb7oaaaRFLT2Gjn6H4cqmBO1CQlxCoNjytL4WwlZON_U0whUDhq7nrel2wc-8b4lEz0brTFUjBKgAUliY1DqYCYRucUYJQR2O1bfVeT4YD64zSzrCAg_ReDzJdadW8BnE69hoVNlpfppMURsjzq_f6oAYGt9lht1g0Yb4Q_bu-YUr-qzh1u7rgIRlh4eDpouODXEzqh7aCSaUr8YEYfKKIATSqz_seL8-tN9 — Gemini Deep Research
- https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQE9fQZdEOAosuPbDXb9XzSrNxnekn245jgxRXKO_6KMj7YJJ6g4Hj4k1Rr9h51tC2NYYtpIhLAKX63wTEI_1xk1Ev3LQHu0GPlU3_cWhdWOBpMjvIM2z433UmdE6RMzWZUxNwfz4K9N3fGoHTwn1Jo3mFJZn6ILJlPBq6pshDVnYkqmgomw_Gw-pCP- — Gemini Deep Research
- https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQEVZ7lhKqB2k2SxlD4m3RYX7yU14mYO9zhGttgdVx8siUAHDMId9rPVtbXipH7v-A4mQ5deaLtsIWRmNS_SvuY8JLcaQ2-5Jx9T9R3O58vxqO-as_zbfmVKpPpxYgjzW8Mk — Gemini Deep Research
- https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQFzTJyI1mUNUYYiu6FPiWrE3KkQ6smEsm5468A_2yDf_UMb6JMFaXdU7tTQk8i7bU6Bjvcvw7Ulyyr93X_RYGmLQ-iUE-15ghxSfTT-GL6ZTrFtdekfDqgLibgysaV0h6XQFdn0vGmGUQdTz3K7GPFh17IHdAnlkkG3zpZHmPmXAs04P6gCBLE= — Gemini Deep Research
- https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQH5LJSzoVR7tazDgZDpclIvl7t1IdIojvP6_MAgRUDJlF2wWOoQ1a_piQpapqcVYc83LcBu6OBUPwf_DiyKCi8qIiC2vr_32-GAXeNSq77InuXwxorNxR1p1ZeSOL22dwoF7zYazjzB2eUDZ1RYXgnPXWL8VaJ68SQ6hBFxKy31cw_-5itBfgZodV3Cxhe-7uR1rmbXL8R3hf5THdE= — Gemini Deep Research
- https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQHb-17N9-dPH2icqN7OoORn2fBVU85up517xYchW3QgYIw_dWRLmfanKvJpe1dvXXjTei76qTkdw5TuLgmNg8Ri0jpHDVgV5uQe_tDt0Pe3No0SwSiNMqs90dTT_5wxG9BO — Gemini Deep Research
- https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQERWkImbJzwHOwn4qHRI0dD-MDZh5HA27fT_L1AmirF9F_PqOLDwRNz4RKR95MAzAeeNg9qi17ww9dCJNV8gHv8yVi4NhKpo7BlxqKj4tG4izwYksfwuOxmDvattvIdwo4KA195UGEHMSelTAOsF4IiWjc4MDQX8CR5pDaTa5PMHB4gd4W22cLC6hPi — Gemini Deep Research
- https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQErbblHCpASOt3OnhRKYLvQjAKWCRiOBLmIH8kYqnr_xV7ouWYCBRkfg40Gm-g8wSuniv2Y2Td0RFiIj8rTZkRmFvv74aI1qaOB4mACC_0seMdWuai2zKkNccteLwUxyKgwpso8bHUC0lKaJZrcICMo1fl6PdZaEsEJfgAfIhEOwXtyWmtN9ZesNexXIuWdUaW866cNgLocqRX_50wUnVqpjsDK — Gemini Deep Research
- https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQGtECgNzV9y5z2VPtzsfOUTeMkecvfzyGG2oDumgWxqvt78l1gPzHOsx9_-RtXvcB5k7MjMTwRo2rM8NuN9QR31NnNpH9DFjAS0K1pxLC5F7GLOrAVTJXd9IvyhJi-HtwUxnZ0iC_MSu3xLc9Ir6204_YmwhxNzOC7-R8S7tV-ySpIo4Izonzp8CrE= — Gemini Deep Research
- https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQFYuChhPOFVRSHLLoK81qh3eQPxQCPNPM1xLiELqPGegpGVodZecCEhz0P0VSr2_F-fU1kFmargWX_87_nP7feBSs0xv8sGOjHaBTo_B0lXp_uu8lWArmKEkfaCgmWB–vzYF-GudOAfSdFKKuK7AeJywjFMVEW7BgZKXOGvA== — Gemini Deep Research
- https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQGbCVzmVF5WRX2HaS1vpiG_jftl3v0b3RTWWNIoWIJHAmFUG8waCQN8a5y-37ffTqoZZZ72ZcS7A5K3PbPKrc6DRKiSdFR7hYh-UkRAMSX4eeh4WWKqK898oh0m36nzsuHwJbOGPGK0uOkf1XvAuZFg8RRn89W7lg== — Gemini Deep Research
- https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQHxm24LoTszRT4ym2kUyvmLpC25saOxMlI4ykG7TH4r27uOMDbA17ik5u4wgrMy4qYzpWVwMYl45ECIZNDQGV7_KMyawz1KB_mdtzsYezFhLAQ2lEAxdJ8iL89YzS1_4-86QMJ8nvlmU-Emy36sEAG_m2IK7KZRthZ3ttK4XdMwsyNJrmIcJA== — Gemini Deep Research
- https://vertexaisearch.cloud.google.com/grounding-api-redirect/AUZIYQGF0-88QbiBTx6KkG1O6E0WwwekEu7jmd567okMWSpsNXteXQYTwEHTFznWDyMnuC2QDacKtqRZCi1bg9vKbZa1WZB3uMtmVRYPyu_h0KfvPB8Y17gH8uHRlwBMopnNSvdNPj1E_4S2xB5PbA6Dtb2cTR8R21aEYwTBh3pCd-hSGdEfyZiLTH3_cofiqod7sYTf9U9bVxGDyqvfdvj9U_-qJS–pmxi4lk8crxEfpUVgeceyYkAmX4OECOexG0MMhh-QjlQMhTqVQMKD4uOgaGI0nJ5wGHY7dZ6MZVaLJ75mCVGqvfB_bR3WsdDnyXcryECSiJVJy4xAM1lBFpjx8FVoht4A6B2qMRm-3bv1Qt-nySxzZGLKjQ0-do4BopB-bk4wGVmILdOX9lIDXL2ItzlcpjfiJUTk7b4XVIiWxhDTx6yb5mnHa72ppmqPS6KlqXNvfIERRXiWw8ETowKRYuxTKZP3A== — Gemini Deep Research
- ‘The moment infrastructure moves to orbit, that assumption disappears’: Layered access control, physical redundancy and rapid component replacement are major orbital challenges — TechRadar
- Huawei just dropped a major AI chip surprise — but Nvidia should really be paying attention to the other big news from its rival — TechRadar
- Qualcomm High Bandwidth Compute aims to compete with High Bandwidth Flash and Memory by stacking LPDDR just above the CPU to ’eliminate HBM tax’ — TechRadar
- SSD expert shares some worrying truths about Chinese chip makers — and I think this could be more bad news for the RAM crisis — TechRadar
- ‘We have supply for very, very robust growth, but we’re still supply constrained’: Jensen Huang says Nvidia has enough CPU and GPU supply to grow AI — TechRadar
- Chinese DoorDash rival smashes open source record with 1.6-trillion-parameter LLM with a 1-million-context-token model crafted without Nvidia hardware — TechRadar
- Old Nvidia GPUs are being resurrected to cope with the RAM crisis — but one big chip maker seems determined that a memory shortage won’t happen again — TechRadar
