Skip to main content

Multi-Agent

Coordinate multiple agents with routing, sub-agents, and presence.

In multi-agent setups, each agent has its own workspace. OpenClaw routes messages to the right agent based on configurable rules.

Multi-Agent Routing

Configure multiple agents in openclaw.json. Each agent can have different models, tools, and workspaces:

{
  "agents": {
    "main": {
      "workspace": "~/.openclaw/workspaces/main",
      "model": "anthropic/claude-sonnet-4"
    },
    "research": {
      "workspace": "~/.openclaw/workspaces/research",
      "model": "openai/gpt-4o"
    },
    "code": {
      "workspace": "~/.openclaw/workspaces/code",
      "model": "anthropic/claude-sonnet-4"
    }
  }
}

Routing rules determine which agent handles which messages — by channel, keyword, or explicit user command.

Agent Send

Send messages between agents. The agent_send tool lets one agent delegate tasks to another:

  • Main agent receives “research quantum computing” → routes to research agent
  • Research agent completes → sends results back to main agent
  • Main agent formats and replies to user

Sub-Agents

Spawn temporary agents for isolated subtasks within a single conversation. Sub-agents:

  • Inherit the parent’s model config (or override)
  • Run in their own sandbox when sandboxing is enabled
  • Return results to the parent agent
  • Are ephemeral — they don’t persist between sessions

Multi-Agent Sandbox

When sandbox mode is enabled, each non-main session can get its own workspace under agents.defaults.sandbox.workspaceRoot. This provides:

  • Isolated file access per agent
  • Docker container sandboxing for untrusted operations
  • Separate tool policies per agent

Presence

Agents report their availability status. The presence system lets you:

  • See which agents are online/busy/idle
  • Route messages only to available agents
  • Handle failover when an agent is overloaded

Per-Agent vs Shared Skills

  • Per-agent skills: <workspace>/skills for that agent only
  • Shared skills: ~/.openclaw/skills visible to ALL agents
  • Extra shared dirs via skills.load.extraDirs

Use Cases

Personal + Work Split

Separate agents for personal tasks and work tasks, different models and boundaries.

Specialist Agents

Research agent, code agent, writing agent — each with optimized prompts and tools.

Triage + Execution

One agent triages incoming messages and routes to specialized handlers.

Multi-Agent Coordination

Multi-agent coordination is one of the most advanced patterns in agent development. Understanding routing, delegation, and state isolation in OpenClaw prepares you for building your own multi-agent systems.

Explore Agent Design Patterns