Sandbox CLI
Manage sandbox runtimes for isolated agent execution.Overview
OpenClaw can run agents in isolated sandbox runtimes for security. Thesandbox commands help you inspect and recreate those runtimes after updates or configuration changes.
Today that usually means:
- Docker sandbox containers
- SSH sandbox runtimes when
agents.defaults.sandbox.backend = "ssh" - OpenShell sandbox runtimes when
agents.defaults.sandbox.backend = "openshell"
ssh and OpenShell remote, recreate matters more than with Docker:
- the remote workspace is canonical after the initial seed
openclaw sandbox recreatedeletes that canonical remote workspace for the selected scope- next use seeds it again from the current local workspace
Commands
openclaw sandbox explain
Inspect the effective sandbox mode/scope/workspace access, sandbox tool policy, and elevated gates (with fix-it config key paths).
openclaw sandbox list
List all sandbox runtimes with their status and configuration.
- Runtime name and status
- Backend (
docker,openshell, etc.) - Config label and whether it matches current config
- Age (time since creation)
- Idle time (time since last use)
- Associated session/agent
openclaw sandbox recreate
Remove sandbox runtimes to force recreation with updated config.
--all: Recreate all sandbox containers--session <key>: Recreate container for specific session--agent <id>: Recreate containers for specific agent--browser: Only recreate browser containers--force: Skip confirmation prompt
Use Cases
After updating a Docker image
After changing sandbox configuration
After changing SSH target or SSH auth material
ssh backend, recreate deletes the per-scope remote workspace root
on the SSH target. The next run seeds it again from the local workspace.
After changing OpenShell source, policy, or mode
remote mode, recreate deletes the canonical remote workspace
for that scope. The next run seeds it again from the local workspace.
After changing setupCommand
For a specific agent only
Why is this needed?
Problem: When you update sandbox configuration:- Existing runtimes continue running with old settings
- Runtimes are only pruned after 24h of inactivity
- Regularly-used agents keep old runtimes alive indefinitely
openclaw sandbox recreate to force removal of old runtimes. They’ll be recreated automatically with current settings when next needed.
Tip: prefer openclaw sandbox recreate over manual backend-specific cleanup.
It uses the Gateway’s runtime registry and avoids mismatches when scope/session keys change.
Configuration
Sandbox settings live in~/.openclaw/openclaw.json under agents.defaults.sandbox (per-agent overrides go in agents.list[].sandbox):
See Also
- Sandbox Documentation
- Agent Configuration
- Doctor Command - Check sandbox setup