
AI Agent Costs Grow With the Square of Steps: 4 Layers to Cut Token Spend Before Switching to a Cheaper Model
Vũ Khôi
Tác giả tại Wotech Electronics Blog

AI Agent Costs Grow With the Square of Steps: 4 Layers to Cut Token Spend Before Switching to a Cheaper Model
You don't pay for answers — you pay for how many times you re-ask the same thing. That is the central argument of Hoang Viet AI in a post in the comailo group (18/11/2026): an agent running 40 steps, resending the full conversation history at each step, does not pay for 40 answers but for the same context 40 times — and that context grows longer after each step. The post is also candid about the limits of the viral story it starts from: the author could not verify its two shocking figures. All figures and claims in this article follow the post and have not been independently verified by Wotech.
Quick answer: According to the post, an AI agent's cost does not grow with the number of steps but with the square of the number of steps, because each step resends the full conversation history — the same context is paid for repeatedly and grows longer after each step. Switching to a cheaper model therefore does not save the bill: you just lowered the price of one unit, while the number of units still explodes. The post proposes 4 layers, worked top-down: one, filter before reading — give the model only the relevant information; two, reuse before generating — HTTP cache, semantic cache, and cached step results; three, check for changes before re-running — push the check out of the model into code, and call the model only when there is real work; four, block loops — circuit breakers, maximum retry counts, and routing easy queries to small models. On top sits accounting: measure cost per completed task, not token price. The post also states that the two figures in the original viral post (a 16-year-old student running 300 bots for under $0.02 per bot per week, versus $4,500 per week the usual way) could not be verified by the author — no name, no repo, no source — but the 20 repos that post listed are real, and the author checked each one.
A token is the unit of text a language model processes and charges for. When an agent runs many steps, each step resends the full conversation history — meaning the same context content is charged repeatedly, and that context grows longer after each step. That is the mechanism by which cost grows with the square of the number of steps, according to the post.
Why does cost grow with the square of the number of steps?
According to the post, an agent running 40 steps, resending the full conversation history at each step, does not pay for 40 answers — it pays for the same context 40 times, and that context grows longer after each step. The direct consequence: cost grows not linearly with steps but with the square of the number of steps. This is also why, per the author, switching to a cheaper model does not save the bill: you just lowered the price of one unit, while the number of units still explodes. The real story, per the post, is not "there is a cheap trick" — it is where the money flows.
What are the 4 layers, worked top-down?
| Layer | Principle | Method per the post |
|---|---|---|
| 1. Filter before reading | Don't give the model an 80-page file when you need 3 numbers | Convert PDF, Excel, and HTML to clean markdown first; chunk and retrieve only the relevant chunks; compress long input while keeping constraints. With terminal logs it is even clearer: one build command dumps 4,000 lines, the model needs the 12 lines with errors. |
| 2. Reuse before generating | Don't regenerate what already exists | HTTP cache for unchanged pages, semantic cache for near-identical questions, cached results of completed steps. A pipeline failing at step 9 does not redo steps 1 to 8. |
| 3. Check for changes before re-running | Don't call the model to ask "anything new?" | A job running every 5 minutes costs 288 times a daily job, and the answer is almost always nothing. Push the check out of the model, run it in code, call the model only when there is real work. |
| 4. Block loops | Unbudgeted retry is a bill | Unbudgeted retry turns a 200-millisecond error into a $200 bill. You need a circuit breaker, a maximum retry count, and routing of easy queries to small models. |
On top sits the accounting layer, per the post: measure cost per completed task, not token price. A $2 workflow that finishes the job is cheaper than a $0.40 workflow that must be run three times.
Is the viral 300-bot story trustworthy?
The post opens with a viral story: a 16-year-old student running 300 bots for under $0.02 per bot per week, while the usual way would burn $4,500 per week, with 3,646 saves. The author states upfront: he could not verify those two figures — no name, no repo, no source; "it is a hook". But the 20 repos that post listed are real, and he checked each one — and one of them self-reports cutting 60–90% of tokens on common dev commands, with 86,944 stars. This rewrite records exactly the certainty level the author himself stated: the viral figures unverified, the repos real, the token-cut figure the repo's own claim.
Apply now: check your most recent task log
The post ends with a check that costs nothing extra: open your most recent task log and count what percentage of input tokens are repeated content. That is where your money sits. From the 4 layers above, the application order per the post is: filter before reading, reuse before generating, check for changes before re-running, block loops — and measure cost per completed task, not per token price.
Frequently asked questions
1. Why does an agent cost more tokens than an ordinary chatbot? According to the post, each step of an agent resends the full conversation history, so the same context is charged repeatedly and grows longer after each step — cost grows with the square of the number of steps.
2. Does switching to a cheaper model fix the bill? According to the post, no: you only lower the price of one unit, while the number of token units still grows with the square of the number of steps.
3. Which layer saves the most with long logs and documents? According to the post, layer 1 — filter before reading: convert documents to clean markdown, retrieve only the relevant chunks; e.g. a 4,000-line build log, of which the model needs only the 12 error lines.
4. How do periodic polling jobs waste money? According to the post, a job running every 5 minutes to ask "anything new?" costs 288 times a daily job, and the answer is almost always nothing — so push the check out of the model and run it in code.
5. Is the "300 bots under $0.02 per bot per week" figure real? The post's author states clearly he could not verify those two figures — no name, no repo, no source. He only confirms the 20 listed repos are real and that he checked each one.
Source: post by Hoang Viet AI in the comailo group (18/11/2026). All figures, examples, and claims in this article follow the post and have not been independently verified by Wotech; the certainty level of each figure is recorded as the author himself stated it.
Bài viết liên quan

18 tháng 11, 2026 · 6 phut doc
FPT Software Chairwoman: US Clients No Longer Want to Pay by the Hour, Company Shifts to Outcome-Based Pricing
Artificial intelligence is forcing FPT Software to transform its traditional software outsourcing model: large clients in the US now apply 100% outcome-based payment, and the company expects the Time…

18 tháng 11, 2026 · 6 phut doc
Meta Expands Muse to Australia: The 6th Country, Real-Time Voice, and Local App Integrations
On 17/11/2026, Meta expanded Muse to Australia — the 6th officially supported country, just over 2 months after its US launch. According to a post by Hồ Hoàng Tiến (18/11/2026), the notable point is …

18 tháng 11, 2026 · 6 phut doc
Anthropic AI Safety Staffer Predicts: By Late 2027, AI Will Match or Beat the Best Experts in Nearly Every Field
While many still debate whether AI can replace Junior Developers, a person working on AI safety inside Anthropic has made a far more sweeping prediction: in only about 1.3 years, AI could reach the l…