HeavySwarm is a multi-agent orchestration system inspired by X.AI’s Grok Heavy implementation. It decomposes a task into role-specific questions, runs those questions through specialized expert agents in parallel, and then synthesizes the outputs into a single comprehensive answer. The exact set of experts is controlled by the variant parameter.
When to Use
- Complex research tasks — in-depth investigation across multiple angles
- Financial analysis — investment decisions requiring multiple viewpoints
- Strategic planning — comprehensive evaluation of options and trade-offs
- Due diligence — thorough verification and risk assessment
- Multi-faceted problems — issues that need research, analysis, and synthesis combined
Key Features
- Intelligent question generation tailored to each agent role
- Three preset variants —
default(5 agents),medium(4 Grok-style agents),heavy(16 agents) - True parallel execution via a
ThreadPoolExecutor - Synthesis agent that integrates expert outputs into a final answer
- Optional real-time
richdashboard - Multi-loop iterative refinement (each loop builds on the previous result)
- Tool integration through
worker_tools - Inherits
SerializableMixin—to_dict()is available for telemetry / persistence
Architecture
Basic Example
With Tool Integration
Selecting a Variant
Thevariant parameter controls which agents are instantiated.
SwarmVariant is exported from swarms.agents.heavy_swarm_agents. Passing an unknown variant raises ValueError during initialization.
Specialized Agents (default variant)
Research Agent
- Comprehensive information gathering
- Data collection and validation
- Source verification
- Literature review
- Statistical data interpretation
Analysis Agent
- Pattern recognition
- Statistical analysis
- Predictive modeling
- Data interpretation
- Performance metrics
Alternatives Agent
- Strategic thinking
- Creative problem-solving
- Option generation
- Trade-off evaluation
- Scenario planning
Verification Agent
- Fact-checking
- Feasibility assessment
- Risk analysis
- Compliance verification
- Quality assurance
Synthesis Agent
- Multi-perspective integration
- Comprehensive analysis
- Executive summary creation
- Strategic alignment
- Actionable recommendations
Key Parameters
Identifier for the swarm instance.
Description of the swarm’s purpose.
Maximum execution time per agent in seconds.
Model used by the question-generation agent.
Model used by every specialized worker agent.
Enable detailed logging output.
Enable the real-time
rich progress dashboard.Print each agent’s individual output.
Format of the returned conversation history.
Tools made available to all worker agents.
Number of full swarm iterations. Each loop refines the previous synthesis.
Which agent line-up to instantiate. See Selecting a Variant above.
Methods
run(task, img=None)
Execute the full multi-phase workflow.
to_dict()
Inherited from SerializableMixin. Returns a JSON-friendly snapshot of the swarm’s config. The agents, conversation, dashboard, and worker_tools attributes are excluded via _to_dict_exclude to keep the snapshot lightweight.
Question Generation
The question agent emits a JSON object whose schema depends on the variant. For the default variant it looks like:Multi-Loop Refinement
Withmax_loops > 1 the swarm iterates, each loop feeding the previous synthesis back as context:
- Loop 1: original task only
- Loop 2:
"Previous loop results: <output> | Original task: <task>" - Loop 3: same shape — refine, fill gaps, deepen the analysis
Dashboard Features
Whenshow_dashboard=True, the HeavySwarmDashboard renders rich progress panels:
Configuration Panel:
- Swarm name and description
- Model configuration (question + worker)
- Timeout and worker counts
- Animated progress bars
- Per-component validation status
- Real-time generation progress
- Per-agent progress bars
- Status (INITIALIZING, PROCESSING, GENERATING, COMPLETE)
- Variant-aware agent labels
- Integration progress
- Final report generation
- Completion confirmation
Use Cases
Investment Analysis
Market Research with Live Web Data
Strategic Planning
Heavy Variant for Deep Research
Performance Notes
Parallel Execution
All workers fan out viaconcurrent.futures.ThreadPoolExecutor. max_workers defaults to roughly 0.9 * os.cpu_count().
Timeout Management
Verbose Logging
Output Structure
The swarm returns the conversation history formatted byoutput_type. With the default "dict-all-except-first":
Best Practices
Model Selection: use stronger models (Claude Sonnet, GPT-5.4) for worker agents on complex tasks.
- Question Quality — a stronger question-generation model produces tighter, less overlapping expert questions.
- Worker Models — balance cost vs quality for the worker pool; mixing providers via LiteLLM works out of the box.
- Loop Count — start at
max_loops=1. Add more only when the synthesis clearly needs refinement. - Variant Choice —
defaultcovers most tasks; reach forheavyonly when you genuinely benefit from 15+ specialist perspectives. - Dashboard — leave on for demos and debugging; off for production.
- Tools — supply
worker_toolswhen the task requires real-time data (search, web fetch, etc.).
Reliability Checks
reliability_check() runs automatically during __init__:
show_dashboard=True, the validation steps animate through the dashboard. Otherwise a single confirmation panel prints.
Conversation History
Access the full transcript through the conversation object:Error Handling
Related Architectures
- Mixture of Agents — parallel experts + aggregator (lighter weight)
- Hierarchical Swarm — director-worker delegation pattern
- Concurrent Workflow — simpler parallel execution
- Agent Rearrange — custom flow patterns
- Structures Catalog — full enumeration of every multi-agent structure