Skip to main content
Swarm Type: HeavySwarm

Overview

The HeavySwarm is a sophisticated multi-agent orchestration system inspired by X.AI’s Grok 4 Heavy architecture. It automatically decomposes complex tasks into specialized questions and executes them using a built-in team of specialized agents — by default Research, Analysis, Alternatives, Verification, and Synthesis. Unlike other swarm types, HeavySwarm creates and manages its own agents internally — pass an empty agents array ("agents": []) in the request. The size and composition of that internal team is controlled by heavy_swarm_variant (see below). Key features:
  • Automatic Task Decomposition: Complex tasks are intelligently broken down into specialized questions using function calling
  • Specialized Agent Teams: In the default variant, Research, Analysis, Alternatives, Verification, and Synthesis agents work in concert
  • Parallel Execution: Specialist agents execute simultaneously for maximum efficiency
  • Iterative Refinement: Multi-loop execution where each loop builds upon previous results
  • Comprehensive Synthesis: A dedicated synthesis agent integrates all findings into an executive-ready report

Architecture

The HeavySwarm follows a structured 5-phase workflow:
  1. Task Decomposition — A question generation agent analyzes the input task and creates four specialized questions using function calling
  2. Parallel Execution — Four specialized agents (Research, Analysis, Alternatives, Verification) execute their questions simultaneously
  3. Result Collection — Outputs are validated and collected from all agents
  4. Synthesis — A fifth Synthesis agent integrates all results into a comprehensive report
  5. Iterative Refinement — When heavy_swarm_max_loops > 1, the process repeats with context from previous iterations

Specialized Agents

HeavySwarm-Specific Parameters

Since HeavySwarm manages its own agents, it uses dedicated parameters at the swarm configuration level: heavy_swarm_variant swaps the entire worker roster, not just a setting:
heavy_swarm_worker_model_name applies to every worker in the chosen variant. The question-generation phase always uses heavy_swarm_question_agent_model_name, regardless of variant.

Use Cases

  • Deep research and comprehensive market analysis
  • Due diligence and investment research
  • Policy analysis and strategic planning
  • Technology assessment and competitive intelligence
  • Complex problem-solving requiring multiple perspectives
  • Medical or scientific research synthesis

API Usage

Basic HeavySwarm Example

Multi-Loop Deep Analysis Example

Use multiple loops for iterative refinement where each loop builds upon the previous results:
Example Response:
Because the request’s agents array stays empty, number_of_agents in the response — and the flat per-agent billing fee that scales with it — is 0 for HeavySwarm, regardless of how many workers the chosen heavy_swarm_variant actually runs internally. You are still billed for the input and output tokens all of those internal agents consume.

Best Practices

  • Use HeavySwarm for complex tasks that benefit from multi-perspective analysis rather than simple queries
  • Start with heavy_swarm_max_loops: 1 and increase only when deeper iterative analysis is needed
  • Choose the question agent model carefully — it determines the quality of task decomposition which drives the entire workflow
  • Use a capable worker model (e.g., claude-sonnet-4-20250514) for the specialized agents to get high-quality research, analysis, and verification
  • HeavySwarm requires an empty agents array ("agents": []) in the request — the worker team is created and managed internally, sized by heavy_swarm_variant
  • For time-sensitive tasks, keep max_loops at 1; increase for comprehensive research where thoroughness is prioritized over speed
  • Schedule non-urgent deep analysis during off-peak hours (8 PM - 6 AM PT) for cost savings