Coding agents don't only write code now. They run it: they install packages, execute tests, start servers, and read the output to decide what to do next. That loop is what makes them useful, and it raises a practical question: where should that code run?
The problem with running agent code on your machine
The default answer is your own laptop. The agent gets a terminal, and every command it picks runs as your user, with access to your files, SSH keys, cloud credentials, and network.
Most commands are harmless. But the agent acts on text it didn't write: a README, an issue, a dependency's install script, a page it fetched. Any of these can carry instructions or code you wouldn't run yourself. And a mistaken rm -rf or a migration against the wrong database does the same damage when an agent typed it.
There are practical limits too. A laptop holds one environment at a time, goes to sleep in the middle of long tasks, and slowly fills up with leftover dependencies from every project an agent has tried.
What an AI agent sandbox is
A sandbox is a separate Linux machine the agent works in instead of yours. It starts clean, the agent does its work there, and when the task is done the machine is deleted with everything in it.
The boundary matters. Containers share the host's kernel, so they keep processes apart but not fully. A microVM runs its own kernel, which keeps code inside it separate from the host and from other sandboxes. For code you didn't write and haven't read, that is the boundary you want.
A sandbox also has to be a usable computer: a shell, common languages and tools, a filesystem, and a way to open a server the agent starts.
How an agent uses a sandbox
A typical task looks like this:
- Create a sandbox. It's ready in a few seconds.
- Clone a repository and install its dependencies.
- Run the tests or start the app, with output streamed back to the agent.
- Read files, change them, and run again.
- Delete the sandbox, or pause it to continue later.
Two controls make this safer:
- A network policy limits which hosts the sandbox can reach, so a script can't send data wherever it likes.
- A timeout stops the sandbox on its own if the agent leaves it running.
Connecting coding assistants through MCP
Most developers won't call a sandbox API themselves. Their coding assistant will. MCP (Model Context Protocol) is the standard way to give assistants like Claude Code, Cursor, and Codex new tools.
A sandbox MCP server gives the assistant tools such as "create sandbox", "run command", and "read file". You can then ask it to clone a repository and run the test suite in a sandbox, and it creates the machine, runs the commands, and reads the results. Your laptop only shows the conversation.
Running sandboxes on Keln
Keln, an inference platform for open models, now runs sandboxes next to its models.
- Each sandbox runs in its own microVM, with Python 3, Node.js, git, curl, and a C toolchain preinstalled.
- The default size is 2 vCPUs, 2 GiB of memory, and 10 GiB of disk, configurable from 1 to 4 vCPUs.
- Commands stream their output, files can be read and written, and a running app gets a preview URL.
- Pausing keeps files, memory, and processes. A sandbox stops after 5 minutes by default and can run up to 24 hours.
- A network policy sets which hosts it can reach.
- The hosted MCP server at
https://mcp.keln.ai/mcpconnects Claude Code, Cursor, and Codex with a Keln API key. It also includes web search and page reading. - Billing is per second for the vCPU and memory you allocate, from the same balance as model requests. Starting and paused sandboxes are free. See the pricing table.
To try it, the sandbox quickstart creates a sandbox and runs commands with Python or curl, and the MCP setup guide connects it to your coding assistant.
Top comments (0)