Compare

Neurouter code mode and Cloudflare Code Mode

Cloudflare's Code Mode turns MCP tools into a TypeScript API that runs in Workers isolates. How Neurouter's governed Python code mode compares.

Last checked: 2026-11-26 · Markdown

Both approaches start from the same observation: instead of calling tools one at a time, let the model write code that calls them. Source for Cloudflare: Code Mode: the better way to use MCP, Cloudflare blog post by Kenton Varda and Sunil Pai, published 2025-09-26, checked 2026-11-26. Cloudflare's product may have changed since that post; check its current documentation.

What the post describes

  • MCP tools are converted into a TypeScript API with doc comments; the agent sees a tool that runs TypeScript and writes code against that API (part of Cloudflare's Agents SDK).
  • The code runs in a sandbox built on V8 isolates in Cloudflare Workers, using the Worker Loader API to load code on demand; a fresh isolate can be created per snippet.
  • The sandbox has no general internet access: fetch() and connect() throw. It reaches MCP servers only through bindings, which the post describes as "an already-authorized client interface", so API keys stay out of the generated code.
  • Claimed benefits: models handle more complex tools as a TypeScript API, chained calls skip passing intermediate results through the model, and isolates start quickly.
  • At the time of the post, the Worker Loader API was in closed beta for production use, and the whole generated API was loaded into the agent's context.

How the approaches differ

Cloudflare Code Mode (per the 2025-09-26 post)Neurouter code mode (v0.1 design)
LanguageTypeScriptA restricted Python subset (docs)
Where code runsV8 isolates on Cloudflare WorkersThe Monty interpreter in a separate executor process, self-hosted
CredentialsHeld outside the sandbox; bindings are pre-authorizedHeld by the server; scripts call functions only (docs)
Network from the sandboxNo fetch()/connect()No network in the language; on Kubernetes, egress denied for the executor (docs)
What a call goes throughThe binding to the MCP serverThe full policy pipeline per inner call: ACL, read-only, policies, rate limits, audit (docs)
WritesNot covered in the postDry run with planned changes; prod writes bound to the plan the user confirmed
Tool discoveryWhole API in context (per the post)search_tools returns signatures on demand
Measuring the effectNot covered in the postEvals run tasks in tool mode and code mode and recommend one (docs)

When to choose which

  • Choose Cloudflare's Code Mode if you build agents on Cloudflare's Agents SDK and want TypeScript sandboxes on Cloudflare's platform.
  • Choose Neurouter if you want code mode for your own API, self-hosted, with each inner call governed and audited, writes dry-run first, and evals that show whether code mode actually helps for your API.