| name | agent-orchestration |
| description | Orchestrate AI agents using Claude Flow, swarm coordination, and multi-agent workflows. Use for complex tasks requiring multiple specialized agents, parallel execution, or coordinated problem-solving. |
Agent Orchestration Skill
Overview
This skill enables orchestration of multiple AI agents for complex tasks. It covers swarm initialization, agent spawning, task coordination, and multi-agent workflows using Claude Flow and the workspace-hub agent ecosystem.
Agent Categories
Core Agents
| Agent | Purpose |
|---|---|
coder |
Implementation and coding |
reviewer |
Code review and quality |
tester |
Testing and verification |
planner |
Strategic planning |
researcher |
Information gathering |
SPARC Agents
| Agent | Purpose |
|---|---|
specification |
Requirements analysis |
pseudocode |
Algorithm design |
architecture |
System design |
refinement |
TDD implementation |
Specialized Agents
| Agent | Purpose |
|---|---|
backend-dev |
Backend/API development |
ml-developer |
Machine learning |
cicd-engineer |
CI/CD pipelines |
system-architect |
Architecture design |
api-docs |
API documentation |
GitHub Agents
| Agent | Purpose |
|---|---|
pr-manager |
Pull request management |
code-review-swarm |
Automated code review |
issue-tracker |
Issue management |
Swarm Topologies
Hierarchical
Coordinator delegates to specialized workers:
┌─────────────────┐
│ Coordinator │
└────────┬────────┘
│
┌────────────┼────────────┐
│ │ │
▼ ▼ ▼
┌───────┐ ┌───────┐ ┌───────┐
│Worker1│ │Worker2│ │Worker3│
└───────┘ └───────┘ └───────┘
Best for: Complex tasks with clear subtask boundaries
// Initialize hierarchical swarm
mcp__claude-flow__swarm_init({
topology: "hierarchical",
maxAgents: 5,
strategy: "auto"
})
Mesh
Peer-to-peer collaboration:
┌───────┐ ┌───────┐
│Agent A│◄───►│Agent B│
└───┬───┘ └───┬───┘
│ ╲ ╱ │
│ ╲╱ │
│ ╱╲ │
│ ╱ ╲ │
┌───▼───┐ ┌───▼───┐
│Agent C│◄───►│Agent D│
└───────┘ └───────┘
Best for: Collaborative tasks requiring shared context
mcp__claude-flow__swarm_init({
topology: "mesh",
maxAgents: 4
})
Star
Central hub with peripheral agents:
┌───────┐
│Agent A│
└───┬───┘
│
┌───────┐ ┌─▼─┐ ┌───────┐
│Agent B├──►Hub◄──┤Agent C│
└───────┘ └─┬─┘ └───────┘
│
┌───▼───┐
│Agent D│
└───────┘
Best for: Tasks with central coordination point
mcp__claude-flow__swarm_init({
topology: "star",
maxAgents: 6
})
Ring
Sequential processing:
┌───────┐ ┌───────┐
│Agent A│────►│Agent B│
└───┬───┘ └───┬───┘
▲ │
│ ▼
┌───┴───┐ ┌───────┐
│Agent D│◄────│Agent C│
└───────┘ └───────┘
Best for: Pipeline processing, sequential workflows
mcp__claude-flow__swarm_init({
topology: "ring",
maxAgents: 4
})
Agent Spawning
Spawn Single Agent
mcp__claude-flow__agent_spawn({
type: "coder",
name: "implementation-agent",
capabilities: ["python", "typescript", "api-development"]
})
Spawn Multiple Agents in Parallel
mcp__claude-flow__agents_spawn_parallel({
agents: [
{ type: "coder", name: "backend-coder" },
{ type: "tester", name: "test-writer" },
{ type: "reviewer", name: "code-reviewer" }
],
maxConcurrency: 3
})
Agent Types
// Available agent types
const agentTypes = [
"coordinator",
"analyst",
"optimizer",
"documenter",
"monitor",
"specialist",
"architect",
"task-orchestrator",
"code-analyzer",
"perf-analyzer",
"api-docs",
"performance-benchmarker",
"system-architect",
"researcher",
"coder",
"tester",
"reviewer"
];
Task Orchestration
Simple Task
mcp__claude-flow__task_orchestrate({
task: "Implement user authentication with JWT",
strategy: "sequential",
priority: "high"
})
Complex Task with Dependencies
mcp__claude-flow__task_orchestrate({
task: "Build complete API with tests and documentation",
strategy: "adaptive",
priority: "high",
dependencies: [
"design-api-spec",
"write-tests",
"implement-endpoints",
"create-documentation"
]
})
Orchestration Strategies
| Strategy | Description |
|---|---|
parallel |
Execute independent tasks simultaneously |
sequential |
Execute tasks in order |
adaptive |
Dynamically adjust based on results |
balanced |
Balance load across agents |
Workflow Patterns
1. Code Review Swarm
// Initialize review swarm
await mcp__claude-flow__swarm_init({
topology: "hierarchical",
maxAgents: 4
});
// Spawn review agents
await mcp__claude-flow__agents_spawn_parallel({
agents: [
{ type: "reviewer", name: "security-reviewer" },
{ type: "reviewer", name: "performance-reviewer" },
{ type: "reviewer", name: "style-reviewer" }
]
});
// Orchestrate review
await mcp__claude-flow__task_orchestrate({
task: "Review PR #123 for security, performance, and style",
strategy: "parallel"
});
2. Feature Implementation
// Sequential SPARC workflow
await mcp__claude-flow__swarm_init({ topology: "ring" });
// Phase agents
const phases = [
{ type: "specialist", name: "specification-agent" },
{ type: "specialist", name: "pseudocode-agent" },
{ type: "architect", name: "architecture-agent" },
{ type: "coder", name: "implementation-agent" },
{ type: "tester", name: "testing-agent" }
];
await mcp__claude-flow__agents_spawn_parallel({ agents: phases });
await mcp__claude-flow__task_orchestrate({
task: "Implement new feature following SPARC methodology",
strategy: "sequential"
});
3. Research and Analysis
// Mesh for collaborative research
await mcp__claude-flow__swarm_init({ topology: "mesh" });
await mcp__claude-flow__agents_spawn_parallel({
agents: [
{ type: "researcher", name: "literature-reviewer" },
{ type: "analyst", name: "data-analyst" },
{ type: "documenter", name: "summary-writer" }
]
});
await mcp__claude-flow__task_orchestrate({
task: "Research and analyze best practices for microservices",
strategy: "adaptive"
});
Monitoring and Status
Check Swarm Status
mcp__claude-flow__swarm_status({ swarmId: "current" })
Monitor Agent Metrics
mcp__claude-flow__agent_metrics({ agentId: "agent-123" })
List Active Agents
mcp__claude-flow__agent_list({ swarmId: "current" })
Get Task Results
mcp__claude-flow__task_results({ taskId: "task-456" })
Memory Management
Store Information
mcp__claude-flow__memory_usage({
action: "store",
key: "project-context",
value: JSON.stringify(projectData),
namespace: "project-alpha"
})
Retrieve Information
mcp__claude-flow__memory_usage({
action: "retrieve",
key: "project-context",
namespace: "project-alpha"
})
Search Memory
mcp__claude-flow__memory_search({
pattern: "api-*",
namespace: "project-alpha",
limit: 10
})
Performance Optimization
Topology Selection
Choose topology based on task:
| Task Type | Recommended Topology |
|---|---|
| Code review | Hierarchical |
| Brainstorming | Mesh |
| Pipeline processing | Ring |
| Centralized coordination | Star |
| Mixed workloads | Adaptive |
Auto-Optimize
mcp__claude-flow__topology_optimize({ swarmId: "current" })
Load Balancing
mcp__claude-flow__load_balance({
swarmId: "current",
tasks: ["task1", "task2", "task3"]
})
Error Handling
Fault Tolerance
mcp__claude-flow__daa_fault_tolerance({
agentId: "agent-123",
strategy: "restart" // or "failover", "ignore"
})
Recovery
// Create snapshot
mcp__claude-flow__state_snapshot({ name: "before-risky-operation" })
// Restore if needed
mcp__claude-flow__context_restore({ snapshotId: "snapshot-id" })
Integration with Claude Code
Using Task Tool
For complex tasks, use Claude Code's Task tool:
Task({
description: "Complex multi-step analysis",
prompt: "Analyze codebase and suggest improvements",
subagent_type: "code-analyzer"
})
Parallel Agent Execution
Launch multiple agents in parallel:
// Single message with multiple Task calls
Task({ subagent_type: "researcher", ... })
Task({ subagent_type: "coder", ... })
Task({ subagent_type: "reviewer", ... })
Best Practices
Agent Selection
- Match agent to task: Use specialized agents
- Limit concurrency: Don't spawn too many agents
- Clear instructions: Provide detailed prompts
- Monitor progress: Check status regularly
Swarm Management
- Choose appropriate topology: Based on task structure
- Set reasonable timeouts: Prevent hung agents
- Use memory for context: Share information between agents
- Clean up: Destroy swarms when done
Error Handling
- Plan for failures: Use fault tolerance
- Create snapshots: Before risky operations
- Log extensively: For debugging
- Graceful degradation: Handle partial failures
Cleanup
Destroy Swarm
mcp__claude-flow__swarm_destroy({ swarmId: "swarm-123" })
Scale Down
mcp__claude-flow__swarm_scale({
swarmId: "current",
targetSize: 2
})
Version History
- 1.0.0 (2024-10-15): Initial release with swarm topologies, agent spawning, task orchestration, memory management, performance optimization