Consuloji: Deep Dives into Overseas AI日本語

Why Unifying Agent Tools into a Single Execution Environment Yields Vastly Different Token Reductions (98.7% vs. 37%): A Rigorous Audit of Code Mode and MCP Architecture

Published: November 3, 2026

Listen or watch on YouTube

A technical and architectural analysis of primary documentation from Philipp Schmid, Cloudflare, and Anthropic on programmatic tool calling, sandboxing overhead, and context window economics.

Japanese Edition: Read the original Japanese article on Substack

Video Episode (Japanese Audio): Watch on YouTube

Disclaimer: This publication provides objective technical, architectural, and governance analysis. It does not constitute commercial endorsement or operational warranties.


Executive Summary & Core Engineering Thesis

Across developer communities building autonomous agent workflows, consolidating dozens of structured API schemas into a single code execution tool (exec)—widely referred to as Code Mode or Programmatic Tool Calling—has gained significant traction. However, public discussions frequently conflate opinionated forecasts with empirical measurements, creating unrealistic expectations regarding operational savings.

  • The Core Divergence: Two widely cited efficiency benchmarks measure fundamentally different architectural phenomena. Anthropic’s 98.7% token reduction (150,000 to 2,000 tokens) measures the lazy on-demand loading of tool schema definitions into context. In contrast, Anthropic’s 37% token reduction (43,588 to 27,297 tokens) represents the average savings achieved by omitting intermediate tool outputs on complex multi-step research benchmarks. They cannot be averaged, ranked, or conflated.
  • The Hidden Infrastructure Overhead: Unifying tools into an execution runtime is not an architectural free lunch. Moving from deterministic JSON tool invocation to arbitrary code generation requires rigorous sandboxing (e.g., QuickJS, isolated-vm, gVisor), resource quotas, network isolation, OAuth token proxying, and human-in-the-loop review for destructive actions—operational burdens that direct tool calling avoids entirely.
  • Actionable Decision Framework: Before adopting Code Mode, organizations must verify three empirical preconditions: (1) whether tool definitions currently exhaust context limits, (2) whether intermediate outputs actually require model inspection, and (3) where authentication secrets and destructive boundaries are held.

Slide 01: Auditing the empirical foundation of single-tool code execution


1. Primary Sources and Verification Methodology

To decouple verified technical facts from engineering opinion, this analysis audits five primary public documents retrieved on November 3, 2026:

  1. Philipp Schmid’s Article: “Why Agents Are Soon Only Going to Have 1 Tool” (Published November 1, 2026).
  2. Cloudflare’s Engineering Post: “Code Mode: Why LLMs are better at writing code to call MCP” (Published September 26, 2025).
  3. Anthropic Engineering Article: “Code execution with MCP” (Published November 4, 2025).
  4. Anthropic Technical Overview: “Advanced tool use: Programmatic tool calling and Tool Search” (Published November 24, 2025).
  5. Author Professional Disclosure: Philipp Schmid’s personal profile (Google DeepMind, formerly Hugging Face).

Every quantitative figure in this report specifies the exact measurement scope, unit, and baseline conditions. Unverified third-party claims are explicitly categorized as self-reported or unconfirmed.

Slide 02: Three critical verification questions


2. Deconstructing the “Single Tool” Hypothesis: Opinion vs. Measurement

The Mechanics of Traditional vs. Code Mode Agent Architecture

Traditional agent frameworks operate on turn-by-turn discrete tool execution:

  1. The model emits structured JSON describing an operation.
  2. The runtime invokes the tool and returns the raw output.
  3. The runtime appends both the tool call and output into conversational history.
  4. The model re-evaluates the entire conversational context to determine the next action.

As agents scale to dozens of MCP servers, two distinct bottlenecks emerge: Schema Context Bloat (dozens of JSON schemas consume substantial context tokens before work begins) and Intermediate State Contamination (raw API responses, such as 50KB search results or SQL dumps, permanently occupy downstream context).

Code Mode resolves these friction points by presenting the model with a single runtime interface (exec). The model synthesizes concise TypeScript or Python scripts that orchestrate multiple dependencies inside an isolated execution container.

// Minimal illustrative concept of programmatic tool calling
async function updateWorkspaces() {
  const issues = await jira.getOpenIssues({ filter: "high-priority" });
  const summaries = issues.map(i => ({ id: i.id, title: i.summary }));
  await linear.syncIssues({ batch: summaries });
  return `Synchronized ${summaries.length} issues successfully.`;
}

Auditing Philipp Schmid’s Editorial Claims

Philipp Schmid’s November 1, 2026 post popularized the narrative that agents will soon converge on a single tool. A rigorous textual and lexical audit of the post establishes several foundational boundaries:

  • No Original Empirical Datasets: The post contains zero original measurements. Lexical searches across the article body for measure, evaluation, and average yield zero results. The provided code snippets are explicitly marked as “Pseudo-code” and a “minimal, runnable pseudo example” using Gemini API wrappers.
  • Third-Party Self-Reporting: The post cites a single operational data point: “Factory switched Droid 1.0 to Code Mode, improving their Terminal-Bench 4 accuracy by +3.5 points and cutting model spend by 15%”. However, the article provides no direct citation or link to Factory’s formal technical disclosure (linking only to Factory’s marketing homepage). Without access to the underlying experimental logs, this datapoint must be treated strictly as unverified self-reporting.
  • Authorial Caveats: Crucially, Schmid himself tempers the sensationalist headline: when answering whether all agents will soon possess only one tool, he writes, “Not necessarily”. He notes that existing tool ecosystems and CLI utilities built for shell execution (bash) lack the strong typing required for reliable programmatic invocation.

Slide 03: Editorial opinion vs. empirical verification


3. The 98.7% vs. 37% Divergence: Auditing Anthropic’s Dual Benchmarks

Where do the publicized reduction percentages actually originate? Tracing the chronological publications reveals that they measure two entirely distinct architectural mechanisms.

Metric & Figure Primary Source & Date Exact Measurement Target Underlying Experimental Conditions
150,000 → 2,000 tokens (98.7% reduction) Anthropic (Nov 4, 2025) “Code execution with MCP” Schema Definition Injection: On-demand loading of tool definitions vs. loading full tool catalogs. Specific illustrative scenario; model version, tool volume, and task sampling counts omitted.
43,588 → 27,297 tokens (37% reduction) Anthropic (Nov 24, 2025) “Advanced tool use” Intermediate Context Omission: Suppressing intermediate API outputs during complex multi-step research. Empirical average across specialized multi-step research benchmark tasks.
+3.5 pts accuracy, -15% spend Factory (cited by P. Schmid, Nov 1, 2026) Terminal-Bench 4 task resolution and billing expenditure. Self-reported anecdotal claim; original benchmark logs not publicly provided.

Mechanism A: The 98.7% Reduction (Definition Pruning)

In Anthropic’s November 4, 2025 article, the 98.7% reduction describes an architectural pattern where an agent reads tool schema definitions on demand from a filesystem or index, rather than dumping all available MCP server schemas into the initial prompt context.

If an enterprise workspace connects 50 MCP servers, each containing 5 tools with extensive parameter descriptions, schema overhead can easily exceed 150,000 tokens. By allowing the agent to inspect directory listings and require only the 2 specific tool definitions needed, context drops to 2,000 tokens. This reduction has zero correlation with task intermediate data; it is purely schema catalog filtering.

Mechanism B: The 37% Reduction (Intermediate Result Filtering)

In Anthropic’s November 24, 2025 article, the 37% reduction reflects empirical averages on complex research tasks. When an agent queries databases or web APIs across 20 sequential operations, standard tool calling forces 19 full inference round-trips, accumulating intermediate JSON payloads into conversation history.

With programmatic tool calling, loop iterations, filtering, and data transformations execute inside the code runtime. Only the final aggregated summary is returned to the model context. On complex research tasks, this architectural pruning reduced average consumption from 43,588 to 27,297 tokens (a 37% decline).

Conclusion: Conflating 98.7% and 37% into a single narrative of “Code Mode saves 90% of tokens” is factually invalid. One measures schema pruning; the other measures runtime state filtering.

Slide 04: Dissecting the two distinct token reduction mechanisms


4. The Security, Isolation, and Operational Tax of Code Execution

The fundamental trade-off that advocates of Code Mode routinely omit is the shifting of operational risk. In traditional tool calling, the host application executes fixed, deterministic functions. In Code Mode, the host must execute untrusted, dynamically generated code.

Slide 05: Ownership of isolation, authentication, and governance

The Three-Layer Sandboxing Imperative

All three technical disclosures (Cloudflare, Schmid, and Anthropic) align on one critical reality: sandboxing is mandatory.

  1. Complete Network Isolation: Cloudflare’s architecture executes TypeScript within isolated Workers containers severed from the public internet. The runtime communicates exclusively via pre-configured TypeScript bindings representing trusted MCP endpoints.
  2. Secret Masking & OAuth Encapsulation: Authentication credentials, API keys, and OAuth bearer tokens must never be exposed to the generated script or model context. The host runtime injects headers outside the sandbox boundary.
  3. Execution Safety Boundaries: Philipp Schmid’s technical notes emphasize utilizing hardened JavaScript runtimes like QuickJS or isolated-vm to enforce strict CPU cycle limits, heap memory caps, and execution timeouts.

The Explicit Warning from Anthropic

Anthropic’s official documentation explicitly warns engineering teams against naive adoption:

“Running model-generated code requires a secure execution environment with proper sandboxing, resource limits, and monitoring. These infrastructure requirements add operational complexity and security considerations that direct tool calling does not.”

The cost of designing, provisioning, monitoring, and auditing secure multi-tenant execution sandboxes is substantial. These infrastructure expenditures are not factored into the headline token reduction metrics.


5. Decision Framework: When to Deploy Programmatic Tool Execution

Organizations evaluating whether to migrate existing agents to Code Mode should audit three operational criteria before writing infrastructure code.

Slide 06: Pre-implementation verification checklist

Criterion 1: Tool Schema Density vs. Context Capacity

  • High ROI: Workspaces exposing 30+ tools where schema definitions alone exceed 20% of the active context window.
  • Low ROI: Systems with 3 to 8 specialized tools where schemas consume negligible tokens (<3,000 tokens). Direct JSON tool calling remains simpler, faster, and substantially safer.

Criterion 2: State Flow and Intermediate Data Inspection

  • High ROI: Workflows characterized by deterministic chaining (e.g., fetch 1,000 records from Database A, filter by timestamp, extract top 5 IDs, fetch details from Database B). The intermediate 1,000 records never touch the model context.
  • Low ROI: Tasks where the model must examine qualitative nuances across every intermediate output to decide subsequent strategy (e.g., investigative reasoning, interactive text editing). Programmatic aggregation provides minimal value if intermediate inspection is necessary.

Criterion 3: Strong Type Definitions in Tool Contracts

Code Mode requires programmatic predictability. If connected tools emit arbitrary untyped payloads, generated scripts fail with runtime exceptions, forcing the model into expensive self-correction loops. Adopting Code Mode requires investing in rigorous OpenAPI/JSONSchema contracts with explicit return types.


6. Implementation Architecture & Governance Blueprint

For engineering teams committing to programmatic execution, the recommended reference architecture enforces strict separation between model generation, sandbox execution, and external resource gateways.

Slide 07: Reference enterprise governance architecture

  1. Host-Managed Authentication: All API tokens reside in secure key vaults. Sandboxed scripts call abstract proxy interfaces (mcp.jira.query()) without visibility into raw credentials.
  2. Human-in-the-Loop Interception: Destructive mutations (e.g., DELETE, DROP TABLE, large-scale external email dispatch) trigger asynchronous execution suspension, prompting explicit human approval before sandbox resumption.
  3. Deterministic Audit Logging: The host platform records every synthesized script, input parameter, sandbox resource metric, and return payload for compliance and security auditing.
  4. Empirical In-House Benchmarking: Rather than relying on external marketing percentages, organizations must evaluate identical task sets with and without code execution to measure true net token variance, latency impact, and error rates.

Conclusion: The Three Questions Every Engineering Lead Must Ask

Unifying agent tools into a single code execution interface is a legitimate, high-leverage architectural optimization for specific high-volume, data-heavy enterprise workflows. However, it is not an inevitable or universal replacement for structured tool calling.

Slide 08: Summary of core verification principles

Before modifying agent orchestration code, verify three questions:

  1. What is being reduced? Are you solving for schema definition bloat (98.7% scenario) or intermediate result filtering (37% scenario)?
  2. Does your workload require intermediate reasoning? If the model must read intermediate data to reason, Code Mode yields negligible token benefits.
  3. Who owns sandboxing and credentials? If your team cannot support secure, sandboxed execution runtimes with external secret proxying, the operational risks far outweigh token cost reductions.

Verification & Fact-Check Audit Matrix

Verification Vector Primary Document Finding Operational Caveat & Boundary
P. Schmid “1 Tool” Claim Published Nov 1, 2026; contains editorial hypotheses and pseudo-code. Author explicitly notes “Not necessarily” in conclusion; no benchmark logs included.
Anthropic 98.7% Reduction Published Nov 4, 2025; demonstrates lazy loading of tool schema definitions. Measures schema context reduction (150k -> 2k), not operational payload processing.
Anthropic 37% Reduction Published Nov 24, 2025; averages token drops on complex research tasks. Measures intermediate output filtering across multi-step dependency chains.
Cloudflare Code Mode Published Sept 26, 2025; executes TypeScript via Worker bindings. Requires zero-trust network isolation and strict proxying of external APIs.
Factory Benchmarks Cited as +3.5 accuracy, -15% spend on Terminal-Bench 4. Unverified self-reporting; primary evaluation logs not publicly accessible.

Primary References

  • Philipp Schmid, “Why Agents Are Soon Only Going to Have 1 Tool” (Nov 1, 2026).
  • Cloudflare Engineering, “Code Mode: Why LLMs are better at writing code to call MCP” (Sept 26, 2025).
  • Anthropic, “Code execution with MCP” (Nov 4, 2025).
  • Anthropic, “Advanced tool use: Programmatic tool calling and Tool Search” (Nov 24, 2025).
  • Model Context Protocol (MCP) Open Specification (modelcontextprotocol.io).

Back to articles