docs/tools/multi-agent-sandbox-tools.md
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.
<CardGroup cols={3}> <Card title="Sandboxing" href="/gateway/sandboxing"> Backends and modes — full sandbox reference. </Card> <Card title="Sandbox vs tool policy vs elevated" href="/gateway/sandbox-vs-tool-policy-vs-elevated"> Debug "why is this blocked?" </Card> <Card title="Elevated mode" href="/tools/elevated"> Elevated exec for trusted senders. </Card> </CardGroup> <Warning> Auth is scoped by agent: each agent has its own `agentDir` auth store at `~/.openclaw/agents/<agentId>/agent/auth-profiles.json`. Never reuse `agentDir` across agents. Agents can read through to the default/main agent's auth profiles when they do not have a local profile, but OAuth refresh tokens are not cloned into secondary agent stores. If you copy credentials manually, copy only portable static `api_key` or `token` profiles. </Warning>**Result:**
- `main` agent: runs on host, full tool access.
- `family` agent: runs in Docker (one container per agent), only `read` tool.
**Result:**
- default agents get coding tools.
- `support` agent is messaging-only (+ Slack tool).
When both global (agents.defaults.*) and agent-specific (agents.list[].*) configs exist:
Agent-specific settings override global:
agents.list[].sandbox.mode > agents.defaults.sandbox.mode
agents.list[].sandbox.scope > agents.defaults.sandbox.scope
agents.list[].sandbox.workspaceRoot > agents.defaults.sandbox.workspaceRoot
agents.list[].sandbox.workspaceAccess > agents.defaults.sandbox.workspaceAccess
agents.list[].sandbox.docker.* > agents.defaults.sandbox.docker.*
agents.list[].sandbox.browser.* > agents.defaults.sandbox.browser.*
agents.list[].sandbox.prune.* > agents.defaults.sandbox.prune.*
The filtering order is:
<Steps> <Step title="Tool profile"> `tools.profile` or `agents.list[].tools.profile`. </Step> <Step title="Provider tool profile"> `tools.byProvider[provider].profile` or `agents.list[].tools.byProvider[provider].profile`. </Step> <Step title="Global tool policy"> `tools.allow` / `tools.deny`. </Step> <Step title="Provider tool policy"> `tools.byProvider[provider].allow/deny`. </Step> <Step title="Agent-specific tool policy"> `agents.list[].tools.allow/deny`. </Step> <Step title="Agent provider policy"> `agents.list[].tools.byProvider[provider].allow/deny`. </Step> <Step title="Sandbox tool policy"> `tools.sandbox.tools` or `agents.list[].tools.sandbox.tools`. </Step> <Step title="Subagent tool policy"> `tools.subagents.tools`, if applicable. </Step> </Steps> <AccordionGroup> <Accordion title="Precedence rules"> - Each level can further restrict tools, but cannot grant back denied tools from earlier levels. - If `agents.list[].tools.sandbox.tools` is set, it replaces `tools.sandbox.tools` for that agent. - If `agents.list[].tools.profile` is set, it overrides `tools.profile` for that agent. - Provider tool keys accept either `provider` (e.g. `google-antigravity`) or `provider/model` (e.g. `openai/gpt-5.4`). </Accordion> <Accordion title="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. </Accordion> </AccordionGroup>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.
`sessions_history` in this profile still returns a bounded, sanitized recall view rather than a raw transcript dump. Assistant recall strips thinking tags, `<relevant-memories>` scaffolding, plain-text tool-call XML payloads (including `<tool_call>...</tool_call>`, `<function_call>...</function_call>`, `<tool_calls>...</tool_calls>`, `<function_calls>...</function_calls>`, 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.
After configuring multi-agent sandbox and tools:
<Steps> <Step title="Check agent resolution"> ```bash openclaw agents list --bindings ``` </Step> <Step title="Verify sandbox containers"> ```bash docker ps --filter "name=openclaw-sbx-" ``` </Step> <Step title="Test tool restrictions"> - Send a message requiring restricted tools. - Verify the agent cannot use denied tools. </Step> <Step title="Monitor logs"> ```bash tail -f "${OPENCLAW_STATE_DIR:-$HOME/.openclaw}/logs/gateway.log" | grep -E "routing|sandbox|tools" ``` </Step> </Steps>