Agent sandboxing — safe LLM agent execution on Mac
Key Takeaways
LLM agents (Claude Code, Codex, Gemini CLI) run with full filesystem access. Sandboxing via lightweight VMs solves this: agent works in isolation, sees only what you share.
Why: --yolo without fear (agent can’t harm host), privacy control (you decide what agent sees), isolation (agent installs/deletes freely), reproducibility (clean env per project).
Real case: Codex reads files outside working directory even WITHOUT --yolo. A VM is the strongest isolation against this. Claude Code’s native OS sandbox (Seatbelt on macOS, bubblewrap on Linux) is the lighter option; the author uses it for swarm workers in strict mode (project-swarm).
Approaches: Lima/Colima VMs on macOS (Apple Silicon), Docker Desktop (heavier), nsjail (Linux only). Lima recommended: lightweight, mounts project directory read-write, rest of system invisible.
Pattern: limactl start agent-sandbox.yaml → mount project dir → run agent inside → changes sync back to host. Config specifies CPU/RAM limits, network policy, shared directories.
What others found since (Oct 2026)
- Egress and credentials, not just the filesystem. Anthropic’s How we contain Claude (May 2026): the OS sandbox cut permission prompts 84%, yet in a red-team run a phished prompt exfiltrated
~/.aws/credentialsin 24 of 25 retries, and only egress and filesystem boundaries would have stopped it. A domain allowlist turned out to be a capability grant: data left through api.anthropic.com (reported). Matthew Green (Sep 2026) puts it as: a sandbox moves the problem to the gate it leaves open. Related: dsewiki-agent-collusion. - Deny rules bind the tool, not the code it runs. In project-swarm a Claude Code worker read a file outside its worktree without asking; explicit deny rules fixed that (measured). But
go testexecutes the worker’s own code, which no deny rule on Claude’s tools covers, so strict mode wraps the worker in Claude Code’s OS sandbox.
Connections
-
privacy-as-architecture — sandboxing = privacy at the execution layer, not just data layer
-
harness-engineering-summary — sandbox is an architectural constraint (component 2) for agent safety
-
agent-self-discipline — sandboxing is the external guardrail when internal discipline isn’t enough
-
cloudflare-computer-agent-runtime — the same isolation at cloud scale, where the driver is unit economics rather than trust: an isolate per agent instead of a VM per agent
-
running-production-with-agents-2026 — sandboxing bounds the damage on one machine; the panel’s governor bounds it across every agent and system, with one permission graph and one log