Skip to main content
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.

Sandboxing

Backends and modes — full sandbox reference.

Sandbox vs tool policy vs elevated

Debug “why is this blocked?”

Elevated mode

Elevated exec for trusted senders.
Auth is scoped by agent: each agent has its own <agentDir>/openclaw-agent.sqlite auth store (by default, ~/.openclaw/agents/<agentId>/agent/openclaw-agent.sqlite). 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.

Configuration examples

Result:
  • main agent: runs on host, full tool access.
  • family agent: runs in the configured container sandbox backend (one container per agent), only read and current-conversation message sends.
Result:
  • default agents get coding tools.
  • support agent is messaging-only (+ Slack tool).

Configuration precedence

When both global (agents.defaults.*) and agent-specific (agents.entries.*.*) configs exist:

Sandbox config

Agent-specific settings override global:
agents.entries.*.sandbox.{docker,browser,prune}.* overrides agents.defaults.sandbox.{docker,browser,prune}.* for that agent (ignored when sandbox scope resolves to "shared"). The docker block configures both built-in container backends.

Tool restrictions

The filtering order is:
1

Tool profile

tools.profile or agents.entries.*.tools.profile.
2

Provider tool profile

tools.byProvider[provider].profile or agents.entries.*.tools.byProvider[provider].profile.
3

Global tool policy

tools.allow / tools.deny.
4

Provider tool policy

tools.byProvider[provider].allow/deny.
5

Agent-specific tool policy

agents.entries.*.tools.allow/deny.
6

Agent provider policy

agents.entries.*.tools.byProvider[provider].allow/deny.
7

Sandbox tool policy

tools.sandbox.tools or agents.entries.*.tools.sandbox.tools.
8

Subagent tool policy

tools.subagents.tools, if applicable.
  • Each level can further restrict tools, but cannot grant back denied tools from earlier levels.
  • If agents.entries.*.tools.sandbox.tools is set, it replaces tools.sandbox.tools for that agent.
  • If agents.entries.*.tools.profile is set, it overrides tools.profile for that agent.
  • Provider tool keys accept either provider (e.g. anthropic) or provider/model (e.g. openai/gpt-5.4).
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.entries.*.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. Configured MCP tools use the same policy surface. Their canonical names are <safe-server>__<safe-tool>; globs can target a server namespace. For example:
Every restrictive layer intersects with the earlier layers, and deny always wins. OpenClaw projects the resulting raw tool set into native Claude, Codex, and Gemini MCP filters before their first model turn. Backend-native names and settings are implementation details, not a second operator policy surface. An MCP server with no allowed tool is omitted. A restrictive catalog failure also omits that server and records a diagnostic instead of failing open. Per-agent elevated overrides (agents.entries.*.tools.elevated) can further restrict elevated exec for specific agents. See Elevated mode for details.

Migration from single agent

Legacy agents.list rosters and retired per-agent keys (such as sandbox.perSession, agentRuntime, and embeddedPi) are migrated by openclaw doctor; prefer agents.defaults + agents.entries going forward.

Tool restriction examples


Common pitfall: “non-main”

agents.defaults.sandbox.mode: "non-main" checks the session key against the main session key (always "main"; session.mainKey is not user-configurable, and OpenClaw warns and ignores any other value), not the agent id. Group/channel sessions always get their own keys, so they are treated as non-main and will be sandboxed. If you want an agent to never sandbox, set agents.entries.*.sandbox.mode: "off".

Testing

After configuring multi-agent sandbox and tools:
1

Check agent resolution

2

Verify sandbox containers

3

Test tool restrictions

  • Send a message requiring restricted tools.
  • Verify the agent cannot use denied tools.
4

Monitor logs


Troubleshooting

  • Check if there’s a global agents.defaults.sandbox.mode that overrides it.
  • Agent-specific config takes precedence, so set agents.entries.*.sandbox.mode: "all".
  • Check the full filtering order: profile → provider profile → global policy → provider policy → agent policy → agent provider policy → sandbox → subagent.
  • Each level can only further restrict, not grant back.
  • See Sandbox vs tool policy vs elevated for step-by-step debugging.
  • For MCP tools, use the provider-safe name shown by OpenClaw, such as docs__read_docs or docs__*; do not use a backend’s raw config field name.
  • Default scope is "agent" (one container per agent id).
  • Set scope: "session" for one container per session, or scope: "shared" to reuse one container across agents.