Run coding agents in a container with your tools, your settings, and limits on host and network access. Use Claude Code, Codex, OpenCode, Pi, or any command.
sandbox run claudeSecurity model · Quickstart · User guides
Sandbox limits what an agent can reach, but it does not make untrusted code safe. Read the security model before sharing host files or credentials with an agent.
- The agent works on real files. The whole project is writable by default, including hidden files and project secrets. Starting in a subdirectory does not narrow that access.
- Trust can grant access outside the project. Approved external mounts let a project use shared code or data in a parent or sibling folder. Review the resolved host paths and access modes before approving the project configuration. Read-only access still lets the agent read and copy files.
- Network limits do not prevent data disclosure. The network allowlist limits destinations, but an allowed service can receive data the agent can read.
- Host integrations extend access. Attached sessions can read or replace the host clipboard by default. Allowed host commands run with your host permissions.
- Container isolation has limits. Sessions run as a non-root user, but runtime vulnerabilities or container root can break the controls.
Review the generated settings before the first run. sandbox init allows common development domains and shares selected host paths, including writable ~/.agents.
Remove entries you do not need.
- Customize your tools. Keep personal tools in a user image and project dependencies in a project image.
- Share project settings. Commit team configuration without replacing personal settings.
- Keep state between runs. Reuse agent state and dependency caches.
- Choose your runtime. Use Docker, Podman, or Apple
containerwith the same CLI.
See alternatives if you need a different isolation boundary.
- Node.js 24.22.1 or a later Node.js 24 release on the host.
- A running container runtime: Docker, Podman, or Apple
container. Follow runtime setup before installing one, especially on Windows or Apple silicon.
Install with npm, pnpm, or Bun:
npm install -g @maibornwolff/sandbox
# or: pnpm add -g @maibornwolff/sandbox
# or: bun install -g @maibornwolff/sandboxUse the same package manager for updates. Then initialize your user configuration:
sandbox initSelect the agents and tools you need.
Open the user config.toml at the path shown by sandbox init.
Before you run an agent:
- Set up authentication. Sandbox does not forward API keys by default.
To forward one, set it in your host environment and add only its name to the existing
envlist. See agent authentication for API keys, subscription login, and host authentication. - Review clipboard access. Set
clipboard = "disabled"if the agent does not need the host clipboard. See clipboard settings for project overrides.
sandbox doctor
cd your-project
sandbox run claudeReplace claude with an installed agent or command, such as codex or npm test.
The first run can take several minutes to build the tool images.
Later runs reuse cached images and compatible containers.
- Open a container shell: Run
sandbox. - Get setup help: Run
sandbox assiston the host from your project directory.
- Custom tools and images: install personal and project tools.
- Project configuration: share team settings and review trust prompts.
- Shared settings: reuse agent configuration without replacing container defaults.
- Persistence: keep agent state and separate container dependencies from host dependencies.
- Agent skills: share skills between agents and projects.
- Shell customization: add aliases, environment variables, and shell setup.
- File mounts: expose selected host paths or make the project read-only.
- Network access: allow services and inspect blocked requests.
- Agent authentication: choose which credentials the agent can use.
- Clipboard access: copy text and images, or disable host access.
- Host commands: permit specific commands outside the container.
- Sessions and containers: reuse containers, run quietly, and stop sessions.
- AI-assisted help: ask an agent to explain or change your setup.
- Updates and cleanup: update the CLI and tools, or remove stored data.
- Configuration reference: paths, merge rules, environment variables, and all configuration fields.
- Troubleshooting: diagnose startup, login, build, and network failures.
- Documentation index: user guides.
sandbox --helpandsandbox <command> --help: commands and options for your installed version.
- Contributor guide: build, test, and change Sandbox.
- Architecture guide: understand the system and its boundaries.
- Security policy: report vulnerabilities privately.
Built by MaibornWolff under the BSD 3-Clause License.
These tools make different trade-offs. Check their current docs before choosing one:
- Docker Sandboxes: microVM-based agent environments, local or cloud, with network policies and reusable customization kits.
The standalone
sbxCLI does not require Docker Desktop, and local use is free. A Docker sign-in is required. - NVIDIA OpenShell: an agent runtime with filesystem, network, and process policies, credential handling, and a gateway for managing sandboxes.
- microsandbox: local microVMs with a Docker-like CLI and SDKs for running untrusted workloads from applications.
- Anthropic Sandbox Runtime: operating-system sandboxing for commands, with filesystem and network controls.
- yolobox and ClaudeBox: other container-based agent environments.
- Claude Code devcontainer: a reference development container with a network firewall.
- clamp: Docker wrapper scripts for Claude Code, OpenCode, and Pi, with workspace mounts and a domain allowlist.
- Firejail: Linux application sandboxing.