Skip to content

bbuxton0823/agent-swarm-orchestrator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

1 Commit
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Dynamic Agent Swarm Orchestrator

A hierarchical system for coordinating 20-100+ specialized AI agents based on task complexity analysis

GitHub Stars License: MIT Version

Overview

While static agent pools assign predetermined roles to tasks, Dynamic Agent Swarm Orchestrator analyzes task complexity and intelligently spawns specialized agents with the right skills, models, and coordination patterns.

Inspired by: Kimi 2.5's 100-agent swarms and Claude Code's hidden swarm feature Built for: Complex multi-domain projects requiring adaptive scaling Optimized for: Cost efficiency through intelligent model routing

๐ŸŽฏ Core Innovation

Traditional Approach:

Complex Task โ†’ Fixed Pool of 4-5 Agents โ†’ Force-fit roles

Our Approach:

Complex Task โ†’ Analysis Engine โ†’ Dynamic Agent Creation โ†’ Hierarchical Coordination

Scaling Patterns

Task Complexity Agents Coordination Example
Simple 1-3 Direct Write tweet, basic research
Moderate 4-8 Flat Build landing page, market analysis
Complex 9-20 Hierarchical Full web app, comprehensive strategy
Enterprise 21-50+ Matrix Platform development, business transformation

๐Ÿ—๏ธ Architecture

1. Master Orchestrator

Role: Task analysis and high-level coordination

class MasterOrchestrator:
    def analyze_task(self, task):
        return {
            'complexity': self.assess_complexity(task),
            'domains': self.identify_domains(task),
            'timeline': self.estimate_timeline(task),
            'resources': self.calculate_resources(task)
        }
    
    def design_swarm(self, analysis):
        return self.create_coordination_hierarchy(analysis)

2. Division Coordinators

Role: Manage functional areas (Research, Development, Content, QA)

class DivisionCoordinator:
    def __init__(self, domain, max_agents=15):
        self.domain = domain  # 'research', 'development', 'content', 'qa'
        self.squad_leaders = []
        self.max_agents = max_agents
    
    def spawn_squads(self, requirements):
        return self.create_specialized_squads(requirements)

3. Squad Leaders

Role: Coordinate 3-5 specialist agents within a functional area

class SquadLeader:
    def __init__(self, specialty, model="sonnet-4"):
        self.specialty = specialty  # 'frontend', 'backend', 'data-analysis'
        self.agents = []
        self.model = model
    
    def coordinate_agents(self, task_chunks):
        return self.parallel_execution(task_chunks)

4. Specialist Agents

Role: Execute specific tasks with targeted skills

class SpecialistAgent:
    def __init__(self, role, skills, model):
        self.role = role
        self.skills = skills  # Subset of available skills
        self.model = model    # Cost-optimized routing
        self.outputs = []

๐Ÿ“Š Coordination Hierarchy Example

Task: "Build comprehensive real estate analytics platform" Projected Swarm: 32 agents across 4 divisions

Master Orchestrator (Opus 4.5)
โ”œโ”€โ”€ Research Division Coordinator (Sonnet 4)
โ”‚   โ”œโ”€โ”€ Market Research Squad (5 agents)
โ”‚   โ”‚   โ”œโ”€โ”€ Industry Analyst (DeepSeek + research)
โ”‚   โ”‚   โ”œโ”€โ”€ Competitor Analyst (DeepSeek + research)  
โ”‚   โ”‚   โ”œโ”€โ”€ Trend Analyst (Kimi + research + youtube-watcher)
โ”‚   โ”‚   โ”œโ”€โ”€ Data Collector (DeepSeek + research + excel)
โ”‚   โ”‚   โ””โ”€โ”€ Insights Synthesizer (Sonnet + research + excel)
โ”‚   โ”œโ”€โ”€ Technical Research Squad (3 agents)
โ”‚   โ”‚   โ”œโ”€โ”€ API Researcher (DeepSeek + research)
โ”‚   โ”‚   โ”œโ”€โ”€ Tech Stack Analyst (Sonnet + research)
โ”‚   โ”‚   โ””โ”€โ”€ Integration Specialist (Sonnet + research)
โ”‚   โ””โ”€โ”€ User Research Squad (3 agents)
โ”‚       โ”œโ”€โ”€ UX Researcher (Kimi + research)
โ”‚       โ”œโ”€โ”€ User Journey Mapper (Sonnet + research)
โ”‚       โ””โ”€โ”€ Requirements Analyst (Sonnet + research)
โ”‚
โ”œโ”€โ”€ Development Division Coordinator (Sonnet 4)
โ”‚   โ”œโ”€โ”€ Frontend Squad (6 agents)
โ”‚   โ”‚   โ”œโ”€โ”€ React Developer (Sonnet + remotion + frontend-design)
โ”‚   โ”‚   โ”œโ”€โ”€ UI Component Builder (Sonnet + remotion)
โ”‚   โ”‚   โ”œโ”€โ”€ CSS Specialist (Kimi + frontend-design)
โ”‚   โ”‚   โ”œโ”€โ”€ Mobile Developer (Sonnet + remotion)
โ”‚   โ”‚   โ”œโ”€โ”€ Performance Optimizer (Sonnet + remotion)
โ”‚   โ”‚   โ””โ”€โ”€ Accessibility Expert (Kimi + frontend-design)
โ”‚   โ”œโ”€โ”€ Backend Squad (5 agents)
โ”‚   โ”‚   โ”œโ”€โ”€ API Developer (Sonnet + research + excel)
โ”‚   โ”‚   โ”œโ”€โ”€ Database Designer (Sonnet + excel)
โ”‚   โ”‚   โ”œโ”€โ”€ Auth Specialist (Sonnet + research)
โ”‚   โ”‚   โ”œโ”€โ”€ Analytics Engineer (Sonnet + excel + research)
โ”‚   โ”‚   โ””โ”€โ”€ Performance Engineer (Sonnet + research)
โ”‚   โ””โ”€โ”€ DevOps Squad (3 agents)
โ”‚       โ”œโ”€โ”€ Infrastructure Engineer (Sonnet + research)
โ”‚       โ”œโ”€โ”€ CI/CD Specialist (Kimi + research)
โ”‚       โ””โ”€โ”€ Security Engineer (Sonnet + research)
โ”‚
โ”œโ”€โ”€ Content Division Coordinator (Gemini 2.0)
โ”‚   โ”œโ”€โ”€ Content Creation Squad (4 agents)
โ”‚   โ”‚   โ”œโ”€โ”€ Technical Writer (Gemini + humanizer)
โ”‚   โ”‚   โ”œโ”€โ”€ Marketing Copywriter (Gemini + tweet-writer + humanizer)
โ”‚   โ”‚   โ”œโ”€โ”€ UI Copy Writer (Gemini + humanizer)
โ”‚   โ”‚   โ””โ”€โ”€ Documentation Specialist (Gemini + humanizer)
โ”‚   โ””โ”€โ”€ Design Squad (3 agents)
โ”‚       โ”œโ”€โ”€ Visual Designer (Gemini + frontend-design)
โ”‚       โ”œโ”€โ”€ Brand Specialist (Gemini + tweet-writer)
โ”‚       โ””โ”€โ”€ Asset Creator (Gemini + remotion)
โ”‚
โ””โ”€โ”€ Quality Division Coordinator (Kimi K2.5)
    โ”œโ”€โ”€ QA Squad (3 agents)
    โ”‚   โ”œโ”€โ”€ Functional Tester (Kimi + self-improvement)
    โ”‚   โ”œโ”€โ”€ Integration Tester (Kimi + research + self-improvement)
    โ”‚   โ””โ”€โ”€ Performance Tester (Kimi + research)
    โ””โ”€โ”€ Review Squad (2 agents)
        โ”œโ”€โ”€ Code Reviewer (Kimi + self-improvement)
        โ””โ”€โ”€ Content Reviewer (Kimi + humanizer + self-improvement)

๐Ÿ’ฐ Cost Optimization

Intelligent Model Routing:

  • Master Orchestrator: 1 Opus agent ($20/day) - Strategic decisions only
  • Division Coordinators: 4 Sonnet agents ($20/day) - Complex coordination
  • Squad Leaders: 8 Sonnet agents ($30/day) - Technical leadership
  • Specialists: 19 DeepSeek/Kimi agents ($25/day) - Execution tasks

Total: ~$95/day for enterprise-level 32-agent development team

๐Ÿš€ Dynamic Scaling Logic

def determine_swarm_architecture(task_analysis):
    complexity = task_analysis['complexity']
    domains = task_analysis['domains']
    timeline = task_analysis['timeline']
    
    if complexity == "simple":
        return FlatCoordination(max_agents=3)
    elif complexity == "moderate":  
        return FlatCoordination(max_agents=8)
    elif complexity == "complex":
        return HierarchicalCoordination(
            divisions=len(domains),
            max_agents_per_division=15
        )
    else:  # enterprise
        return MatrixCoordination(
            functional_divisions=4,
            project_coordinators=3,
            max_total_agents=50
        )

๐ŸŽฎ Coordination Protocols

Message Flow Patterns

# Hierarchical Flow
Master โ†’ Division Coordinator โ†’ Squad Leader โ†’ Specialist Agent

# Cross-Division Coordination  
Research Division โ†’ Development Division (via Master Orchestrator)

# Emergency Escalation
Specialist Agent โ†’ Squad Leader โ†’ Division Coordinator โ†’ Master Orchestrator

Communication Standards

class CoordinationMessage:
    def __init__(self, sender, recipient, message_type, content, priority):
        self.sender = sender
        self.recipient = recipient
        self.type = message_type  # 'task', 'status', 'escalation', 'resource_request'
        self.content = content
        self.priority = priority  # 'low', 'normal', 'high', 'urgent'
        self.timestamp = datetime.now()

๐Ÿ“ˆ Performance Metrics

Metric Small Swarm (3-8) Large Swarm (20-50)
Setup Time 2-5 minutes 10-15 minutes
Coordination Overhead 5-10% 15-25%
Parallel Efficiency 85-95% 70-80%
Cost vs Single Agent 1.5x 2.5-3x
Quality Improvement 2-3x 4-5x

๐Ÿ› ๏ธ Implementation

Quick Start

# Clone and setup
git clone https://github.com/bbuxton0823/agent-swarm-orchestrator
cd agent-swarm-orchestrator
pip install -r requirements.txt

# Run example swarm
python examples/real_estate_platform.py

Integration with OpenClaw

from swarm_orchestrator import MasterOrchestrator

orchestrator = MasterOrchestrator(
    session_spawn_tool=sessions_spawn,
    available_skills=["research", "excel", "remotion", "humanizer", "tweet-writer"],
    model_config={
        "orchestrator": "opus-4.5",
        "coordinators": "sonnet-4", 
        "specialists": "deepseek"
    }
)

result = orchestrator.execute_task("Build real estate analytics platform")

๐Ÿ“š Documentation

๐Ÿค Contributing

This project showcases advanced AI coordination patterns. We welcome:

  • New coordination algorithms
  • Cost optimization strategies
  • Real-world case studies
  • Performance improvements

See CONTRIBUTING.md for guidelines.

๐Ÿ“„ License

MIT License - Build amazing things with AI agent swarms.


Built by: Bycha Buxton & Monday Butters
Inspired by: The hidden agent swarm capabilities in Claude Code and Kimi 2.5's orchestration innovation