What This Example Shows
- A
HierarchicalSwarmconfigured as a virtual tumor board / case conference - An Attending Physician persona written to synthesize four specialist workers’ opinions: Radiologist, Pathologist, Cardiologist, and Hospitalist
- Why
HierarchicalSwarm’s real director is auto-generated by the framework (not the Attending Physician agent itself), and what to change to get a guaranteed synthesis pass - Concrete cost-per-case versus a real-world in-person multi-specialty consult
- The difference between this pattern and a generic hospital staff swarm (the worker roster here is physicians-only, focused on diagnostic synthesis rather than nursing workflow)
This example runs on premium swarm infrastructure. You will need an active Swarms account with available credits to execute it. Manage credits and plans at https://swarms.world/platform/account.
Why This Matters
A real multi-disciplinary case conference (oncology tumor board, complex-cardiology rounds, MDT meeting) requires four to six specialists in the same room for an hour — easily $1,500 to $2,500 per case in loaded physician time, before scheduling delays. The job to be done is not “answer a medical question.” It is structured synthesis across specialties so the attending walks out with one defensible plan. The hierarchical swarm replicates exactly that shape: parallel specialist opinions, then a director who decides. You spend cents, you wait under a minute, and you get an artifact you can hand to a licensed reviewer.Step 1: Setup
.env file:
Step 2: Configure the Case Conference
Step 3: Define the Patient Case
This is the kind of multi-system presentation a single-specialist agent would underperform on — exactly the case worth taking to a board.Step 4: Build the Swarm
The director’s prompt is intentionally framed around review, decide, and produce a single structured artifact — not “write everything you know.” Specialists each own one lane.Step 5: Run the Conference
HierarchicalSwarm always builds its own director from director_model_name (default gpt-5.4) that decomposes the task and dispatches it to every agent in agents — the Attending Physician above runs as one of the director’s workers, not as a privileged synthesizer, and with the default max_loops: 1 and parallel worker execution, no agent (Attending Physician included) sees another specialist’s output before writing its own. Each specialist responds independently to the same case. For a guaranteed synthesis pass, either set "max_loops": 2 on the swarm (the director’s second pass is handed every first-round output and can route the synthesis to the Attending Physician by name/description), or collect the four outputs client-side and issue one more /v1/agent/completions call using the Attending Physician’s system prompt.The Cost Story
A real multi-specialty case conference is one of the most expensive things a hospital does:
The point is not that the swarm replaces these clinicians. The point is that you can pre-screen, triage, and draft the conference note for the same cost as a cup of coffee, then put the licensed reviewer in the role they actually add value in: deciding.
Differentiation From Related Examples
- The Hospital Medical Team Swarm models a bedside care team (doctor + nurses + assistant) focused on intake and nursing tasks. This swarm models a case conference of physicians-only focused on diagnostic synthesis on a complex case.
- The ICD-10 Medical Analysis Swarm is a concurrent workflow for coding-level analysis. This swarm is hierarchical and produces a treatment plan, not codes.
Next Steps
- Try Claude Opus 4.8 as the model for the Attending Physician for stronger synthesis
- Adapt the worker roster for the Supply Chain Hierarchical Swarm pattern in any other domain
- Run a portfolio of cases overnight using Batch Swarm Completions