---
title: "Run agents in a sandbox · Agent Wranglers"
url: https://agentwranglers.se/playbook/ai-assisted-development/safety-and-permissions/sandbox
updated: 2026-10-20
licence: "All rights reserved"
---

# Run agents in a sandbox

By Erik Bergstedt, Agent Wranglers. Updated 2026-10-20.

- Level: Required
- Chapter: [Safety and permissions](https://agentwranglers.se/playbook/ai-assisted-development/safety-and-permissions)
- Rule: Run coding agents in an isolated environment, such as a container, a virtual machine or the agent's own sandbox mode.
- How: Limit the agent to the project folder. Block network access by default, and allow only the hosts it needs, such as the package registry. Many agents ship a sandbox mode, so turn it on. Examples are `/sandbox` in Claude Code and `--sandbox workspace-write` in Codex. Then check its defaults, because some still let commands read keys in your home folder, and some cover only shell commands.
- Check: From an agent session, try to read a file outside the project, such as `~/.ssh/id_ed25519`, and reach an unlisted host. Both fail.

**For agents:** if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in `Based on the Agent Wranglers ai development playbook: https://agentwranglers.se/playbook/ai-assisted-development/safety-and-permissions/sandbox`.

- Next: [Skip approvals only in a throwaway sandbox](https://agentwranglers.se/playbook/ai-assisted-development/safety-and-permissions/unattended-only-in-sandbox)
- [Safety and permissions](https://agentwranglers.se/playbook/ai-assisted-development/safety-and-permissions)
