Guard with escalation
Block a handler and route the failure to a named event instead of rejecting it.on_fail is one of reject (default), discard, kill, or escalate:{event}.
See Guards.
Multi-gate pipeline
Track sub-steps with gates, then reset them when re-entering a cycle.Accumulate and compute
Wait for several items, aggregate them, then branch on the result.Fan out
Dispatch one event per item; each event resolves into its own template-flow instance (with its own agent), and a stagedjoin: owns completion.
examples/routing/fan-in/barrier
and Parallel work.
Rules-based routing
Dispatch on a payload field.rules is a list; the matched rule owns the emit.
rules and on_complete are mutually exclusive; using both is a load-time error caught by
swarm verify.
See Branching.
Dynamic flow instances
One instance (and one entity) per order or customer. The usual way needs no creation call at all — the template flow’s input pin mints the instance when the first event for a new identity arrives:fulfillment/schema.yaml
create_flow_instance action instead — see Composing flows for
that form and the return path. Either way, results come back through the child’s output pin
and a connect edge; the carried identity does the addressing.
Timers
“An entity sat here too long” is a stage timer — declared on the stage, armed on entry, cancelled when the entity leaves:schema.yaml
{{...}} reads a value from the flow’s policy. For time that a stage cannot anchor —
event-triggered delays, or boot-anchored recurring work like a nightly report — declare a
node timer with start_on: event:<name> or start_on: boot (see
nodes.yaml).
Cross-entity queries
Read across entities to build a report.query accepts either a single query object or a list of them (as here), and each store_as
target is an entity field. store_as is always entity-prefixed (entity.<field>).
Payload transform
Build an output payload from entity state, payload, and policy withemit.fields —
and when names match, from: entity fills the required same-named fields for you
(see Emitting events).

