Overview
Theswrm 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
| Field | Required | Type | Default | Description |
|---|---|---|---|---|
type | Yes | "swrm" | — | Node type discriminator. Must be "swrm". |
agents | Yes | list of agent objects | — | Ordered list of agents to run in parallel. At least one required. |
concurrency | No | integer | all agents | Maximum number of agents to run at the same time. |
on_failure | No | "abort" | "continue" | "abort" | Failure policy when an agent raises an error. |
synthesis | No | synthesis object | none | Step that runs after all agents complete and produces the node’s canonical output. |
Agents
Each entry in theagents list is a self-contained LLM call with its own provider, model, and prompt template.
Agent Fields
| Field | Required | Type | Description |
|---|---|---|---|
id | Yes | string | Unique identifier within the swrm node. Used in template interpolation. |
provider | Yes | string | LLM provider: openai, anthropic, or ollama. |
model | No | string | Model name (e.g. gpt-4o-mini). Provider default used if omitted. |
prompt | Yes | string | Prompt template. Supports {{ variable }} interpolation. |
guardrails | No | list of strings | Agent-level guardrail override. |
Template Interpolation
Prompts inagents and the synthesis block support {{ variable }} placeholders. The template namespace includes:
| Path | Description |
|---|---|
{{ inputs.message }} | The raw user input string passed to the workflow. |
{{ working.* }} | Any value written to the working context by a prior node. |
{{ output.* }} | Any value written to the output context by a prior node. |
{{ <node_id>.agents.<agent_id>.output }} | Output of a specific agent (available in synthesis only). |
Example
Synthesis
The optionalsynthesis 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
| Field | Required | Type | Description |
|---|---|---|---|
provider | Yes | string | LLM provider. |
model | No | string | Model name. |
prompt | Yes | string | Prompt template. May reference agent outputs. |
guardrails | No | list of strings | Synthesis-level guardrail override. |
Output Shape
After a swrm node executes, its results are written to the workflow context:| Context path | Value |
|---|---|
output.<node_id> | Synthesis text (if synthesis defined); otherwise a list of agent outputs in definition order. |
working.<node_id>.agents.<agent_id>.output | Individual agent output text. |
Accessing Results
In downstream nodes or edges, reference swrm outputs like any other context value:Concurrency
By default, all agents run in parallel. Setconcurrency to limit the number of agents executing simultaneously:
Failure Policy
Control what happens when one or more agents raise an error usingon_failure:
| Value | Behaviour |
|---|---|
abort (default) | Raises SwrmAgentError with the agent’s id and underlying exception. The swrm node fails and execution stops. |
continue | Records the error in the trace but continues. Failed agents contribute an empty string to the output list. |
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:- 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
- 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 withsirenspec run, the output is rendered with a dedicated visual 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 succeededor2/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.
Complete Example
See the Market Analysis cookbook recipe for a full working workflow.nodes entry for the swrm node with:
agents— per-agent prompt, response, token count, and latencysynthesis— synthesis prompt, response, token count, and latencyoutput— the synthesis text (or list of agent outputs if no synthesis)tokens— total token count across all agents and synthesisduration_ms— total elapsed time