Skip to content
mentoor

Topic 4 of 5 · 4 min read

Sandboxed machines for computer-use agents

Goal: Configure an isolated environment for a browser agent with a domain allow-list, no stored passwords and a point where a human takes over.

Run a computer-use agent on a disposable, locked-down machine that holds nothing you would mind losing, and give it a way to stop and call a human. Vendor docs for Claude, OpenAI and Gemini all advise a virtual machine or container, because the agent acts with whatever the machine can reach.

Check yourself · 1 of 3

Where should a computer-use agent usually run?

Choose one answer

Why it matters

If the agent runs on your laptop, in your browser, it can see your tabs, saved passwords and files. One injected instruction or one wrong click then has your whole account behind it. Isolation turns a possible disaster into a restart.

The parts of a safe setup

  1. A VM or container, not your own desktop. Create it fresh for the run and delete it after.
  2. A separate browser profile with no history, no extensions and no saved passwords or autofill.
  3. Minimal credentials. A dedicated account with the narrowest rights, signed in by a person for this run only. Never your admin login.
  4. A domain allow-list. The agent may reach only the sites the task needs. Block everything else at the network level, not just in the prompt.
  5. No sensitive files mounted into the machine.
  6. A takeover point. A step where the agent stops and a person can watch the screen, type a code or press the final button. Many setups expose the VM through a viewer for this.
  7. Limits. A maximum number of steps and a time limit, so a stuck run ends itself.

Before and after

A weak setup:

# Agent runs directly on the developer's laptop, using their everyday browser
python run_agent.py --task "download the March invoice"

A better one, using a throwaway container with a network allow-list:

docker run --rm --read-only \
  --network agent-net \
  -e ALLOWED_DOMAINS="billing.vendor.example" \
  -e MAX_STEPS=40 \
  --tmpfs /home/agent/profile \
  agent-browser:latest \
  python run_agent.py --task "download the March invoice"

The profile lives in memory and disappears at exit. The network named agent-net only routes to the allowed domain. The run stops after 40 steps. A person signs in to the vendor through the viewer before the agent starts.

What goes wrong

  • Allow-list only in the prompt. Telling the model "only visit billing.vendor.example" is a request. A network rule is a guarantee.
  • A persistent profile. Cookies from one run leak into the next, including sessions you meant to end.
  • Sharing the host's folders. A mounted home directory gives the agent your files.

Examples

Network allow-list as configuration

egress:
  default: deny
  allow:
    - billing.vendor.example:443
    - cdn.vendor.example:443

Everything not listed is refused by the network, so an injected link to another site simply fails.

Human takeover step

STEP 3: reach the verification page
  -> agent pauses and posts "Need a person: enter the code"
  -> operator opens the VM viewer, types the code
  -> operator presses Resume

The agent never sees the code or the password.

Key points

  • Run the agent in a disposable virtual machine or container, never in your everyday desktop session.
  • Use a clean browser profile with no saved passwords, autofill, extensions or old sessions.
  • Enforce the domain allow-list at the network level; a prompt instruction is not a control.
  • Sign in with a narrow dedicated account, and let a person do that sign-in for the run.
  • Define a takeover point and a step and time limit so a human can step in and a stuck run ends.

Common mistakes

  • Relying on the prompt to keep the agent on approved sites instead of blocking the rest in the network.
  • Reusing one persistent browser profile across runs, which carries sessions and cookies forward.
  • Mounting the host's home folder or password manager into the agent's machine.

Check yourself · 2 of 3

You want the agent to visit only billing.vendor.example. What is the strongest way to enforce that?

Choose one answer

Check yourself · 3 of 3

The task needs a login with a two-factor code. How should the setup handle it?

Choose one answer

Practice items, not counted towards your mastery.

Start here