Caricamento in corso...
Caricamento in corso...
Last synced: Today, 22:00
Technical reference for the OpenClaw framework. Real-time synchronization with the official documentation engine.
Use this file to discover all available pages before exploring further.
OpenClaw can run tools inside sandbox backends to reduce blast radius. This is optional and controlled by configuration (
agents.defaults.sandboxagents.list[].sandboxexecreadwriteeditapply_patchprocessagents.defaults.sandbox.browserNot sandboxed:
tools.elevatedgatewaynodenodetools.elevatedagents.defaults.sandbox.modetext`"non-main"` is based on `session.mainKey` (default `"main"`), not agent id. Group/channel sessions use their own keys, so they count as non-main and will be sandboxed.
agents.defaults.sandbox.scope"agent""session""shared"agents.defaults.sandbox.backend"docker""ssh""openshell"SSH-specific config lives under
agents.defaults.sandbox.sshplugins.entries.openshell.config| Docker | SSH | OpenShell | |
|---|---|---|---|
| Where it runs | Local container | Any SSH-accessible host | OpenShell managed sandbox |
| Setup | text scripts/sandbox-setup.sh | SSH key + target host | OpenShell plugin enabled |
| Workspace model | Bind-mount or copy | Remote-canonical (seed once) | text mirrortext remote |
| Network control | text docker.network | Depends on remote host | Depends on OpenShell |
| Browser sandbox | Supported | Not supported | Not supported yet |
| Bind mounts | text docker.binds | N/A | N/A |
| Best for | Local dev, full isolation | Offloading to a remote machine | Managed remote sandboxes with optional two-way sync |
Sandboxing is off by default. If you enable sandboxing and do not choose a backend, OpenClaw uses the Docker backend. It executes tools and sandbox browsers locally via the Docker daemon socket (
/var/run/docker.sockTo expose host GPUs to Docker sandboxes, set
agents.defaults.sandbox.docker.gpusagents.list[].sandbox.docker.gpus--gpus"all""device=GPU-uuid"If you deploy the OpenClaw Gateway itself as a Docker container, it orchestrates sibling sandbox containers using the host's Docker socket (DooD). This introduces a specific path mapping constraint:
openclaw.jsonworkspace/home/user/.openclaw/workspacesworkspace-v /home/user/.openclaw:/home/user/.openclawIf you map paths internally without absolute host parity, OpenClaw natively throws an
EACCESUse
backend: "ssh"execjson5{ agents: { defaults: { sandbox: { mode: "all", backend: "ssh", scope: "session", workspaceAccess: "rw", ssh: { target: "user@gateway-host:22", workspaceRoot: "/tmp/openclaw-sandboxes", strictHostKeyChecking: true, updateHostKeys: true, identityFile: "~/.ssh/id_ed25519", certificateFile: "~/.ssh/id_ed25519-cert.pub", knownHostsFile: "~/.ssh/known_hosts", // Or use SecretRefs / inline contents instead of local files: // identityData: { source: "env", provider: "default", id: "SSH_IDENTITY" }, // certificateData: { source: "env", provider: "default", id: "SSH_CERTIFICATE" }, // knownHostsData: { source: "env", provider: "default", id: "SSH_KNOWN_HOSTS" }, }, }, }, }, }
Use
backend: "openshell"OpenShell reuses the same core SSH transport and remote filesystem bridge as the generic SSH backend, and adds OpenShell-specific lifecycle (
sandbox create/get/deletesandbox ssh-configmirrorjson5{ agents: { defaults: { sandbox: { mode: "all", backend: "openshell", scope: "session", workspaceAccess: "rw", }, }, }, plugins: { entries: { openshell: { enabled: true, config: { from: "openclaw", mode: "remote", // mirror | remote remoteWorkspaceDir: "/sandbox", remoteAgentWorkspaceDir: "/agent", }, }, }, }, }
OpenShell modes:
mirrorremoteOpenShell has two workspace models. This is the part that matters most in practice.
textBehavior: * Before `exec`, OpenClaw syncs the local workspace into the OpenShell sandbox. * After `exec`, OpenClaw syncs the remote workspace back to the local workspace. * File tools still operate through the sandbox bridge, but the local workspace remains the source of truth between turns. Use this when: * you edit files locally outside OpenClaw and want those changes to show up in the sandbox automatically * you want the OpenShell sandbox to behave as much like the Docker backend as possible * you want the host workspace to reflect sandbox writes after each exec turn Tradeoff: extra sync cost before and after exec.
textBehavior: * When the sandbox is first created, OpenClaw seeds the remote workspace from the local workspace once. * After that, `exec`, `read`, `write`, `edit`, and `apply_patch` operate directly against the remote OpenShell workspace. * OpenClaw does **not** sync remote changes back into the local workspace after exec. * Prompt-time media reads still work because file and media tools read through the sandbox bridge instead of assuming a local host path. * Transport is SSH into the OpenShell sandbox returned by `openshell sandbox ssh-config`. Important consequences: * If you edit files on the host outside OpenClaw after the seed step, the remote sandbox will **not** see those changes automatically. * If the sandbox is recreated, the remote workspace is seeded from the local workspace again. * With `scope: "agent"` or `scope: "shared"`, that remote workspace is shared at that same scope. Use this when: * the sandbox should live primarily on the remote OpenShell side * you want lower per-turn sync overhead * you do not want host-local edits to silently overwrite remote sandbox state
Choose
mirrorremoteOpenShell sandboxes are still managed through the normal sandbox lifecycle:
openclaw sandbox listopenclaw sandbox recreateFor
remoteFor
mirroragents.defaults.sandbox.workspaceAccessWith the OpenShell backend:
mirrorremoteworkspaceAccess: "ro""none"Inbound media is copied into the active sandbox workspace (
media/inbound/*agents.defaults.sandbox.docker.bindshost:container:mode"/home/user/source:/source:rw"Global and per-agent binds are merged (not replaced). Under
scope: "shared"agents.defaults.sandbox.browser.binds[]agents.defaults.sandbox.docker.bindsagents.defaults.sandbox.docker.bindsExample (read-only source + an extra data directory):
json5{ agents: { defaults: { sandbox: { docker: { binds: ["/home/user/source:/source:ro", "/var/data/myapp:/data:ro"], }, }, }, list: [ { id: "build", sandbox: { docker: { binds: ["/mnt/cache:/cache:rw"], }, }, }, ], }, }
:ro:rwdocker.sock/etc/proc/sys/dev~/.aws~/.cargo~/.config~/.docker~/.gnupg~/.netrc~/.npm~/.ssh/workspace/run-link/new-file/var/run/...run-linkoutside allowed roots:roworkspaceAccess: "ro"Default Docker image:
openclaw-sandbox:bookworm-slimtextThe default image does **not** include Node. If a skill needs Node (or other runtimes), either bake a custom image or install via `sandbox.docker.setupCommand` (requires network egress + writable root + root user). OpenClaw does not silently substitute plain `debian:bookworm-slim` when `openclaw-sandbox:bookworm-slim` is missing. Sandbox runs that target the default image fail fast with a build instruction until you run `scripts/sandbox-setup.sh`, because the bundled image carries `python3` for sandbox write/edit helpers.
text```bash} scripts/sandbox-common-setup.sh ``` Then set `agents.defaults.sandbox.docker.image` to `openclaw-sandbox-common:bookworm-slim`.
By default, Docker sandbox containers run with no network. Override with
agents.defaults.sandbox.docker.networkDocker installs and the containerized gateway live here: Docker
For Docker gateway deployments,
scripts/docker/setup.shOPENCLAW_SANDBOX=1trueyesonOPENCLAW_DOCKER_SOCKETsetupCommandsh -lcPaths:
agents.defaults.sandbox.docker.setupCommandagents.list[].sandbox.docker.setupCommandTool allow/deny policies still apply before sandbox rules. If a tool is denied globally or per-agent, sandboxing doesn't bring it back.
tools.elevatedexecgatewaynodenode/execexecDebugging:
openclaw sandbox explainKeep it locked down.
Each agent can override sandbox + tools:
agents.list[].sandboxagents.list[].toolsagents.list[].tools.sandbox.toolsjson5{ agents: { defaults: { sandbox: { mode: "non-main", scope: "session", workspaceAccess: "none", }, }, }, }
© 2024 TaskFlow Mirror
Powered by TaskFlow Sync Engine