HeavySwarm takes one hard question and attacks it from several angles at once. A question generator splits your task into one focused question per specialist. The specialists answer in parallel, each in its own autonomous loop. A synthesis agent then reads every answer and writes one report. You pick the size of the team with variant, and with max_loops the swarm can refine its own report.
The swarm builds all of its agents for you. You choose the models, not the agents.
Reference: HeavySwarm.
Variants
question_agent_model_name sets the model that writes the questions. worker_model_name sets the model for every specialist and for the synthesizer. Both default to gpt-5.4.
1. Preview the questions
get_questions_only() runs only the question generator, which is one model call. Use it to see how the swarm will split a task before you pay for a full run.
harper_question, benjamin_question and lucas_question. In our run, Harper was asked for evidence from comparable companies, Benjamin for a revenue and churn model under three scenarios, and Lucas for hidden failure modes and hybrid pricing ideas. If the generator returns no questions, you get {"error": "..."} instead.
2. Run the swarm
output_type="dict-all-except-first", run() returns every message after your task:
The synthesizer receives your task and every message above as chat turns, and its prompt asks for a structured report: for the medium variant, an executive summary, each specialist’s findings, conflict resolution, recommendations, risks and next steps.
3. Compare variants
The default variant splits the task into four questions.get_questions_as_list() returns them in a fixed order: research, analysis, alternatives, verification.
agents prints ['research', 'analysis', 'alternatives', 'verification', 'synthesis']. The heavy variant builds 16 agents and asks 15 questions, so it costs several times as much as the medium one.
4. Refine over several loops
Withmax_loops=2, the swarm runs twice. The second time, the question generator gets the first report and your task, and writes questions that dig into what is still missing. The synthesizer always works from your original task. output_type="final" returns only the last report.
worker_tools. Every agent in the swarm gets them, the synthesizer too.
Reading the output
Each
run() clears the conversation and resets every agent, so a reused swarm starts fresh.
When something fails
- No questions. If the question generator returns no questions or unreadable ones,
run()raisesRuntimeError("Error in question generation: ...").get_questions_only()returns{"error": ...}, andget_questions_as_list()returns a one-item list starting withError:. - A specialist fails. The error is logged and that specialist’s answer is left out of the conversation. The other specialists continue, and the synthesizer writes its report from the answers it has.
- The synthesizer fails.
run()raises its error.
Tips
- Start with
variant="medium". It has the fewest agents and shows the whole flow. - Watch it live.
show_dashboard=Trueshows progress for each phase, andagent_prints_on=Trueprints each specialist’s output. The synthesizer always prints its report. - Specialists work in threads. The pool is sized to 95% of the machine’s CPU cores, with at least one thread.
Next steps
- HeavySwarm reference
- Autonomous mode, the loop each specialist runs
- Token usage
- Runnable scripts