How to sandbox a computer use agent

Anthropic and OpenAI both hand you the agent and tell you the machine is yours. Six measures, in the order they are worth doing, drawn from what the agents here and their documentation point at.

Photo: Bench Accounting / StockSnap, CC0

If you are building on a computer use API, the hardest part of the job is not the model. It is the machine the model drives. Anthropic's own documentation says nothing runs on its side; OpenAI's says to keep the environment in an isolated browser or VM. In both cases you have been handed a capable agent and told the sandbox is yours. This is a practical guide to building one.

It is not a security audit and it does not replace one. It collects the measures that the agents in this directory and their documentation actually point at, in the order they are worth doing.

Start from what the agent is wrong about

The design question is not "how do I stop the agent making mistakes". It will make them. The question is what it can reach when it does. An agent that has been misled by a page, an email or a document behaves exactly as if it had been given those instructions by you. So every control below is a way of shrinking what a misled agent can touch, rather than a way of making it less likely to be misled.

That framing comes straight from the research. Prismata, a cross-site prompt injection defence, works by contextual least privilege: it constrains both what the agent sees and what it can do, mechanically, instead of asking the model to resist (Prismata proposes least privilege for web agents). Defences that live in the harness are the only kind an integrator can deploy, because you cannot retrain the model.

1. Give it a machine that holds nothing

The single most effective step. Run the agent in a disposable virtual machine or container with no personal files, no saved logins and no network access beyond what the task needs. If it is misled there, it is misled in a room with nothing in it.

This is the problem Cua exists to solve: macOS virtual machines and Linux containers for agents to work in, so that the sandbox is infrastructure rather than an exercise for the reader. OpenAI's integration recipes for its Computer use tool tool cover both a Playwright browser and a Docker virtual machine with a full desktop. Whichever route you take, the property to aim for is that destroying the machine and starting another is routine.

One caution from the same source applies to every project in this list, not just that one. Cua is not uniformly MIT-licensed, several of its packages are marked deprecated, and the project says outright not to run one of its own packages, cuabot, because of known security issues. Read the repository's warnings before adopting any sandbox.

2. Narrow the network

An agent that can reach the whole internet can also be told, by hostile content, to send something to a place of an attacker's choosing. Allowlist the hosts the task requires and deny the rest. For a browser task this is a smaller list than people expect.

The browser layer itself is moving this way. Cloudflare's Kitesurf, a browser runtime built for agents rather than people, is designed on the assumption that every page load is untrusted input and every session starts fresh, with each component given access only to what it strictly needs (Cloudflare ships a browser built for agents rather than people). It is in beta and it is not an agent, so it is not a recommendation. It is a sign of where the sandbox boundary is being drawn.

3. Leave the dangerous switches off

Some of the capabilities that make an agent flexible are also the ones that make compromise cheap, and the better vendors default them off. Claude Browser Use is the example: JavaScript execution, file upload, console reading and network reading are all off by default, for good reason. Turn them on only for a task that cannot be done without them.

The same logic cuts the other way for tools that default to permissive. OpenClaw's documentation is blunt: tools run on the host for the main session unless you configure sandboxing, so reading that setting is the first thing to do before pointing it at anything sensitive. Open Interpreter holds model-written code for approval by default, but its -y and auto_run options bypass that. A flag that exists to save you clicks is a flag that removes a human from the loop.

4. Separate identity from the machine

Do not run the agent signed in as you. A browser profile with your cookies is every account you have stayed signed in to, which is why an agent on your real browser is not meaningfully confined to a tab. Give it a separate profile, or better a separate account, with only the permissions the task needs and nothing that can move money or send messages on its own.

For anything that touches the real machine, as Personal Computer and Meta Muse do, this means a separate user account, not just a separate window. The The agents got their own computers analysis explains why that arrangement carries the worst worst-case: there the sandbox is your laptop.

5. Keep a human on the irreversible step

Most consumer agents are built to stop before payment and hand back to you, and the use-case pages treat that as a requirement. Any agent that does not should worry you. Meta says Muse asks for approval before destructive steps such as deleting files or sending messages. Build the same pause into your own loop: the agent drafts, a person sends.

Triaging an inbox is the case that makes this concrete. Email is untrusted text written by strangers, delivered into the agent's context, inside an application that can send messages as you. Scope the credentials so the agent can draft and cannot send, and the worst outcome becomes a bad draft.

6. Record what it did

You cannot review what you did not capture. Log every action with a screenshot taken at that moment. It costs little, it turns an opaque failure into something you can diagnose, and it is the only way to tell afterwards whether an agent was misled or merely wrong. Dots let you open the agent's computer at any time to check its work, for the same reason (OpenAI gives each agent its own computer).

A short checklist

  • Disposable machine, no personal files, no saved logins.
  • Network limited to an allowlist of hosts.
  • Risky tool switches off unless the task needs them.
  • A dedicated identity with minimal permissions.
  • A human approving anything irreversible.
  • Every action logged with a screenshot.

None of these is a guarantee, and a sandbox built to this list is not the same as a sandbox that has been tested. Treat the list as the minimum to have in place before the first run, then try to break your own setup the way a hostile web page would.