Workflow steps

switch

type: "switch"

Several branches. One value, a list of cases, and a default — with an edge for every one of them.

freecases requireddefault always exists
Using Python?

Switch any code block to Python: the choice applies to every page. Python SDK guide and resource reference.

valueany

What to test. Usually a template.

casesarrayrequired

[{ key, operator, value }]. At least one.

{ id: "route", type: "switch", config: {
    value: "{{steps.classify.output.kind}}",
    cases: [
      { key: "billing", operator: "eq", value: "billing" },
      { key: "bug",     operator: "eq", value: "bug" },
    ],
} }

edges: [
  { from: "route", to: "to_finance", branch: "billing" },
  { from: "route", to: "to_support", branch: "bug" },
  { from: "route", to: "to_inbox",   branch: "default" },
]
{"id": "route", "type": "switch", "config": {
    "value": "{{steps.classify.output.kind}}",
    "cases": [
        {"key": "billing", "operator": "eq", "value": "billing"},
        {"key": "bug", "operator": "eq", "value": "bug"},
    ],
}}

edges = [
    {"from": "route", "to": "to_finance", "branch": "billing"},
    {"from": "route", "to": "to_support", "branch": "bug"},
    {"from": "route", "to": "to_inbox", "branch": "default"},
]

Case keys

A letter, then letters, digits, _ or -. They may not be next, true, false or default, and they may not repeat — all four are refused on save, because each one would make an edge ambiguous.

default is not optional

Every case needs an edge, and so does default

A value matching nothing takes default. Without that edge the run would end there, without a word — the same reason a condition needs both branches.

Output

{{steps.route.output.branch}}   // the case key taken, or "default"
{{steps.route.output.value}}
"{{steps.route.output.branch}}"   # the case key taken, or "default"
"{{steps.route.output.value}}"

The first matching case wins

They are tried in order, so put the specific ones first.