Workflow definition

Edges and branches

The graph: one start, no cycles, nothing unreachable. Conditions, switches and merges each have shapes the definition insists on.

one trigger edgeno cyclesbranch names are checked
Using Python?

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

edges: [
  { from: "__trigger", to: "classify" },
  { from: "classify", to: "check" },
  { from: "check", to: "urgent",  branch: "true" },
  { from: "check", to: "normal",  branch: "false" },
  { from: "urgent", to: "join" },
  { from: "normal", to: "join" },
]
edges = [
    {"from": "__trigger", "to": "classify"},
    {"from": "classify", "to": "check"},
    {"from": "check", "to": "urgent", "branch": "true"},
    {"from": "check", "to": "normal", "branch": "false"},
    {"from": "urgent", "to": "join"},
    {"from": "normal", "to": "join"},
]
fromstringrequired

A step id, or __trigger for the start.

tostringrequired

A step id.

branchstringnext

Which output. true/false on a condition, a case key or default on a switch.

The rules

RuleRefusal
Exactly one edge from __triggerthe workflow must have one
No step connects to itselfa step cannot link to itself
No cycle anywherethe graph contains a loop
Every step reachable from the triggerunreachable steps, named
The trigger uses next onlythe trigger uses only the next branch

Three types have required shapes

TypeMust have
conditionexactly one true edge and one false edge
switchone edge per case, plus default
mergeat least two incoming edges, and at most one next out
Missing a branch is refused, not defaulted

A condition with only a true edge would end the run, without a word, whenever the answer was false. Requiring both means every path is a path somebody wrote.

Parallel fan-out

Several edges from one step on the same branch run in parallel. A merge step is how they come back together — and it needs at least two inputs, since merging one thing is not merging.

Without edges

The order of steps is the chain: trigger to the first, each to the next. The simple case stays simple, and no graph is written for a straight line.