Multi-Agent Routing
Using multiple specialized agents.
Overview
Multi-agent routing allows different agents to handle different types of requests:
┌─────────────────────────────────────────┐
│ Router │
│ ┌─────────┐ ┌─────────┐ ┌─────────┐ │
│ │ Coding │ │ Writing │ │ Research│ │
│ │ Agent │ │ Agent │ │ Agent │ │
│ └─────────┘ └─────────┘ └─────────┘ │
└─────────────────────────────────────────┘Creating Agents
bash
# Coding agent
openclaw agents create coding \
--model claude-3-5-sonnet \
--prompt "You are a coding assistant..."
# Writing agent
openclaw agents create writing \
--model gpt-4 \
--prompt "You are a creative writer..."
# Research agent
openclaw agents create research \
--model claude-3-opus \
--prompt "You are a research assistant..."Routing Rules
Configure how messages are routed:
json5
{
routing: {
rules: [
{
pattern: "code|programming|debug",
agent: "coding"
},
{
pattern: "write|essay|story",
agent: "writing"
}
],
default: "general"
}
}Routing Methods
Pattern Matching
Route based on message content patterns.
Channel-Based
Route based on source channel:
json5
{
routing: {
channels: {
"discord-coding": "coding",
"telegram-personal": "general"
}
}
}AI-Based
Let an AI decide which agent to use:
json5
{
routing: {
method: "ai",
routerModel: "claude-3-haiku"
}
}Manual Switching
Users can manually switch agents:
/agent coding