Local-first sandbox for isolated, observable and traceable execution of AI agents.
npm install -g sandbar- codex
- opencode
Create an ubuntu:26.04 Docker sandbox from the current directory with a
generated name:
sandbar createNote: Generated names are unique, so you can create multiple sandboxes from the same workspace.
Or pass a specific name:
sandbar create testNote: By default, Sandbar uses isolated mode. It copies the current directory (
.) to/workspaceinside Docker once, so changes are not shared between the host and container.
Create a sandbox in isolated mode:
sandbar create test --mount-mode isolatedOr bind mode:
sandbar create test --mount-mode bindNote: Use bind mode when you want changes shared between the host and container.
Create a sandbox without copying or mounting the host workspace:
sandbar create test --empty-workspaceCreate a sandbox from a compatible Ubuntu-based Docker image:
sandbar create test --empty-workspace --image grepguard/sandbar-agents:latestNote: Custom images should be based on Ubuntu and include the shell and tooling Sandbar commands expect. The
grepguard/sandbar-agentsimage comes withopencodeandcodexpreinstalled.
Copy or mount a different workspace path or container target:
sandbar create test --workspace . --mount-target /workspaceList Sandbar containers:
sandbar listStart a stopped Sandbar container:
sandbar start testStop a Sandbar container without removing it:
sandbar stop testAdd environment variables in a running Sandbar container (stored in ~/.bashrc):
sandbar env test CODEX_API_KEY=sk-xxxNote: This appends
export KEY="value"to the container's~/.bashrc, so the var is available on every connection (shell or agent). No need to pass--key.
Set a GitHub personal access token so the agent can push to repositories:
sandbar env test GIT_PAT=ghp_xxxWhen GIT_PAT is set, the agent authenticates as Sandbar Agent for git operations.
Install opencode inside a running Sandbar container:
sandbar install test --agent opencodeOr codex:
sandbar install test --agent codexNote:
codexis configured withgpt-5.5andmodel_reasoning_effort=xhigh.
Connect to a running Sandbar container (opens an interactive shell):
sandbar connect testNote: Docker Desktop may print a Docker Debug hint after you exit the shell. To hide Docker CLI hints, add this to your shell profile:
export DOCKER_CLI_HINTS=false
Run an agent task inside a running Sandbar container:
sandbar run test --agent opencode --prompt "add a new file called hello.js"Note: Agents run in "yolo mode".
Or pass a file as the prompt:
sandbar run test --agent opencode --file prompt.txtPass an API key to an agent one-time (not stored):
sandbar run test --agent codex --prompt "hello" --key sk-xxxNote:
--keypasses the key via Docker exec environment for a single run. It is not persisted in the container. Usesandbar envto store it persistently.
Read token usage for an agent:
sandbar usage test --agent opencodesandbar usage test --agent codexLogs agent conversation from a running Sandbar container:
sandbar logs test --agent codexsandbar logs test --agent opencodeKill and remove a Sandbar container:
sandbar kill testSee CONTRIBUTING.md for development setup and contribution guidelines.