Sandboxing AI Coding Agents

Isolate agents so you can grant broad permissions without risking your host.

On this page

  1. Mac
  2. Linux
  3. Windows
  4. Custom sandbox methods

Mac darwin

Recommended: Lima VM

Runs agents inside a managed Debian VM. On Apple Silicon, Lima uses Apple's Virtualization.framework — near-native performance, fast boot, low overhead. One VM serves every workspace you have.

Setup: Settings → Sandboxing → toggle "Containerized agents" → expand "Lima Virtual Machine" → "Set up VM".

Reaching host services from the VM. The host is accessible at host.lima.internal, but most dev services (Postgres, Redis, Node dev servers) bind to 127.0.0.1 by default, which isn't routed into the VM. Two fixes: rebind the service to 0.0.0.0 or the Lima gateway IP (192.168.5.2 on vz) so it's visible on the VM network, or run the service inside the VM itself.

Alternative: Safehouse

Safehouse wraps a command in a macOS sandbox-exec profile restricting filesystem access to allowlisted paths. Lighter than a VM but same-kernel — weaker isolation than Lima.

Baton ships a preconfigured template. Add it from Settings → Sandboxing → Sandbox Methods and select it on workspace creation.

Also good: built-in agent sandboxing

Some agents have meaningful protections built in. Claude Code combines per-command permission prompts, its own OS-level sandboxing, and an auto-accept mode whose AI classifier gauges command risk before running — together that's a solid baseline. Codex CLI ships with explicit sandbox modes (read-only, workspace-write, full-access). These apply only within the agent itself, but for day-to-day development they're often enough on their own. For unattended bypass-permissions runs, pair with Lima or Safehouse.

Linux linux

Recommended: Lima VM

Same Lima-based sandbox as Mac. Install limactl from your package manager (apt install lima, pacman -S lima), then follow the setup flow in Settings → Sandboxing.

Also good: built-in agent sandboxing

Same as Mac — Claude Code's sandbox + classifier and Codex CLI's sandbox modes are often enough for day-to-day development. Pair with Lima for unattended bypass-permissions runs.

Windows win32

No managed VM sandbox yet. Custom methods and built-in agent sandboxing work normally.

Recommended: built-in agent sandboxing

Claude Code's sandbox + classifier and Codex CLI's sandbox modes work the same on Windows and cover most day-to-day development. Pair with a dedicated WSL2 distro (below) for unattended bypass-permissions runs.

Stronger isolation: dedicated WSL2 distro (manual)

A dedicated WSL2 distro reserved for agents gives kernel-level isolation comparable to Lima. We don't have an automated flow yet; rough shape:

Setting this up — or already running something similar? Reach out. We want to turn WSL2 into a first-class sandbox method (automatic distro provisioning, notifications, MCP), and both working setups and in-progress attempts are the most useful input we can get.

Custom sandbox methods

A sandbox method configured under Settings → Sandboxing → Sandbox Methods has three fields:

Any wrapper that accepts a shell command via argv works — Docker, Podman, systemd-nspawn, bubblewrap, firejail, custom scripts.

Docker Sandbox (sbx)

Docker's sbx CLI launches agents inside an isolated per-project micro-VM with preinstalled tooling, network-policy enforcement, and optional Git worktree isolation via --branch. It's an agent launcher (sbx run claude <workspace>) rather than a shell-command wrapper, so it doesn't slot in here as a sandbox method — configure it as an alternate launch mode on your agent preset instead (Settings → Agent CLIs → <agent>) that invokes sbx run in place of the default agent binary. Anything the agent needs from your host is reachable at host.docker.internal, and dev-server ports can be exposed with sbx ports <sandbox> --publish <host>:<sandbox> when you want them in your browser.

More questions?

Get in touch — we're actively working on this area.