What Is Codemode
AIThis post was created with the assistance of artificial intelligence (AI).

TL;DR

Prime Big Deal Days · Oct 6–7Offer from Amazon

Get the latest gadgets delivered free — and shop member deals

  • Fast, free delivery on millions of items
  • Access to Prime Big Deal Days deals on October 6–7
  • Prime Video, Amazon Music and more included
Start your free Prime trial Free trial for eligible customers · Cancel anytime
As an affiliate, we earn on qualifying purchases.

Pi 1.0 adds support for the Model Context Protocol through Codemode, a way for an AI agent to write JavaScript that coordinates tool calls. Pi’s creator Armin Ronacher says Codemode runs in a restricted sandbox on the harness side, separate from the environment where commands execute. Its practical effects and security properties beyond the described setup have not been independently established in the source report.

Pi 1.0 has added Model Context Protocol (MCP) support through Codemode, a mechanism that lets an AI agent write JavaScript to coordinate calls to tools, rather than making every operation a separate direct call from the model. In a report published October 6, 2026, Pi creator Armin Ronacher says Codemode runs in a restricted sandbox on the harness side—the system coordinating the model—distinct from the execution environment where commands such as bash run. The design matters because it offers agents a way to combine tool operations while keeping the coordinating code in a separate environment.

Ronacher describes Codemode as a way for an agent to issue and compose tool calls from JavaScript. Instead of having the model call a tool, receive its output in the conversation, and decide what to do next, the agent can write a script that makes several calls and processes their results. This can support concurrent operations and workflows, and can reduce how much intermediate output must pass through the model’s conversational context.

In Pi, Codemode runs in QuickJS inside a WebAssembly runtime, according to Ronacher. He says the environment has no network access or file system, no timers, and limited memory; its available route to carry out work is to call other tools. Codemode therefore does not replace the execution environment. The report distinguishes the harness, which coordinates the model and runs Codemode, from the “hands,” where commands and other operations execute.

Ronacher gives several examples of why that split can be useful. A script can inspect a small sample of tool results, then process a larger set; it can also preserve state for a later Codemode call in the same session. In Pi, the interface exposes some capabilities—such as image generation and one-shot text classification—through Codemode rather than ordinary tools. The report says Codemode is enabled by default in Pi when MCP is enabled, and can also be turned on through a settings option.

At a glance
reportWhen: Described October 6, 2026; Pi 1.0 MCP s…
The developmentArmin Ronacher describes Codemode, the mechanism Pi 1.0 uses to add MCP support by letting agents orchestrate tool calls through JavaScript.
Top Steam deals right now
The Outlast Trials-90%$3.99
The Elder Scrolls V: Skyrim Special Edition-90%$3.99
Warhammer 40,000: Space Marine 2-75%$14.99
Red Dead Redemption 2-75%$14.99
Cyberpunk 2077-70%$17.99
How to Fish-38%$4.95
Project Zomboid-33%$16.74
Baldur’s Gate 3-30%$41.99
Live · Steam store (current discounts)

How Scripted Calls Change Agent Workflows

Codemode addresses a practical limitation of tool-based AI workflows: a model may need to coordinate several operations, but passing every result back through its conversational context can consume space and complicate the process. By letting a script make calls and handle their outputs, Codemode can keep intermediate work outside the conversation, while leaving the agent able to act on the processed results.

The distinction between the harness and the execution environment also matters for people deploying agents. Ronacher says the two can have different file systems and trust levels. For example, sandboxing bash does not, by itself, sandbox the harness. Pi’s separate Codemode sandbox is described as intentionally limited, but the report does not establish a general security guarantee or provide an independent evaluation. Users should treat those boundaries as design details to understand, not as proof that every risk is removed.

Amazon

JavaScript sandbox environment

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

From MCP Debate to Pi 1.0

Ronacher frames the feature as a change in emphasis from his earlier writing. More than a year before the October 2026 report, he had argued that developers should often use scripts rather than load custom tools or MCP servers into an agent’s context. He had also argued that MCP needed code. Pi 1.0’s addition of MCP support through Codemode brings those ideas together: agents can use a protocol for tool access while relying on scripts to coordinate operations.

His explanation also contrasts scripts with native tools. Shell commands can combine programs, but some capabilities need direct support from the harness. Ronacher cites reading images as an example: a multimodal model needs the harness to pass the image payload in the model’s protocol, rather than relying on a plain text command such as cat. He also points to orchestrating sub-agents as a task that can be awkward to handle through shell processes alone.

The name “Codemode” is credited by Ronacher to Cloudflare, which he says coined it. In Pi, JavaScript is the language used for the mechanism, though he says other languages could be used in principle. The account focuses on Pi’s implementation and examples; it does not describe Codemode as a universal standard or provide comparative performance results.

Amazon

WebAssembly runtime development tools

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

Limits and Security Questions

Ronacher’s report describes Pi’s intended restrictions, but it does not include an independent security review, measurements of memory use, or comparative tests showing how Codemode affects speed, accuracy, or context consumption. The consequences of storing session state in the harness are not explored in detail, including how long that data remains available or how it is managed.

The source also does not provide a full account of which MCP servers or operations are supported, or explain how permissions are handled for each tool. Codemode’s safeguards depend in part on the boundary between the harness and execution environment, but the report does not specify how that boundary behaves across different deployment setups. These details remain open in the material provided.

Amazon

AI tool orchestration software

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

Pi’s Use of Codemode

Ronacher’s report presents Codemode as part of Pi 1.0’s MCP support and describes ways users can enable it, but it gives no roadmap, rollout schedule, or planned milestones for later releases. For now, the next step for users is to check Pi’s settings and documentation for the available configuration and tool behavior, particularly when MCP is enabled.

Further technical documentation or independent testing would help clarify the security model, state handling, and performance trade-offs. Until those details are published, the firm account is limited to Ronacher’s description of Pi’s implementation: JavaScript runs in a restricted harness-side sandbox and can coordinate calls to tools in the execution environment.

Amazon

secure JavaScript execution environment

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

Key Questions

What is Codemode?

Codemode is a way for an AI agent to use JavaScript to coordinate tool calls. In Pi, it lets the agent compose operations and process results rather than relying only on individual direct tool calls.

Is Codemode the same as MCP?

No. Ronacher describes Codemode as the mechanism Pi uses to provide MCP support in Pi 1.0. MCP is the protocol support; Codemode is the script-based way of orchestrating tool calls in this implementation.

Where does Codemode run in Pi?

According to Ronacher, it runs on the harness side, in QuickJS within a WebAssembly runtime. He says that runtime has no network or file-system access, no timers, and limited memory.

Does Codemode replace bash or other tools?

No. Codemode coordinates calls to tools; it does not replace the separate execution environment where bash and other operations run. Some capabilities, such as image handling, also need support from the harness.

Is Codemode enabled by default in Pi?

Ronacher says it is enabled by default when MCP is enabled. He also says users can turn it on through Pi’s settings, using the “+codemode” option in the default tools configuration.

Source: hn

HALLOWEEN

Halloween Picks

As an affiliate, we earn on qualifying purchases.

You May Also Like

5 Reasons Why Imagine Image 2.0 Sets A New Standard In AI Innovation

xAI’s Grok Imagine Image 2.0, launched August 7, introduces advanced editing, multi-reference support, and improved text handling, redefining AI image tools.

Decoding ByteDance’s AI Roadmap For Autonomous Driving Innovation

ByteDance is considering a move into autonomous driving, but no official plans, investments, or timelines have been confirmed. Details remain uncertain.

Introducing GPT-6.1 Sol: What To Know About The AI

An OpenAI page is titled “Introducing GPT-6.1 Sol,” but available details do not confirm its capabilities, launch status, pricing or access.

A Skill Is a Folder, Not a Prompt: What Anthropic Learned Running Hundreds of Them

Anthropic reveals that effective AI skills are structured as folders containing instructions, scripts, and assets, transforming prompt engineering into institutional assets.