Multi-Agent Collaboration
One of OpenClaw's most powerful features is the ability to run multiple specialized agents that collaborate on complex tasks. Instead of one agent doing everything, you can create focused agents that each excel at a specific domain, then coordinate them through a primary agent.
What You'll Learn
By the end of this lesson, you will understand how to configure multiple agents using AGENTS.md, design effective delegation patterns, and build agent teams that handle complex multi-step workflows.
Understanding AGENTS.md
The AGENTS.md file in your OpenClaw workspace defines additional specialized agents beyond your primary agent. Each agent has its own identity, skills, and purpose.
Basic Agent Definition
## research-agent
**Model:** anthropic/claude-sonnet-4-6
**Description:** Deep research and fact-checking specialist
**Skills:** web-search, arxiv-reader, wikipedia
**Instructions:**
- Focus on finding primary sources and peer-reviewed material
- Always cite your sources with links
- Flag uncertainty levels (high/medium/low confidence)
- Summarize findings in structured bullet points
Each agent definition includes:
- Model ā You can assign different models to different agents. Use a powerful model like Opus for complex reasoning tasks, and a faster model like Sonnet or Haiku for simpler tasks.
- Description ā A concise explanation of what this agent specializes in. The primary agent uses this to decide when to delegate.
- Skills ā Which skills this agent has access to. Keep skill sets focused and relevant.
- Instructions ā Behavioral guidelines specific to this agent's role.
Why Multiple Agents?
A single general-purpose agent works well for simple tasks, but struggles with complex workflows that require different expertise. Consider these scenarios:
Without multi-agent: You ask your agent to "research competitor pricing, analyze the data in a spreadsheet, and draft a presentation." One agent tries to do all three with varying quality.
With multi-agent: A research agent gathers competitor data with web search skills. A data agent analyzes the spreadsheet with calculation tools. A writing agent crafts the presentation. Each agent uses the right model and skills for its task.
Cost Optimization
Multi-agent setups also help manage costs:
- Assign expensive models (Opus) only to agents that need deep reasoning
- Use affordable models (Haiku) for simple tasks like formatting or basic lookups
- Route tasks to the cheapest capable agent automatically
Delegation Patterns
Hub and Spoke
The most common pattern. Your primary agent acts as a coordinator, delegating specific tasks to specialized agents:
Primary Agent (coordinator)
āāā Research Agent ā web search, fact-checking
āāā Code Agent ā writing and reviewing code
āāā Writing Agent ā drafting documents and emails
āāā Data Agent ā analysis and visualization
The primary agent receives your message, breaks it into subtasks, delegates each to the appropriate specialist, collects results, and synthesizes a final response.
Chain Pattern
Agents pass work sequentially, each building on the previous agent's output:
Research Agent ā Analysis Agent ā Writing Agent ā Review Agent
This works well for content pipelines: research gathers raw material, analysis extracts insights, writing creates a draft, and review polishes the final output.
Supervisor Pattern
A supervisor agent monitors other agents' work and provides quality control:
## supervisor-agent
**Model:** anthropic/claude-opus-4-6
**Description:** Reviews other agents' work for accuracy and quality
**Instructions:**
- Check all factual claims against sources
- Verify code for bugs and security issues
- Ensure writing meets tone and style guidelines
- Send work back for revision if quality is insufficient
Configuring Agent Teams
Example: Content Creation Team
## researcher
**Model:** anthropic/claude-sonnet-4-6
**Description:** Finds information, statistics, and sources on any topic
**Skills:** web-search, arxiv-reader
**Instructions:**
- Find at least 3 credible sources per claim
- Prioritize recent data (last 12 months)
- Include direct quotes where relevant
- Return findings as structured notes with source links
## writer
**Model:** anthropic/claude-opus-4-6
**Description:** Crafts polished long-form content from research notes
**Skills:** writing-tools
**Instructions:**
- Write in a clear, engaging style
- Use the inverted pyramid structure
- Include headers, bullet points, and examples
- Target 8th grade reading level
## editor
**Model:** anthropic/claude-sonnet-4-6
**Description:** Proofreads and improves written content
**Instructions:**
- Fix grammar, spelling, and punctuation
- Improve sentence flow and transitions
- Ensure consistent tone throughout
- Check that all claims have supporting evidence from the research
Example: Development Team
## architect
**Model:** anthropic/claude-opus-4-6
**Description:** Designs system architecture and technical approaches
**Skills:** code-tools, documentation
**Instructions:**
- Consider scalability, security, and maintainability
- Provide clear rationale for design decisions
- Create architecture diagrams when helpful
## developer
**Model:** anthropic/claude-sonnet-4-6
**Description:** Implements code based on architectural decisions
**Skills:** code-tools, testing-tools, git-tools
**Instructions:**
- Follow the architect's design specifications
- Write clean, well-tested code
- Include error handling and edge cases
## reviewer
**Model:** anthropic/claude-sonnet-4-6
**Description:** Reviews code for bugs, security, and best practices
**Skills:** code-tools, security-scanner
**Instructions:**
- Check for OWASP top 10 vulnerabilities
- Verify error handling is comprehensive
- Ensure tests cover critical paths
Agent Communication
How Agents Share Context
When your primary agent delegates to a specialist, it passes along:
- The specific subtask ā A clear description of what needs to be done
- Relevant context ā Background information from the conversation
- Constraints ā Format requirements, deadlines, or quality standards
- Previous agent outputs ā Results from earlier agents in a chain
The specialist agent works independently, then returns its results to the coordinator. The coordinator can then pass those results to another agent or synthesize them into a final response.
Controlling Delegation
You can influence which agents get used through your prompts:
- "Have the research agent look into this" ā Explicitly names the agent
- "I need a thorough analysis" ā The coordinator recognizes this matches the data agent
- "Draft and review this email" ā The coordinator chains the writer and editor agents
You can also set rules in SOUL.md:
## Delegation Rules
- Always use the researcher for any factual claims
- Route all code-related tasks through the reviewer before responding
- Use the editor for any external-facing written content
Best Practices
Start simple. Begin with your primary agent and add specialists only when you notice specific tasks that would benefit from focused expertise.
Keep agent roles clear. Each agent should have a well-defined specialty. Overlapping responsibilities create confusion about which agent to use.
Match models to complexity. Use powerful models for reasoning-heavy tasks and lighter models for straightforward work. This balances quality with cost.
Test delegation. After setting up agents, test them with representative tasks. Watch the logs (openclaw logs) to see how delegation is working and adjust instructions.
Limit agent count. Two to four specialized agents cover most use cases. More agents add coordination overhead without proportional benefit.
Key Takeaways
- AGENTS.md defines specialized agents with their own models, skills, and instructions.
- Multi-agent setups excel at complex workflows that require different types of expertise.
- Common patterns include Hub and Spoke (coordinator delegates), Chain (sequential handoff), and Supervisor (quality control).
- Match AI models to task complexity ā use powerful models for reasoning, lighter models for simple tasks.
- Start with one or two specialist agents and expand only when needed.

