Loading...
Loading...
Multi-Agent Architecture Design and Intelligent Spawn System. Use this skill when you need to design a multi-agent system, configure specialized agents, implement intelligent task distribution, or optimize concurrent processing capabilities.
npx skill4agent add aaaaqwq/claude-code-skills multi-agent-architecture┌─────────────────────────────────────────────────────────────┐
│ Main Agent (Xiaoa) │
│ - Main session processing │
│ - Task distribution and coordination │
│ - Complex decision-making and planning │
│ - Model: opus-4.5 (High quality) │
└─────────────────────────────────────────────────────────────┘
│
┌───────────────────┼───────────────────┐
▼ ▼ ▼
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ News Agent │ │ Code Agent │ │ Research Agent │
│ - News scraping │ │ - Code generation │ │ - In-depth research │
│ - Content summarization │ │ - Bug fixing │ │ - Document analysis │
│ - Scheduled push notifications │ │ - Code review │ │ - Knowledge integration │
│ Model: sonnet │ │ Model: codex │ │ Model: opus │
└─────────────────┘ └─────────────────┘ └─────────────────┘
│ │ │
▼ ▼ ▼
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Quick Agent │ │ Batch Agent │ │ Monitor Agent │
│ - Quick Q&A │ │ - Batch processing │ │ - System monitoring │
│ - Simple tasks │ │ - Data processing │ │ - Health check │
│ - Low-latency response │ │ - File operations │ │ - Alert notifications │
│ Model: flash │ │ Model: mini │ │ Model: mini │
└─────────────────┘ └─────────────────┘ └─────────────────┘~/.openclaw/agents/
├── main/ # Main Agent (Exists)
│ └── agent/
│ ├── AGENTS.md
│ ├── SOUL.md
│ └── ...
├── news/ # News Agent
│ └── agent/
│ ├── AGENTS.md
│ └── config.json
├── code/ # Code Agent
│ └── agent/
│ ├── AGENTS.md
│ └── config.json
├── research/ # Research Agent
│ └── agent/
│ ├── AGENTS.md
│ └── config.json
├── quick/ # Quick Response Agent
│ └── agent/
│ └── config.json
└── batch/ # Batch Processing Agent
└── agent/
└── config.json~/.openclaw/agents/news/agent/config.json{
"model": {
"primary": "anthropic/claude-sonnet-4-5"
},
"systemPrompt": "You are an expert in news scraping and summarization. Focus on:\n1. Scrape real news from authoritative sources\n2. Generate concise and accurate summaries\n3. Ensure each news item has the original link\n4. Push to specified channels on time",
"tools": {
"allow": ["web_fetch", "exec", "message"]
}
}~/.openclaw/agents/code/agent/config.json{
"model": {
"primary": "openrouter-vip/gpt-5.2-codex"
},
"systemPrompt": "You are a code expert. Focus on:\n1. High-quality code generation\n2. Bug analysis and fixing\n3. Code review and optimization\n4. Technical documentation writing",
"tools": {
"allow": ["read", "write", "edit", "exec"]
}
}~/.openclaw/agents/quick/agent/config.json{
"model": {
"primary": "google/gemini-flash-latest"
},
"systemPrompt": "You are a quick response assistant. Features:\n1. Concise and direct answers\n2. Low-latency response\n3. Handle simple queries\n4. Tasks that do not require in-depth analysis"
}{
"agents": {
"entries": {
"news": {
"enabled": true,
"allowSpawnFrom": ["main"]
},
"code": {
"enabled": true,
"allowSpawnFrom": ["main"]
},
"research": {
"enabled": true,
"allowSpawnFrom": ["main"]
},
"quick": {
"enabled": true,
"allowSpawnFrom": ["main"]
},
"batch": {
"enabled": true,
"allowSpawnFrom": ["main"]
}
},
"defaults": {
"maxConcurrent": 4,
"subagents": {
"maxConcurrent": 8
}
}
}
}| Task Type | Keywords | Target Agent | Model |
|---|---|---|---|
| News Scraping | news, news, morning briefing, push | news | sonnet |
| Code Tasks | code, code, bug, development | code | codex |
| In-depth Research | research, analysis, research | research | opus |
| Quick Q&A | simple, quick, query | quick | flash |
| Batch Processing | batch, batch, file | batch | mini |
| Complex Tasks | Retained in main | main | opus |
# Add intelligent spawn logic in AGENTS.md
## 🧠 Intelligent Task Distribution
When receiving a task, evaluate the following factors:
1. **Task Complexity**
- Simple queries → quick agent
- Medium tasks → specialized agents
- Complex tasks → handled by main or research agent
2. **Task Type**
- News-related → news agent
- Code-related → code agent
- Research and analysis → research agent
- Batch operations → batch agent
3. **Time Sensitivity**
- Requires quick response → quick agent
- Can wait → specialized agents
4. **Resource Consumption**
- High token consumption → use agents with cheaper models
- Requires high quality → use agents with opus
### Spawn Command Examples
```python
# News Task
sessions_spawn(
task="Scrape today's tech news and push to the DailyNews group",
agentId="news",
label="news-morning"
)
# Code Task
sessions_spawn(
task="Fix the login bug in auth.py",
agentId="code",
label="fix-auth-bug"
)
# Research Task
sessions_spawn(
task="In-depth analysis of GPT-5's technical architecture",
agentId="research",
label="gpt5-analysis"
)
# Quick Query
sessions_spawn(
task="Check today's weather",
agentId="quick",
label="weather-check"
){
"agents": {
"defaults": {
"maxConcurrent": 4, // Maximum concurrency for main agent
"subagents": {
"maxConcurrent": 8 // Maximum concurrency for sub agents
}
}
}
}User message → Main Agent
│
├─→ spawn(news) ──→ Scrape news
│
├─→ spawn(code) ──→ Fix bug
│
└─→ spawn(research) ──→ In-depth analysis
↓ (Executed in parallel)
Report after all tasks are completed{
"channels": {
"telegram": {
"defaultAgent": "main"
},
"whatsapp": {
"defaultAgent": "main"
}
},
"agents": {
"entries": {
"news": {
"channels": ["telegram-newsbot"]
}
}
}
}# List all sessions
openclaw sessions list
# View sessions for a specific agent
openclaw sessions list --agent news# In code
sessions_list(kinds=["spawn"], limit=10)# Set timeout when spawning
sessions_spawn(
task="...",
agentId="code",
runTimeoutSeconds=300, # 5-minute timeout
cleanup="keep" # Keep session for debugging
)