# What is Codemode

DevFeed: [What is Codemode](<https://devfeed.tech/articles/what-is-codemode-65862.md>)

Original publisher: [Read original article](<https://lucumr.pocoo.org/2026/10/6/codemode/>)

Author: Armin Ronacher

Published: 2026-10-06T00:00:00Z

Content type: article

Language: en

Sources: [Armin Ronacher](<https://devfeed.tech/sources/armin-ronacher.md>)

Topics: [MSP MCP](<https://devfeed.tech/topics/msp-mcp.md>), [Agent Harness](<https://devfeed.tech/topics/agent-harness.md>), [AI Context Management](<https://devfeed.tech/topics/ai-context-management.md>), [llm-reasoning](<https://devfeed.tech/topics/llm-reasoning.md>)

Tags: [agent](<https://devfeed.tech/tags/agent.md>), [ai](<https://devfeed.tech/tags/ai.md>), [code](<https://devfeed.tech/tags/code.md>), [codemode](<https://devfeed.tech/tags/codemode.md>), [harness](<https://devfeed.tech/tags/harness.md>), [mcp](<https://devfeed.tech/tags/mcp.md>), [pi](<https://devfeed.tech/tags/pi.md>), [sockets](<https://devfeed.tech/tags/sockets.md>)

## AI overview

The article describes Codemode, a Pi feature that lets an LLM compose tool calls using JavaScript in a sandbox within the harness. It explains how this can support workflows such as concurrent tool operations, image generation, classification, and MCP server calls, while noting limitations around durability, binary data, and smaller models.

## Source excerpt

More than a year ago I wrote a few posts here that recommended people not to load custom tools into their context (or MCP servers) but to just use more scripts. Most importantly I wrote that Code Is All You Need and I wrote about that MCP needs code. With Pi 1.0 we now added MCP support via Codemode which in some ways is a long time coming, but then also maybe somewhat surprising to some. So I want to share some updated thoughts on this blog on what this all means. What Are Tools When a harness like Pi provides tools for an LLM to call, it does so by supplying some tool definitions which then translate into some token structure on the server side. Whether a model is encouraged to call a tool is the result of the reinforcement learning process. Something I wrote about before if you want to learn more. One of the reasons we strongly lean towards CLI and bash is because it allows easy composition of calls, and because the model also learns how the file system works when it's trained. So when it invokes a tool like echo foo > /tmp/test.txt the model also learns that after that tool call, there is now a file called test.txt in /tmp. However bash has one fundamental limitation which is that it can only compose programs that run. And there are some things, which are not programs, but native tools to the LLM and they sort of have to be. The most obvious example here is read or view_image. If a multimodal model needs to read an image, it cannot use cat for that because the harness needs to inject the actual image payload into the protocol of the LLM. Another quite vivid example are sub agents. In order to spawn and orchestrate sub agents, it's tricky to avoid tools that are provided by the harness. While in theory the agent could provide a CLI tool that talks to the outer harness via environment variables and Unix sockets, it's a rather crude process. It however has another issue, and that is where the code runs. Brains vs Hands To better understand that, it's important to t