Code Mode in production: "26 tool calls, one script, $0.02" prices the end of the tool loop

Ongoing story : MCP : la plomberie des agents devient un vrai marché· Part 4/4

BuildSubscribers only 1 h ago3Add to bookmarks

Code Mode in production: "26 tool calls, one script, $0.02" prices the end of the tool loop
Illustration : Léa Fontaine

Agent Swarm publishes the cleanest production measurement to date: Code Mode delivers a model-invariant ~99.2% dollar cost reduction versus the classic tool loop. Cloudflare (99.9% token cut) and Anthropic (98.7% on Drive→Salesforce) had promised it; it's now reproduced on real workload.

In plain terms. Instead of letting an agent guess which tool to call, turn after turn, you hand it a typed SDK and let it write a short script that orchestrates the calls. Result: ~99% fewer tokens, sensibly lower latency, and a bill that literally drops from $2 to $0.02 on a mid-size workflow.

Agent Swarm just published the clearest measurement to date: « 26 tool calls, one script, $0.02 ». On an identical production pipeline, the classic tool loop consumes ~1.17M context tokens to transport tool definitions and returns; Code Mode passes a typed SDK, lets the model write a TypeScript or Python snippet, and a V8 sandbox (at Cloudflare) executes it. The result isn't a projection: $0.02 measured, on a call model that cost $2+ in tool loop.

The figure reproduces two prior benchmarks. Cloudflare published a 99.9% token reduction (1,000 vs 1.17M) on its Workers runtime in April 2026. Anthropic measured 98.7% on the Drive→Salesforce scenario (150,000 → 2,000 tokens). The three experiments converge to ~2 orders of magnitude - independently of the model, since it's the context that explodes or not: the dollar reduction is model-invariant. Bonus: latency -30 to -40% (agent round trips removed).

Under the hood. The pattern replaces the loop « describe all tools → choose a tool → return result → restart » with two primitives: search(query) (find a tool or entity) and execute(script) (execute code that coordinates the calls). The typed SDK matters more than the primitive: it's what gives the model the API surface without having to re-describe it every turn. Mandatory sandbox (isolated V8 at Cloudflare, locked variants like Starlark elsewhere) - it's arbitrary code that runs on the gateway.

Limitations that the measurement doesn't hide: ultra-simple workflows (1-2 tool calls) don't benefit - the SDK prompt fixed cost dominates. The sandbox costs to run (isolate, quota, kill switch). Failures are more correlated: a faulty script breaks the entire pipeline, whereas a tool loop can recover step by step.

So what. The tool loop as we coded it in 2024-2025 no longer has a reason to exist for any non-trivial workflow. Orchestrators (LangGraph and competitors) will have to support the pattern or disappear from the price comparison. For teams running agents in production: measure your tokens/mission ratio over a month - if you're at 100k+ tokens per mission, the migration pays for itself in a week. MCP plumbing found its killer app.

Content reserved for members

Create a free account to access all our content and the weekly review.

Article produced by artificial intelligence, reviewed under human editorial control.

Our newsroom
Your Linux servers, as a desktop.
TermalOSSponsored
Ops, reimagined

Your Linux servers, as a desktop.

Agentless SSH monitoring, a full remote desktop and an AI ops copilot — no agents to install. Everything stays on your machine.

SSHMonitoringAI Ops
Get early access
Was this article helpful?

3 people liked this article

Like
A
Aiko NakamuraSenior software engineer
🇬🇧 Senior engineer, large-scale platforms. Writes about building with AI.
Share:
Comments (3)

Sign in to join the discussion.

Dr. Emily 23 Jul 2026 · 14:40

Wow, a 99.2% cost reduction is impressive! Curious to see how this scales for larger projects.

FilmBuffNYC 23 Jul 2026 · 14:39

This is a game-changer. I'm curious about the long-term sustainability of such a drastic cost reduction.

FoodieChicago 23 Jul 2026 · 14:27

99.2% cost reduction is impressive, but I wonder about the trade-offs in performance or flexibility.

Story timeline

MCP : la plomberie des agents devient un vrai marché

  1. 1Adaptive Recall: Agent's persistent memory becomes an MCP module13/07/2026
  2. 2Ant Group publishes its safety models for agents and multimodal systems13/07/2026
  3. 3Memory Heist: The persistent memory of an AI assistant becomes a stable attack surface15/07/2026
  4. 4Code Mode in production: "26 tool calls, one script, $0.02" prices the end of the tool loop23/07/2026
Your Linux servers, as a desktop.
TermalOSSponsored
Ops, reimagined

Your Linux servers, as a desktop.

Agentless SSH monitoring, a full remote desktop and an AI ops copilot — no agents to install. Everything stays on your machine.

Get early access
Topics
Explore
Information