Multi-agent sandbox and tools
Each agent in a multi-agent setup can override the global sandbox and tool policy. This page covers per-agent configuration, precedence rules, and examples.
Backends and modes — full sandbox reference.
Debug “why is this blocked?”
Elevated exec for trusted senders.
Configuration examples
Section titled “Configuration examples”Example 1: Personal + restricted family agent
{ "agents": { "list": [ { "id": "main", "default": true, "name": "Personal Assistant", "workspace": "~/.openclaw/workspace", "sandbox": { "mode": "off" } }, { "id": "family", "name": "Family Bot", "workspace": "~/.openclaw/workspace-family", "sandbox": { "mode": "all", "scope": "agent" }, "tools": { "allow": ["read", "message"], "deny": ["exec", "write", "edit", "apply_patch", "process", "browser"], "message": { "crossContext": { "allowWithinProvider": false, "allowAcrossProviders": false } } } } ] }, "bindings": [ { "agentId": "family", "match": { "provider": "whatsapp", "accountId": "*", "peer": { "kind": "group", } } } ]}Result:
mainagent: runs on host, full tool access.familyagent: runs in Docker (one container per agent), onlyreadand current-conversation message sends.
Example 2: Work agent with shared sandbox
{ "agents": { "list": [ { "id": "personal", "workspace": "~/.openclaw/workspace-personal", "sandbox": { "mode": "off" } }, { "id": "work", "workspace": "~/.openclaw/workspace-work", "sandbox": { "mode": "all", "scope": "shared", "workspaceRoot": "/tmp/work-sandboxes" }, "tools": { "allow": ["read", "write", "apply_patch", "exec"], "deny": ["browser", "gateway", "discord"] } } ] }}Example 2b: Global coding profile + messaging-only agent
{ "tools": { "profile": "coding" }, "agents": { "list": [ { "id": "support", "tools": { "profile": "messaging", "allow": ["slack"] } } ] }}Result:
- default agents get coding tools.
supportagent is messaging-only (+ Slack tool).
Example 3: Different sandbox modes per agent
{ "agents": { "defaults": { "sandbox": { "mode": "non-main", "scope": "session" } }, "list": [ { "id": "main", "workspace": "~/.openclaw/workspace", "sandbox": { "mode": "off" } }, { "id": "public", "workspace": "~/.openclaw/workspace-public", "sandbox": { "mode": "all", "scope": "agent" }, "tools": { "allow": ["read"], "deny": ["exec", "write", "edit", "apply_patch"] } } ] }}Configuration precedence
Section titled “Configuration precedence”When both global (agents.defaults.*) and agent-specific (agents.list[].*) configs exist:
Sandbox config
Section titled “Sandbox config”Agent-specific settings override global:
agents.list[].sandbox.mode > agents.defaults.sandbox.modeagents.list[].sandbox.scope > agents.defaults.sandbox.scopeagents.list[].sandbox.workspaceRoot > agents.defaults.sandbox.workspaceRootagents.list[].sandbox.workspaceAccess > agents.defaults.sandbox.workspaceAccessagents.list[].sandbox.docker.* > agents.defaults.sandbox.docker.*agents.list[].sandbox.browser.* > agents.defaults.sandbox.browser.*agents.list[].sandbox.prune.* > agents.defaults.sandbox.prune.*Tool restrictions
Section titled “Tool restrictions”The filtering order is:
Tool profile
tools.profileoragents.list[].tools.profile.Provider tool profile
tools.byProvider[provider].profileoragents.list[].tools.byProvider[provider].profile.Global tool policy
tools.allow/tools.deny.Provider tool policy
tools.byProvider[provider].allow/deny.Agent-specific tool policy
agents.list[].tools.allow/deny.Agent provider policy
agents.list[].tools.byProvider[provider].allow/deny.Sandbox tool policy
tools.sandbox.toolsoragents.list[].tools.sandbox.tools.Subagent tool policy
tools.subagents.tools, if applicable.
Precedence rules
- Each level can further restrict tools, but cannot grant back denied tools from earlier levels.
- If
agents.list[].tools.sandbox.toolsis set, it replacestools.sandbox.toolsfor that agent. - If
agents.list[].tools.profileis set, it overridestools.profilefor that agent. - Provider tool keys accept either
provider(e.g.google-antigravity) orprovider/model(e.g.openai/gpt-5.4).
Empty allowlist behavior
If any explicit allowlist in that chain leaves the run with no callable tools, OpenClaw stops before submitting the prompt to the model. This is intentional: an agent configured with a missing tool such as agents.list[].tools.allow: ["query_db"] should fail loudly until the plugin that registers query_db is enabled, not continue as a text-only agent.
Tool policies support group:* shorthands that expand to multiple tools. See Tool groups for the full list.
Per-agent elevated overrides (agents.list[].tools.elevated) can further restrict elevated exec for specific agents. See Elevated mode for details.
Migration from single agent
Section titled “Migration from single agent”{ "agents": { "defaults": { "workspace": "~/.openclaw/workspace", "sandbox": { "mode": "non-main" } } }, "tools": { "sandbox": { "tools": { "allow": ["read", "write", "apply_patch", "exec"], "deny": [] } } }}{ "agents": { "list": [ { "id": "main", "default": true, "workspace": "~/.openclaw/workspace", "sandbox": { "mode": "off" } } ] }}Tool restriction examples
Section titled “Tool restriction examples”{ "tools": { "allow": ["read"], "deny": ["exec", "write", "edit", "apply_patch", "process"] }}{ "tools": { "allow": ["read", "exec", "process"], "deny": ["write", "edit", "apply_patch", "browser", "gateway"] }}{ "tools": { "sessions": { "visibility": "tree" }, "allow": ["sessions_list", "sessions_send", "sessions_history", "session_status"], "deny": ["exec", "write", "edit", "apply_patch", "read", "browser"] }}sessions_history in this profile still returns a bounded, sanitized recall view rather than a raw transcript dump. Assistant recall strips thinking tags, `
scaffolding, plain-text tool-call XML payloads (including
…
,
…
,
…
,
…
`, and truncated tool-call blocks), downgraded tool-call scaffolding, leaked ASCII/full-width model control tokens, and malformed MiniMax tool-call XML before redaction/truncation.
Common pitfall: “non-main”
Section titled “Common pitfall: “non-main””Testing
Section titled “Testing”After configuring multi-agent sandbox and tools:
Check agent resolution
Terminal window openclaw agents list --bindingsVerify sandbox containers
Terminal window docker ps --filter "name=openclaw-sbx-"Test tool restrictions
- Send a message requiring restricted tools.
- Verify the agent cannot use denied tools.
Monitor logs
Terminal window tail -f "${OPENCLAW_STATE_DIR:-$HOME/.openclaw}/logs/gateway.log" | grep -E "routing|sandbox|tools"
Troubleshooting
Section titled “Troubleshooting”Agent not sandboxed despite `mode: 'all'`
- Check if there’s a global
agents.defaults.sandbox.modethat overrides it. - Agent-specific config takes precedence, so set
agents.list[].sandbox.mode: "all".
Tools still available despite deny list
- Check tool filtering order: global → agent → sandbox → subagent.
- Each level can only further restrict, not grant back.
- Verify with logs:
[tools] filtering tools for agent:${agentId}.
Container not isolated per agent
- Set
scope: "agent"in agent-specific sandbox config. - Default is
"session"which creates one container per session.
Related
Section titled “Related”- Elevated mode
- Multi-agent routing
- Sandbox configuration
- Sandbox vs tool policy vs elevated — debugging “why is this blocked?”
- Sandboxing — full sandbox reference (modes, scopes, backends, images)
- Session management