v2/benchmark/docs/coordination-modes.md
This guide explains the 5 coordination modes available for agent swarm orchestration and when to use each one.
| Mode | Structure | Best For | Agent Count | Overhead |
|---|---|---|---|---|
| Centralized | Single coordinator | Simple tasks | 2-4 | Low (~50ms) |
| Distributed | Multiple coordinators | Parallel work | 4-8 | Medium (~100ms) |
| Hierarchical | Tree structure | Complex projects | 5-10 | Medium (~80ms) |
| Mesh | Peer-to-peer | Collaborative | 3-6 | High (~150ms) |
| Hybrid | Adaptive mix | Variable tasks | 4-8 | Variable |
A single coordinator agent manages all tasks and delegates to worker agents.
[Coordinator]
/ | \
[Agent1] [Agent2] [Agent3]
swarm-benchmark run "Build user login form" \
--mode centralized \
--max-agents 3
Multiple coordinators share responsibility for task management.
[Coordinator1] [Coordinator2]
/ \ / \
[A1] [A2] [A3] [A4]
swarm-benchmark run "Research cloud providers and pricing" \
--mode distributed \
--max-agents 8 \
--parallel
Tree structure with multiple levels of coordination.
[Root Coordinator]
/ \
[Manager1] [Manager2]
/ \ / \
[W1] [W2] [W3] [W4]
swarm-benchmark run "Develop microservices architecture" \
--mode hierarchical \
--max-agents 10 \
--quality-threshold 0.9
# Optimal hierarchy structure
if agent_count <= 4:
levels = 2 # Root + workers
elif agent_count <= 10:
levels = 3 # Root + managers + workers
else:
levels = 3 # Keep at 3, add more managers
Peer-to-peer network where agents communicate directly.
[Agent1] ββ [Agent2]
β β³ β
[Agent3] ββ [Agent4]
swarm-benchmark run "Analyze dataset collaboratively" \
--mode mesh \
--max-agents 6 \
--consensus-threshold 0.8
# Communication complexity
connections = n * (n - 1) / 2 # Full mesh
# For 6 agents: 15 connections
# For 10 agents: 45 connections (too many!)
Adaptive coordination that switches between modes based on task requirements.
Task Analysis β Mode Selection β Dynamic Coordination
β β β
[Centralized] [Distributed] [Hierarchical]
swarm-benchmark run "Complete project with research, development, and testing" \
--mode hybrid \
--max-agents 8 \
--adaptive
def select_mode(task, agents):
if agents <= 3:
return "centralized"
elif task.is_parallel():
return "distributed"
elif task.is_complex():
return "hierarchical"
elif task.needs_consensus():
return "mesh"
else:
return "centralized" # default
| Metric | Centralized | Distributed | Hierarchical | Mesh | Hybrid |
|---|---|---|---|---|---|
| Setup Time | β‘ Fast | Medium | Medium | Slow | Variable |
| Coordination | β‘ Minimal | Medium | Medium | High | Adaptive |
| Scalability | β Poor | β Good | β Excellent | β Poor | β Good |
| Reliability | β Low | β High | Medium | β Highest | β High |
| Complexity | β‘ Simple | Medium | Medium | Complex | Complex |
| If you need... | Use this mode |
|---|---|
| Quick results with few agents | Centralized |
| Parallel processing | Distributed |
| Complex project management | Hierarchical |
| Collaborative decision making | Mesh |
| Flexibility for various tasks | Hybrid |
# Centralized: Minimize agents
swarm-benchmark run "Task" --mode centralized --max-agents 3
# Distributed: Balance load
swarm-benchmark run "Task" --mode distributed --max-agents 6
# Hierarchical: Optimal tree
swarm-benchmark run "Task" --mode hierarchical --max-agents 9
# Mesh: Limit connections
swarm-benchmark run "Task" --mode mesh --max-agents 4
# Reduce coordination overhead
optimization_tips = {
"centralized": "Batch task assignments",
"distributed": "Minimize coordinator sync",
"hierarchical": "Reduce tree depth",
"mesh": "Limit peer connections",
"hybrid": "Cache mode decisions"
}
def recommend_mode(task_type, agent_count, priority):
if priority == "speed" and agent_count <= 3:
return "centralized"
elif priority == "reliability":
return "mesh" if agent_count <= 5 else "distributed"
elif priority == "scalability":
return "hierarchical"
elif task_type == "research":
return "distributed"
elif task_type == "development":
return "hierarchical"
else:
return "hybrid" # Let system decide
# Fine-tune coordination behavior
swarm-benchmark run "Task" \
--mode distributed \
--coordinator-count 3 \
--sync-interval 500 \
--consensus-timeout 30
# Configure hybrid mode behavior
swarm-benchmark run "Task" \
--mode hybrid \
--mode-switch-threshold 0.7 \
--preferred-modes "distributed,hierarchical" \
--adaptation-rate 0.2
# Enable fault tolerance features
swarm-benchmark run "Task" \
--mode distributed \
--enable-failover \
--coordinator-redundancy 2 \
--heartbeat-interval 10
# Real-time coordination monitoring
swarm-benchmark run "Task" --mode hierarchical --monitor-coordination
# Post-execution analysis
swarm-benchmark analyze <benchmark-id> --coordination-metrics
# Compare mode efficiency
swarm-benchmark compare-modes <task-type> --agent-counts 3,5,8
Remember: The optimal coordination mode depends on your specific task requirements, team size, and performance goals. Always benchmark to find the best fit!