Overview
Complex tasks often require different expertise. klaw supports multi-agent workflows where specialized agents collaborate, each contributing their unique capabilities. This guide covers patterns for effective multi-agent orchestration.Why Multi-Agent?
Single agents work well for focused tasks. But consider:| Task | Better Approach |
|---|---|
| ”Fix this bug” | Single agent (coder) |
| “Research best practices, implement them, then write docs” | Multi-agent workflow |
| ”Review PR for code quality, security, and performance” | Multiple specialized reviewers |
Orchestrator Routing
The simplest multi-agent pattern uses the orchestrator to route messages:Configure Orchestrator
Automatic Routing
Messages are automatically routed:Manual Routing
Override with@agent syntax:
Agent Spawning
Agents can spawn sub-agents for specific tasks:Using agent_spawn Tool
In Practice
Workflow Patterns
Sequential Pipeline
Each agent’s output feeds the next:Parallel Execution
Independent tasks run simultaneously:Supervisor Pattern
A coordinator agent manages workers:Creating Specialized Teams
Development Team
Research Team
DevOps Team
Namespace-Based Teams
Organize agents into namespaces for isolation:Communication Patterns
Shared Context via Workspace
Agents share knowledge through workspace files:Message Passing (Slack)
In Slack, agents can communicate via channels:Task Dependencies
Use cron or dispatch with dependencies:Best Practices
Define clear boundaries
Define clear boundaries
Each agent should have a specific, non-overlapping responsibility. Avoid agents that do “everything.”
Establish communication protocols
Establish communication protocols
Define how agents share information—workspace files, specific channels, or structured handoffs.
Verify handoffs
Verify handoffs
When one agent finishes, another should verify the output before continuing.
Monitor and adjust
Monitor and adjust
Track which patterns work well. Some tasks may be better with fewer, more capable agents.

