Skip to main content

Overview

The swrm node type lets you fan out to a static, author-defined set of agents that all run concurrently against the same workflow input. After every agent completes, an optional synthesis step combines their outputs into a single response. This pattern is sometimes called a committee of experts: each agent contributes a specialist perspective, and a final model synthesises them into a coherent answer.

Node Fields


Agents

Each entry in the agents list is a self-contained LLM call with its own provider, model, and prompt template.

Agent Fields


Template Interpolation

Prompts in agents and the synthesis block support {{ variable }} placeholders. The template namespace includes:

Example


Synthesis

The optional synthesis block is a single LLM call that runs after all agents have completed. Its prompt can reference every agent’s output. The synthesis output becomes the node’s canonical output.

Synthesis Fields


Output Shape

After a swrm node executes, its results are written to the workflow context:

Accessing Results

In downstream nodes or edges, reference swrm outputs like any other context value:

Concurrency

By default, all agents run in parallel. Set concurrency to limit the number of agents executing simultaneously:
This is useful when you are rate-limited by the provider or want to control cost.

Failure Policy

Control what happens when one or more agents raise an error using on_failure:

SwrmAgentError

When on_failure: abort (the default), any agent failure raises SwrmAgentError:

Committee-of-Experts Pattern

The committee-of-experts pattern decomposes a complex analytical task into specialist sub-tasks and then synthesises the results:
When to use swrm:
  • Analysing a document from multiple angles (sentiment + risk + opportunity)
  • Generating multiple candidate responses and picking the best
  • Parallelising independent LLM calls to reduce total latency
  • Building a reviewer panel where each agent judges a different criterion
When NOT to use swrm:
  • Tasks where agents need to share intermediate state (use sequential nodes with edges)
  • Dynamic agent sets determined at runtime (see factory: node type)

CLI Output

When you run a workflow containing a swrm node with sirenspec run, the output is rendered with a dedicated visual layout:
Layout:
  • Opening rule — Shows the swarm name and agent count.
  • Agent panels — Each agent’s output is rendered in its own Rich panel, in definition order.
  • Closing rule — Displays success/failure tally (e.g., 3/3 succeeded or 2/3 succeeded, 1 failed) and total swarm duration.
  • Synthesis panel — If synthesis is configured and successful, its output is shown in a final panel (omitted if no synthesis or no string output).
  • Writes arrow — Shows the context path where the node output was written.
Failed agents display their error message in a red-bordered panel instead of the response text.

Complete Example

See the Market Analysis cookbook recipe for a full working workflow.
The trace will include a nodes entry for the swrm node with:
  • agents — per-agent prompt, response, token count, and latency
  • synthesis — synthesis prompt, response, token count, and latency
  • output — the synthesis text (or list of agent outputs if no synthesis)
  • tokens — total token count across all agents and synthesis
  • duration_ms — total elapsed time

Trace Structure

A swrm node produces the following trace entry: