> ## Documentation Index
> Fetch the complete documentation index at: https://docs.swarms.world/llms.txt
> Use this file to discover all available pages before exploring further.

# Multi-Agent Structures Catalog

> Every multi-agent orchestration class and function shipped under swarms.structs, with one-line descriptions and source links

## Overview

`swarms.structs` is the library's multi-agent orchestration layer. Where the single-agent primitive (`Agent`) decides *what one model does on one turn*, the structures in this catalog decide *how a population of agents combines into a system that produces a single useful answer*. Each structure encodes a different opinion about how that combination should work — who talks to whom, in what order, how disagreement is resolved, and how results are merged.

The catalog roughly clusters into a handful of recurring patterns:

* **Pipelines and DAGs** — `SequentialWorkflow`, `ConcurrentWorkflow`, `AgentRearrange`, `SwarmRearrange`, `GraphWorkflow`, `BatchedGridWorkflow`, `SpreadSheetSwarm`. These let you describe the topology of execution explicitly, from a flat A→B→C line to a full directed acyclic graph with fan-out/fan-in, callbacks, and streaming. Use these when you already know the shape of the workflow.
* **Routers and selectors** — `SwarmRouter`, `MultiAgentRouter`, `AgentRouter`, `ModelRouter`, `AuctionSwarm`. These don't run a fixed plan; they look at the incoming task and pick which agent(s) (or which model) should handle it. The selector itself is either an LLM ("boss"), an embedding match, a skill-graph lookup, or — for `AuctionSwarm` — a market: each agent bids its own confidence and estimated cost, and the auctioneer awards the task to the best bid instead of trusting a boss LLM's guess. Use these when the input space is broader than any single agent's competence.
* **Hierarchies and delegation** — `HierarchicalSwarm`, `HierarchicalStructuredCommunicationFramework`, `HybridHierarchicalClusterSwarm`, `PlannerWorkerSwarm`. A director or supervisor decomposes the task and delegates pieces to workers, then synthesizes. The variants differ in how strictly the communication protocol is defined and whether the workers themselves can cluster and talk peer-to-peer.
* **Ensembles and consensus** — `MixtureOfAgents`, `SelfMoASeq`, `HeavySwarm`, `MajorityVoting`, `CouncilAsAJudge`, `LLMCouncil`, `DebateWithJudge`. The shared assumption is that one model's first answer is rarely the best answer. These structures sample multiple opinions and combine them — by aggregator synthesis, by vote, by judge ruling, or by structured adversarial debate.
* **Dialogue and discussion** — `GroupChat`, `ForestSwarm`, `AdvisorSwarm`, plus the two named-ritual templates that remain in `multi_agent_debates.py`: `OneOnOneDebate` (turn-based two-agent debate) and `ExpertPanelDiscussion` (moderator-guided expert panel). These run scripted conversational patterns end-to-end so you don't have to reimplement "moderated panel" or "structured debate" by hand. The other rituals — interview series, peer review, mediation, negotiation, brainstorming, council meeting, mentorship, trial simulation — have moved out of the library and now live under `examples/multi_agent/alternate_debates/`; copy the file you need rather than importing it.
* **Communication primitives and topology experiments** — the three message-passing primitives in `various_alt_swarms.py` (`OneToOne`, `Broadcast`, `OneToThree`) and the seven functional helpers in `swarming_architectures.py` (`circular_swarm`, `grid_swarm`, `star_swarm`, `mesh_swarm`, `pyramid_swarm`, `one_to_one`, and the async `broadcast`). These are the smallest possible building blocks: a sender, a receiver set, and a task. They exist for research and exploration — wiring a topology by hand to see whether the shape of the conversation, rather than the agents in it, is what moves the result. They're cheap to try because they share a tiny common interface.
* **Self-improvement and auto-construction** — `PlannerGeneratorEvaluator`, `AutoAgentBuilder`, `AutoSwarmBuilder`, `SocialAlgorithms`. These build or refine swarms dynamically: a planner negotiates contracts with a generator and evaluator; a builder reads a high-level description and spits out a configured swarm; `SocialAlgorithms` lets you upload an entirely custom communication protocol over a fixed agent set.

A few practical notes that apply across the whole catalog:

1. **Most structures take a `List[Agent]`.** Mix providers freely — a GPT agent and a Claude agent and a local Llama agent can sit side by side in `MixtureOfAgents` or `GroupChat`. The structure doesn't care; LiteLLM normalizes the calls.
2. **`SwarmRouter` is the meta-entry point.** If you're not sure which structure to commit to, instantiate one and change `swarm_type=` later — you don't have to rewrite the orchestration code.
3. **Topology choice is a lever, not a guess.** Sequential is cheapest and most deterministic. Concurrent is fastest end-to-end but loses ordering. Hierarchical pays an extra LLM call to the director in exchange for cleaner delegation. Ensembles pay N× tokens for variance reduction. Pick the trade-off, not the buzzword.

The table below lists every multi-agent structure currently shipped, with a one-line description and a direct link to its source file on GitHub.

<Note>
  **Not everything in this table is re-exported from the top-level package.** These names ship in the library but are absent from `__all__` in `swarms/structs/__init__.py`, so `from swarms import X` raises `ImportError` — import them by full module path instead, e.g. `from swarms.structs.tree_swarm import ForestSwarm`:

  `AgentRouter`, `AuctionSwarm`, `HierarchicalStructuredCommunicationFramework`, `PlannerWorkerSwarm`, `ForestSwarm`, `OneToOne`, `Broadcast`, `OneToThree`, `OneOnOneDebate`, `ExpertPanelDiscussion`, `ImageAgentBatchProcessor`, `AgentRegistry`.

  Everything else in the table is importable directly as `from swarms import X`.
</Note>

## Catalog

| Name                                           | Description                                                                                                                                                                 | Source                                                                                                                                                                    |
| ---------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `SequentialWorkflow`                           | Runs agents one after another; each step receives the previous output as context.                                                                                           | [sequential\_workflow.py](https://github.com/kyegomez/swarms/blob/master/swarms/structs/sequential_workflow.py)                                                           |
| `ConcurrentWorkflow`                           | Fires every agent in parallel on the same task; returns a per-agent result map.                                                                                             | [concurrent\_workflow.py](https://github.com/kyegomez/swarms/blob/master/swarms/structs/concurrent_workflow.py)                                                           |
| `AgentRearrange`                               | DSL-driven flow (`"A -> B, C -> D"`) mixing sequential and concurrent steps with optional human-in-the-loop.                                                                | [agent\_rearrange.py](https://github.com/kyegomez/swarms/blob/master/swarms/structs/agent_rearrange.py)                                                                   |
| `SwarmRearrange`                               | Same DSL as `AgentRearrange` but the nodes are whole swarms instead of single agents.                                                                                       | [swarm\_rearrange.py](https://github.com/kyegomez/swarms/blob/master/swarms/structs/swarm_rearrange.py)                                                                   |
| `GraphWorkflow`                                | Full DAG executor with topological sort, per-node callbacks, and token streaming.                                                                                           | [graph\_workflow.py](https://github.com/kyegomez/swarms/blob/master/swarms/structs/graph_workflow.py)                                                                     |
| `BatchedGridWorkflow`                          | Runs an agent×task grid of batched executions.                                                                                                                              | [batched\_grid\_workflow.py](https://github.com/kyegomez/swarms/blob/master/swarms/structs/batched_grid_workflow.py)                                                      |
| `SpreadSheetSwarm`                             | Treats a spreadsheet as the task table; each row becomes a concurrent agent run.                                                                                            | [spreadsheet\_swarm.py](https://github.com/kyegomez/swarms/blob/master/swarms/structs/spreadsheet_swarm.py)                                                               |
| `ImageAgentBatchProcessor`                     | Runs one agent over a batch of images concurrently with per-image error isolation.                                                                                          | [image\_batch\_processor.py](https://github.com/kyegomez/swarms/blob/master/swarms/structs/image_batch_processor.py)                                                      |
| `SwarmRouter`                                  | Single entry point that dispatches to any supported swarm type by name.                                                                                                     | [swarm\_router.py](https://github.com/kyegomez/swarms/blob/master/swarms/structs/swarm_router.py)                                                                         |
| `MultiAgentRouter`                             | LLM-driven "boss" routes a task to one or many specialist agents by capability.                                                                                             | [multi\_agent\_router.py](https://github.com/kyegomez/swarms/blob/master/swarms/structs/multi_agent_router.py)                                                            |
| `AgentRouter`                                  | Embedding-based router: matches a task to the best agent via cosine similarity over descriptions.                                                                           | [agent\_router.py](https://github.com/kyegomez/swarms/blob/master/swarms/structs/agent_router.py)                                                                         |
| `ModelRouter`                                  | Routes a task to the best *model* (not agent) given task requirements.                                                                                                      | [model\_router.py](https://github.com/kyegomez/swarms/blob/master/swarms/structs/model_router.py)                                                                         |
| `AuctionSwarm`                                 | Agents bid `(confidence, estimated_cost)` on a task via a forced tool call; the top-scoring bidder(s) execute it.                                                           | [auction\_swarm.py](https://github.com/kyegomez/swarms/blob/master/swarms/structs/auction_swarm.py)                                                                       |
| `HierarchicalSwarm`                            | Director agent decomposes the task and delegates to workers; synthesizes results.                                                                                           | [hiearchical\_swarm.py](https://github.com/kyegomez/swarms/blob/master/swarms/structs/hiearchical_swarm.py)                                                               |
| `HierarchicalStructuredCommunicationFramework` | "Talk Structurally, Act Hierarchically" — structured messages between supervisor / generator / evaluator / refiner roles.                                                   | [hierarchical\_structured\_communication\_framework.py](https://github.com/kyegomez/swarms/blob/master/swarms/structs/hierarchical_structured_communication_framework.py) |
| `HybridHierarchicalClusterSwarm`               | Hierarchy routes to clusters; inside clusters agents communicate peer-to-peer.                                                                                              | [hybrid\_hiearchical\_peer\_swarm.py](https://github.com/kyegomez/swarms/blob/master/swarms/structs/hybrid_hiearchical_peer_swarm.py)                                     |
| `PlannerWorkerSwarm`                           | Planner emits a task queue; a worker pool claims and executes tasks concurrently.                                                                                           | [planner\_worker\_swarm.py](https://github.com/kyegomez/swarms/blob/master/swarms/structs/planner_worker_swarm.py)                                                        |
| `SubagentRegistry`                             | Async subagent spawning with status tracking, result aggregation, retry policy, and depth-limited recursion.                                                                | [async\_subagent.py](https://github.com/kyegomez/swarms/blob/master/swarms/structs/async_subagent.py)                                                                     |
| `MixtureOfAgents`                              | N workers respond in parallel for L layers; aggregator synthesizes the final answer.                                                                                        | [mixture\_of\_agents.py](https://github.com/kyegomez/swarms/blob/master/swarms/structs/mixture_of_agents.py)                                                              |
| `SelfMoASeq`                                   | Sequential self-MoA: many samples from one strong model, sliding-window aggregation.                                                                                        | [self\_moa\_seq.py](https://github.com/kyegomez/swarms/blob/master/swarms/structs/self_moa_seq.py)                                                                        |
| `HeavySwarm`                                   | Decomposes a problem into specialized questions, runs each through deep multi-loop agents.                                                                                  | [heavy\_swarm.py](https://github.com/kyegomez/swarms/blob/master/swarms/structs/heavy_swarm.py)                                                                           |
| `MajorityVoting`                               | Agents vote; consensus agent synthesizes / breaks ties across loops.                                                                                                        | [majority\_voting.py](https://github.com/kyegomez/swarms/blob/master/swarms/structs/majority_voting.py)                                                                   |
| `CouncilAsAJudge`                              | Council evaluates a response across multiple dimensions; ranks/scores outputs.                                                                                              | [council\_as\_judge.py](https://github.com/kyegomez/swarms/blob/master/swarms/structs/council_as_judge.py)                                                                |
| `LLMCouncil`                                   | Independent expert agents respond, peer-review each other, then synthesize.                                                                                                 | [llm\_council.py](https://github.com/kyegomez/swarms/blob/master/swarms/structs/llm_council.py)                                                                           |
| `DebateWithJudge`                              | Adversarial debate rounds followed by a judge ruling; supports self-refinement.                                                                                             | [debate\_with\_judge.py](https://github.com/kyegomez/swarms/blob/master/swarms/structs/debate_with_judge.py)                                                              |
| `GroupChat`                                    | Turn-based, self-selecting chat — each turn every agent privately bids `(score, message)` via a forced tool call, and the highest bidder above `threshold` takes the floor. | [groupchat.py](https://github.com/kyegomez/swarms/blob/master/swarms/structs/groupchat.py)                                                                                |
| `ForestSwarm`                                  | A forest of `Tree`s of `TreeAgent`s; routes tasks to the best matching tree leaf.                                                                                           | [tree\_swarm.py](https://github.com/kyegomez/swarms/blob/master/swarms/structs/tree_swarm.py)                                                                             |
| `AdvisorSwarm`                                 | Cheap executor + powerful advisor consulted on-demand between turns.                                                                                                        | [advisor\_swarm.py](https://github.com/kyegomez/swarms/blob/master/swarms/structs/advisor_swarm.py)                                                                       |
| `PlannerGeneratorEvaluator`                    | Three-agent harness: Planner emits step contracts, Generator produces, Evaluator scores.                                                                                    | [planner\_generator\_evaluator.py](https://github.com/kyegomez/swarms/blob/master/swarms/structs/planner_generator_evaluator.py)                                          |
| `RoundRobinSwarm`                              | True round-robin distribution with optional turn awareness between agents.                                                                                                  | [round\_robin.py](https://github.com/kyegomez/swarms/blob/master/swarms/structs/round_robin.py)                                                                           |
| `AutoAgentBuilder`                             | Generates only the agent roster — name, description, system prompt, model — via a forced function call, leaving the architecture to you.                                    | [auto\_agent\_builder.py](https://github.com/kyegomez/swarms/blob/master/swarms/structs/auto_agent_builder.py)                                                            |
| `AutoSwarmBuilder`                             | Takes a high-level description and auto-generates agents, roles, and swarm structure.                                                                                       | [auto\_swarm\_builder.py](https://github.com/kyegomez/swarms/blob/master/swarms/structs/auto_swarm_builder.py)                                                            |
| `SocialAlgorithms`                             | Framework for uploading user-defined communication algorithms over a fixed agent set.                                                                                       | [social\_algorithms.py](https://github.com/kyegomez/swarms/blob/master/swarms/structs/social_algorithms.py)                                                               |
| `AgentRegistry`                                | Thread-safe registry of named agents with schema validation and lookup.                                                                                                     | [agent\_registry.py](https://github.com/kyegomez/swarms/blob/master/swarms/structs/agent_registry.py)                                                                     |
| `Broadcast`                                    | One sender broadcasts to many receivers.                                                                                                                                    | [various\_alt\_swarms.py](https://github.com/kyegomez/swarms/blob/master/swarms/structs/various_alt_swarms.py)                                                            |
| `OneToOne`                                     | Pair-wise direct communication between two agents.                                                                                                                          | [various\_alt\_swarms.py](https://github.com/kyegomez/swarms/blob/master/swarms/structs/various_alt_swarms.py)                                                            |
| `OneToThree`                                   | One sender hands off to exactly three receivers.                                                                                                                            | [various\_alt\_swarms.py](https://github.com/kyegomez/swarms/blob/master/swarms/structs/various_alt_swarms.py)                                                            |
| `OneOnOneDebate`                               | Turn-based debate between two agents for N loops.                                                                                                                           | [multi\_agent\_debates.py](https://github.com/kyegomez/swarms/blob/master/swarms/structs/multi_agent_debates.py)                                                          |
| `ExpertPanelDiscussion`                        | Moderator-guided panel of expert agents.                                                                                                                                    | [multi\_agent\_debates.py](https://github.com/kyegomez/swarms/blob/master/swarms/structs/multi_agent_debates.py)                                                          |
| `circular_swarm`                               | Functional `(agents, tasks)` circular topology.                                                                                                                             | [swarming\_architectures.py](https://github.com/kyegomez/swarms/blob/master/swarms/structs/swarming_architectures.py)                                                     |
| `grid_swarm`                                   | Functional agent×task grid execution.                                                                                                                                       | [swarming\_architectures.py](https://github.com/kyegomez/swarms/blob/master/swarms/structs/swarming_architectures.py)                                                     |
| `star_swarm`                                   | Functional star topology — central hub, peripheral workers.                                                                                                                 | [swarming\_architectures.py](https://github.com/kyegomez/swarms/blob/master/swarms/structs/swarming_architectures.py)                                                     |
| `mesh_swarm`                                   | Functional mesh topology — random task pull.                                                                                                                                | [swarming\_architectures.py](https://github.com/kyegomez/swarms/blob/master/swarms/structs/swarming_architectures.py)                                                     |
| `pyramid_swarm`                                | Functional pyramid topology — top-down task flow.                                                                                                                           | [swarming\_architectures.py](https://github.com/kyegomez/swarms/blob/master/swarms/structs/swarming_architectures.py)                                                     |
| `one_to_one`                                   | Functional direct send/reply between two agents.                                                                                                                            | [swarming\_architectures.py](https://github.com/kyegomez/swarms/blob/master/swarms/structs/swarming_architectures.py)                                                     |
| `broadcast`                                    | Functional one-sender-to-many-receivers (**async** — must be awaited).                                                                                                      | [swarming\_architectures.py](https://github.com/kyegomez/swarms/blob/master/swarms/structs/swarming_architectures.py)                                                     |
| `one_on_one_debate`                            | Functional turn-based two-agent debate; procedural twin of `OneOnOneDebate`.                                                                                                | [deep\_discussion.py](https://github.com/kyegomez/swarms/blob/master/swarms/structs/deep_discussion.py)                                                                   |
| `aggregate`                                    | Runs N agents concurrently on one task and synthesizes their outputs via an aggregator agent.                                                                               | [ma\_blocks.py](https://github.com/kyegomez/swarms/blob/master/swarms/structs/ma_blocks.py)                                                                               |

## Conclusion

The breadth of this catalog is deliberate: there is no single "right" way to compose agents. A linear pipeline beats a hierarchy when the work is well-decomposed. A hierarchy beats a pipeline when the decomposition itself is the hard part. An ensemble beats either when correctness matters more than latency. A debate beats an ensemble when the failure mode is one-sided reasoning rather than random noise. The structures here exist so you can pick the one whose assumptions match your task instead of bending one general-purpose pattern to fit every problem.

A pragmatic way to use the catalog:

1. **Start with the simplest structure that could plausibly work.** A `SequentialWorkflow` or `ConcurrentWorkflow` is usually enough for a first pass and forces you to confirm the underlying agents are doing their jobs before you add coordination overhead.
2. **Reach for `SwarmRouter` when prototyping.** Swapping `swarm_type=` between `"SequentialWorkflow"`, `"MixtureOfAgents"`, `"HierarchicalSwarm"`, and `"MajorityVoting"` is a one-line change and a fast way to see which topology actually helps on your task.
3. **Escalate to a heavier pattern only when you can name the failure it fixes.** Adding `CouncilAsAJudge` because the single-agent answers are inconsistent across criteria is a good reason; adding it because "more agents is better" usually just buys variance and cost.
4. **Treat the primitives in `various_alt_swarms.py` and `swarming_architectures.py` as a research playground.** `OneToOne`, `Broadcast`, and `OneToThree` — plus the functional helpers alongside them — are bare message-passing wiring rather than finished orchestrators. They share a tiny interface, are cheap to try, and are useful when you want to ask empirical questions like "does this task benefit from a fan-out step before the agents converge?"
5. **Reach for `SocialAlgorithms` or the auto-builders only when nothing in the built-in set fits.** Most production workloads land cleanly on one of the canonical patterns; reinventing the protocol or auto-generating the swarm is a last resort, not a default.

If you're adding a new pattern of your own, the convention is straightforward: subclass nothing required, accept a `List[Agent]` and any structure-specific config, expose `.run(task)` and (ideally) `.batch_run(tasks)`, and let `find_agent_by_name`, `Conversation`, and the helpers in `multi_agent_exec` handle the boring parts. Drop the new file in `swarms/structs/`, export it from `swarms/structs/__init__.py`, and add a row to this table.
