Multi-Agent Routing
OpenClaw supports routing different channels, accounts, and users to isolated agent instances, each with their own workspace, session state, and configuration.Overview
Multi-agent routing enables:- Workspace isolation — Separate working directories per agent
- Session isolation — Independent conversation history
- Model customization — Different models per agent
- Specialized agents — Code, creative writing, research, etc.
- Team workspaces — Route teams/channels to dedicated agents
Architecture
- Runs in the same gateway process
- Has isolated workspace and sessions
- Can use different models
- Routes based on channel, account, or peer
Configuration
Define Agents
Route Channels to Agents
Routing Match Criteria
Routes can match on:Session Scoping
Control session isolation withsession.dmScope:
From
src/commands/doctor-security.ts:116-122.
Use Cases
Team Workspaces
Route different teams to isolated agents:Specialized Agents
Create domain-specific assistants:Personal vs Work
Separate personal and work contexts:Multi-Account Routing
Route multiple accounts to different agents:CLI Commands
List Agents
Send to Specific Agent
Check Agent Workspace
Workspace Management
Workspace Structure
Each agent has an isolated workspace:Initialize Agent Workspace
Backup Agent Data
Advanced Configuration
Per-Agent Model Settings
Per-Agent Tools
Enable/disable tools per agent:Per-Agent Hooks
Customize hooks per agent:Monitoring
View Agent Activity
Debug Routing
Troubleshooting
Agent not routing correctly
Agent not routing correctly
Problem: Messages going to wrong agent.Debug:
Agent workspace not found
Agent workspace not found
Problem: Agent can’t access workspace files.Fix:
Session state not isolated
Session state not isolated
Problem: Agents sharing session state.Fix:
Routing rules not matching
Routing rules not matching
Problem: Rules not matching expected traffic.Debug:
Best Practices
1
Use descriptive agent IDs
Choose clear names:
code-assistant, creative-writer, not agent1, agent22
Set explicit workspace paths
Avoid conflicts by using unique workspace directories per agent
3
Enable session isolation
Use
session.dmScope: per-channel-peer for multi-user setups4
Document routing rules
Add comments in config to explain routing logic
5
Test routing before production
Verify routing with test messages before deploying
6
Backup agent workspaces
Regularly backup agent-specific workspace and session data
Next Steps
Security Guide
Secure multi-agent setups with allowlists
Deployment
Deploy multi-agent gateway to production
Configuration
Advanced gateway configuration
Sessions
Understand session management

