Overview
TheHeavySwarm class is a sophisticated multi-agent orchestration system that decomposes a complex task into specialized questions, runs a team of agents on them in parallel, and synthesizes the results into a comprehensive response. The variant parameter selects the agent line-up — from a five-agent default team up to a sixteen-agent deep-research team — and max_loops enables iterative refinement.
Class Definition
Parameters
Name identifier for the swarm instance
Description of the swarm’s purpose and capabilities
Maximum execution time per agent in seconds
Language model for question generation
Language model for specialized worker agents
Enable detailed logging and debug output
Enable rich dashboard with progress visualization
Enable individual agent output printing
Output format type for conversation history
Tools available to worker agents for enhanced functionality
Maximum number of execution loops for the entire swarm. Each loop builds upon previous results for iterative refinement
Which agent line-up to instantiate. See Selecting a Variant below. Passing an unknown variant raises
ValueError during initializationSelecting a Variant
Thevariant parameter controls which agents are created and how many specialized questions the task is decomposed into.
SwarmVariant is exported from swarms.agents.heavy_swarm_agents.
variant | Agents | Questions generated |
|---|---|---|
"default" | 5 — Research, Analysis, Alternatives, Verification, Synthesis | 4 |
"medium" | 4 — Captain Swarm + Harper, Benjamin, Lucas | 3 |
"heavy" | 16 — Grok captain + 15 domain specialists | 15 |
"medium" roster
| Agent | Role |
|---|---|
| Captain Swarm | Leader and orchestrator |
| Harper | Research and facts — evidence gathering and fact verification |
| Benjamin | Logic, math, and code — rigorous reasoning and computational verification |
| Lucas | Creative and divergent thinking — contrarian analysis and blind-spot detection |
"heavy" roster
A Grok captain decomposes the task into 15 domain-specific questions; the 15 specialists answer them in parallel, then the captain synthesizes a single response.
| Agent | Domain |
|---|---|
| Grok | Lead coordinator and synthesizer |
| Harper | Creative writing and storytelling |
| Benjamin | Data, finance and economics |
| Lucas | Coding, programming and technical builds |
| Olivia | Literature, arts and culture |
| James | History, politics and philosophy |
| Charlotte | Math, statistics and logic |
| Henry | Engineering, robotics and innovation |
| Mia | Biology, health and medicine |
| William | Business strategy and entrepreneurship |
| Sebastian | Physics, astronomy and hard sciences |
| Jack | Psychology and human behavior |
| Owen | Environment, sustainability and global systems |
| Luna | Space exploration and futurism |
| Elizabeth | Ethics, policy and critical thinking |
| Noah | Long-term innovation and systems thinking |
Specialized Agents (default variant)
With the default variant, the HeavySwarm creates and manages 5 specialized agents:Research Agent
Expert in comprehensive information gathering, data collection, market research, and source verification. Specializes in systematic literature reviews, competitive intelligence, and statistical data interpretation. System Prompt Focus:- Comprehensive task analysis
- Evidence-based research
- Source credibility assessment
- Reproducible methodologies
Analysis Agent
Expert in advanced statistical analysis, pattern recognition, predictive modeling, and causal relationship identification. Specializes in regression analysis, forecasting, and performance metrics development. System Prompt Focus:- Data quality assessment
- Statistical rigor
- Quantified uncertainty
- Practical interpretation
Alternatives Agent
Expert in strategic thinking, creative problem-solving, innovation ideation, and strategic option evaluation. Specializes in design thinking, scenario planning, and exploring diverse solutions. System Prompt Focus:- Diverse option generation
- Trade-off analysis
- Risk assessment
- Implementation planning
Verification Agent
Expert in validation, feasibility assessment, fact-checking, and quality assurance. Specializes in risk assessment, compliance verification, and implementation barrier analysis. System Prompt Focus:- Fact-checking protocols
- Feasibility validation
- Risk identification
- Evidence triangulation
Synthesis Agent
Expert in multi-perspective integration, comprehensive analysis, and executive summary creation. Specializes in strategic alignment, conflict resolution, and holistic solution development. System Prompt Focus:- Multi-input integration
- Consensus building
- Prioritized recommendations
- Stakeholder communication
Methods
run()
The main task to analyze and iterate upon
Image input if needed for visual analysis tasks
Comprehensive final answer from the synthesis step after all loops complete
- For first loop: Execute original task with full orchestration
- For subsequent loops: Combine previous results with original task as context
- Question generation: Generate specialized questions for the active variant’s agents
- Parallel execution: Run the variant’s specialized agents concurrently
- Synthesis: Integrate all agent results into a comprehensive response
- Iteration: Repeat for max_loops, building upon previous results
reliability_check()
- worker_model_name is set
- question_agent_model_name is set
ValueError: If a required model name is missing, or ifvariantis unknown
show_swarm_info()
- Swarm identification (name, description)
- Execution parameters (timeout)
- Model configurations (question and worker models)
- Selected variant
Question Generation Schema
The default variant decomposes the task into four specialized questions:"medium" and "heavy" variants use their own schemas (3 and 15 questions respectively).
Usage Example
Multi-Loop Execution
Themax_loops parameter enables iterative refinement:
- Loop 1: Initial analysis of the task
- Loop 2+: Refinement based on previous results
- Each loop builds upon context from previous iterations
- Enables deeper analysis and progressive refinement
Dashboard Features
Whenshow_dashboard=True, the HeavySwarm displays:
- Configuration Panel: Swarm parameters and settings
- Reliability Checks: Animated validation with progress tracking
- Question Generation: Real-time progress for specialized questions
- Agent Execution: Individual progress bars for each agent
- Synthesis Phase: Integration and final report generation
- Completion Summary: Mission accomplished with professional styling
Performance Optimization
- Parallel Execution: The active variant’s specialized agents run concurrently
- Thread Pool: Workers run across a pool sized to roughly 90% of the host’s CPU cores
- Timeout Management: Per-agent timeout controls