Case study · indie SaaS

How Two LangChain Agents Talked for $47,000

Four agents went into production. Two of them started chatting. Eleven days later the bill was $47,000 — and the worst part is how reasonable each individual API call looked. A story about loops, and why an alert is not a brake.

Profile photo of Paul Irolla

By Paul Irolla

Founder · AI & developer tools · Tokenade

Ph.D. in AI · builds token-optimization tooling for AI coding agents

View author page
6 min read
Cite this page

Eleven days of two robots agreeing to disagree

Picture the dashboard nobody was looking at. Two agents, deep inside a market-research pipeline, having the politest conversation in the history of software. One says: here is my analysis. The other says: looks good, but please verify this part. The first one verifies, expands, and asks for confirmation. The second one re-requests changes. Repeat. For eleven days. That is, almost verbatim, what engineer Teja Kusireddy described in a post on Medium and what TechStartups wrote up in November 2025. A multi-agent research tool, built on a perfectly ordinary open-source stack, slipped into a recursive loop and ran for nearly two weeks before anyone noticed. When they finally checked, the bill was $47,000. I find this case more instructive than the dramatic overnight-blowout stories, precisely because nothing dramatic happened. No bug, no crash, no rogue prompt. Two agents did exactly what they were told. That's what makes it worth eleven minutes of your time.

Four agents, one missing stop sign

The setup was sensible on paper. Four LangChain-style agents, each with a narrow job: Research, Analysis, Verification, Summary. They coordinated through agent-to-agent (A2A) messaging — the pattern everyone is excited about, where agents delegate, cross-check, and negotiate among themselves instead of waiting on a human. This is genuinely powerful. It's also a brand-new category of failure mode, and this team found it. The Analysis and Verification agents fell into a feedback loop that was, in the author's words, technically correct but logically infinite. Verification kept asking Analysis for one more pass. Analysis, being a diligent little machine, always obliged. Here is the part that should make every engineer who has shipped an agent slightly uncomfortable. Per the post-mortem, the system had no step limits, no stop conditions, no cost ceilings, no shared memory, no real-time monitoring, no alerting, and no orchestrator. The loop never broke because nothing was built to break it. The agents weren't malfunctioning. The governance was missing — which is a much harder thing to spot in a code review than a null-pointer.

Why a "harmless" loop becomes a five-figure invoice

So why does two agents chatting cost as much as a used car? The mechanism is the quiet, structural reason agentic coding bills explode, and it has nothing to do with the loop being wrong. Every turn of an A2A exchange is a fresh, stateless API call. When Verification sends its critique back to Analysis, that critique doesn't arrive on its own — it arrives bundled with the accumulated context: the original research, the prior analysis, the previous round of feedback, the instructions. The model has no memory between calls, so the entire context window gets re-sent every single time. Each polite "please verify this" re-ships everything that came before it. Now run that thousands of times. A loop firing a few calls a minute over 264 hours executes an enormous number of requests, and each one is a little fatter than the last because the conversation history keeps growing. This is the exact same dynamic I keep flagging in single-agent vibe-coding sessions, just with two agents feeding each other instead of one developer hammering enter. Input tokens, not output, are the thing eating the budget — the AI coding agent token cost data puts input at 80–90% of the bill, and a self-referential loop is essentially an input-token printing press. The cruel arithmetic: the unit cost that looked negligible in testing — a few cents a call — is catastrophic at loop scale. Nobody tests for 264 continuous hours. They test for five minutes, see a reasonable number, and ship.

The cost curve nobody was watching

What I find genuinely chilling is the shape of the escalation. This wasn't a cliff. It was a ramp, and the team's reported week-by-week breakdown reads like a textbook compounding curve:
WeekReported API cost
Week 1$127
Week 2$891
Week 3$6,240
Week 4$18,400
Week one was $127. If you'd seen that line on a dashboard, you'd have shrugged. Week two was $891 — annoying, not alarming. By week three it was $6,240, and the final stretch hit $18,400. The total damage came to $47,000 before they pulled the plug. The team had visibility gaps, not a visibility refusal — there were no cost-anomaly alerts, no cross-agent timelines, no token-usage monitoring. So the only thing that ever said "something is wrong" was the invoice. As Kusireddy put it, there is "a $47,000 lesson nobody's talking about: the infrastructure layer doesn't exist yet, and it's costing everyone a fortune." For a sense of scale in tokens: at Claude Sonnet pricing of $3/MTok input and $15/MTok output, $47,000 corresponds to somewhere in the neighbourhood of 13–15 billion input tokens — for a task that should have produced a single market-research report. That is the entire works of English literature, re-read thousands of times, so two agents could keep agreeing to look at it again.

What a token efficiency layer would have changed (ESTIMATE)

Let me be precise about what optimization fixes here, because it is not everything — and I'd rather be honest than oversell. A token efficiency layer does not invent a stop condition. If two agents are determined to loop forever, you still need a hard iteration cap or a budget ceiling to end the conversation. That is a governance fix, and the post-mortem is right that it was the primary failure. What a token layer does change is the slope of the curve — and that is where the money is. The loop's cost grew because every turn re-shipped the full, accumulated context. Prompt caching on the stable prefix, context compression on the conversation history, and filtering verbose tool output instead of folding it wholesale into the next prompt — these are the levers covered in the token reduction guide, and they attack exactly the input tokens that ballooned here. A conservative estimate: apply a 40–50% input-token reduction to the same loop, and the bill scales down proportionally, because input was the overwhelming majority of it.
ScenarioReported / estimated total
Baseline (as reported)$47,000
40% input reduction≈ $28,000
50% input reduction≈ $24,000
That 40–50% range is what independent benchmarks cite for caching plus context compression on long, repetitive sessions — and a self-referential A2A loop is the most repetitive session imaginable. Estimated saving on this incident: roughly $19,000–$23,000, with the assumption stated plainly: same loop, same eleven days, just leaner tokens per turn. But here is the better point, and it's the one I'd actually put on the slide. A loop running half as expensively also trips a budget cap half as fast in dollar terms and twice as slowly in time — buying you more days to notice before the number gets scary. Efficiency and governance aren't competing fixes. They compound. The LLM API token pricing doesn't cap on its own; you have to bring both the brake and the smaller engine.

The lesson: an alert is not a brake

The thing I want you to take from this isn't "multi-agent systems are dangerous." They're not. It's that a dashboard you have to look at is not a control, and a unit cost you measured for five minutes is not the cost you'll pay for eleven days. The $47,000 was the price of assuming "it's working" because nothing said otherwise. Two fixes, and you need both. Put a hard ceiling on iterations and spend so the loop ends. And put a token efficiency layer in front of the API so every turn costs less — which slows the curve and widens the window where a human can still step in. Tokenade is the second half of that. It sits between your agents and the API — caching stable context, compressing conversation history, filtering tool output — so a long-running loop doesn't re-ship your entire history on every turn. You can run your own numbers on the token cost calculator: what a multi-turn agent workload costs today, and what a 40–50% input reduction looks like in cash. Free up to approximately 10 million tokens saved. Start free — no card required.

Ranked #1 on the Token-Harness Optimizer Leaderboard.

Tokenade ranks #1 in the Token-Harness Optimizer Leaderboard — an end-to-end benchmark of agent token optimizers measured on real coding sessions. Set it up once, it works on every prompt. Works with Claude Code, Cursor, Codex, Copilot & more.

Profiles are sourced from public statements, podcast interviews, Twitter/X posts, and Indie Hackers / Reddit threads cited inline. No private claims; if you spot a factual error, contact [email protected].