Why your AI tool should work in a box
ForClaude CodeCursor
Is this for you?
Tick anything that is true for you. If nothing is, you can skip this explainer.This applies to you. Go to the steps
What it is
An AI tool that builds your app on your computer does more than write text. It runs commands: it installs add-ons, starts your app, runs tests. Without limits, those commands run with your own access. The UK’s National Cyber Security Centre (NCSC) points out that an AI tool running on your computer may be able to use any login or key your own user account has.
A sandbox is a fenced-off space for those commands. They still run, but only reach the folders and websites you allow. The NCSC, writing for organisations, says to always run AI tools that act on their own inside a sandbox that controls what they can reach, both on the computer and over the internet.
Why not just approve every command? Simon Willison, writing on the blog of Prime Radiant, an AI research lab, calls that a terrible way to work: it is slow, and people soon approve everything without reading. Built-in safety checks help, he writes, but they still depend on an AI judging each step correctly. A sandbox does not depend on anyone’s judgment.
There are two reasons to want one. AI tools make mistakes. And they can be tricked: a web page or file the tool reads may contain hidden instructions that it then follows. Willison notes that cheaper models and models running on your own computer make more mistakes and are easier to trick this way.
How it works
A sandbox draws three lines. Files: commands may change your project folder, and the rest of your computer is off limits for changes. Internet: by default nothing goes out, and you list the websites commands may reach, such as the place add-ons are downloaded from. Keys: secret keys stay outside.
The NCSC describes the internet line as a ladder. At the bottom, a tool can reach any website. One step up, only a list of approved websites. At the top, nothing outside at all. It describes the walls the same way: none; a separate compartment on the same computer, which can still be broken out of; a separate virtual computer; and, strongest, a separate machine.
Keys are the clever part. Both the NCSC and Prime Radiant describe a go-between that adds the real key to a request on its way out, so the AI tool only ever sees a stand-in. Prime Radiant released free prototypes on 16 November 2026 that do this. They keep the AI tool itself outside the box and send only its commands in, which they call an external sandbox. They say the prototypes are experimental and not yet checked well enough for sensitive work.
You do not need their prototypes to start. Claude Code has a sandbox for the commands it runs. It is off until you switch it on, and its list of allowed websites starts empty. Cursor runs commands in a sandbox on Mac and Linux in its recommended mode, Auto-review. In its Run Everything mode there is no sandbox. Bolt is different: it runs your project inside your browser, so nothing it builds runs directly on your computer.
What to watch out for
Built-in boxes have gaps. Claude Code’s sandbox covers commands only. Its own reading and editing of files and its connectors to other services run outside it. By default, commands inside it can still read most of your computer, including files where keys are often kept, and they receive any secret keys Claude Code itself was started with, unless you block them.
The box can open. When a command fails inside it, both tools can run it again outside. Claude Code may ask you first, depending on your settings. Cursor passes the rerun to its own AI reviewer, and its documentation says that reviewer can make mistakes and is not a security boundary. Those requests are the moment the box opens, so read them.
The box may not be there. Claude Code’s sandbox runs on Mac, Linux and Windows through WSL2, a built-in way to run Linux on Windows; on plain Windows it runs commands without one. If the sandbox cannot start, Claude Code carries on without it unless you tell it to stop.
A box only keeps out what you leave out. Prime Radiant warns that anything in a folder the tool may change can still be damaged, so keep a save point. If you put your live database’s master key inside, or allow its website, the tool can still reach your real customers’ data.
What to tell your AI
What this is based on
We read these 5 sources and wrote this explainer from what they establish together. Each entry says what it contributed.
- External sandboxes for coding agents
Why approving every action fails (slow, leads to approving without reading); that built-in checks still rely on a model judging each action, while a sandbox does not; that cheaper and local models make more mistakes and are easier victims of hidden instructions; the external sandbox pattern, with the AI tool outside and its commands inside; credential replacement with a stand-in key; no internet by default with a list of allowed sites; the release of three free prototypes; that they are experimental and not audited for sensitive work; and that a folder the tool may write to can still be damaged. Willison’s own link post of 17 November 2026 (https://simonwillison.net/2026/Nov/17/external-sandboxes-for-coding-agents/) was the lead.
The post introduces the authors’ own free sandbox prototypes. Prime Radiant is an AI research lab.
- Managing the cyber risk of agentic AI
That AI tools acting on their own should always run in a sandbox controlling what they can reach locally and over the network; to block all network traffic by default and allow only what is needed; the four levels for network access and for isolation, including the residual risk of breaking out of containers; that a tool without isolation may use the credentials of the user account it runs under; and that a proxy can inject credentials without exposing them to the tool. Written for system designers and operators in organisations.
- Configure the sandboxed Bash tool
That the sandbox is off by default and turned on with /sandbox; that it covers shell commands only, while file tools and MCP servers run outside it; that sandboxed commands can write to the working directory, can by default read most of the machine including credential files, inherit environment variables including secrets, and have allowed domains that start empty; the credentials, allowUnsandboxedCommands and failIfUnavailable settings; the unsandboxed retry and who approves it; that it runs on macOS, Linux and WSL2, unsandboxed on native Windows; and that it runs commands without the sandbox if it cannot start.
Anthropic sells Claude Code, an AI coding tool named in this explainer.
- Run Modes
The three run modes and that Run Everything has no sandbox; that Auto-review sandboxes shell commands when it can and is not a security boundary; that a command failing in the sandbox can be rerun outside it after the classifier reviews it; the sandbox on macOS and Linux; network blocked by default except a default list of package sites; and the Read Access setting (System by default, Workspace to ask first; Cursor 3.23 or later) under Settings > Agents > Approvals & Execution.
Cursor sells the AI code editor named in this explainer.
- FAQs
That Bolt runs on WebContainers, a full development environment that runs directly in the browser, with nothing to install.
Bolt sells the AI app builder named in this explainer.