Skip to content

Switch

Step · Stable

Value-dispatch — route one value into N case arms plus a default.

The N-ary complement of Branch. Where Branch asks a yes/no question (a predicate), a Switch takes ONE value (a Jinja expression resolving to a scalar/enum) and routes it to the arm whose case-value equals it — like switch(stage){ won / lost / in_progress / default }.

  1. The value is rendered, then string-compared against each case-value; the first match wins.
  2. Each declared case-value gets its own labelled out-edge; one extra edge labelled “default” catches every unmatched value.
  3. Arms are exclusive — exactly one fires per run. Reconnect them downstream with a Merge.
  4. A value matching no case AND no default simply ends that path (the run completes) — it is not an error. Use a Switch (not nested Branches) whenever you dispatch one value into 3+ buckets — it is far more legible.

Use when an upstream step produces a scalar value with three or more meaningful categories — e.g. a deal stage (won/lost/in-progress), a classification result, or an actor choice from a list. Each case value gets its own arm; unmatched values fall through to the default arm.

For a simple yes/no decision use Branch — it is lighter and more readable for binary outcomes. Reconnect all arms afterwards with Merge if they should share downstream steps.

string · required

A {{ reference }} to the value being dispatched.

Example: {{ ask_stage.actor_response }}

list · optional

The discrete values to route on; each gets an out-edge. Unmatched values take the default arm.


Auto-generated from the skill registry (load_skills()). Do not edit by hand.