Decision
A Decision node routes a run. It has one branch per case, each with its own conditions and its own output on the node. The run takes the first branch whose conditions hold, top to bottom, and only that branch’s edges fire. Steps on the other branches are skipped.
To let a run through or stop it, with no choice between paths, use a Conditional.
Settings
Section titled “Settings”Under Branches:
- Press Add branch.
- Name it in its field, labelled Branch 1, Branch 2 and so on, such as “Large order”. The name is what the run records.
- Add its conditions with Add condition, the same rows a Conditional uses.
- Drag an edge from the branch’s output on the node to the step that handles it.
Remove a branch with the × beside its name. The edges drawn from that branch are removed with it.
The comparisons, and how and and or combine rows, are on the Conditional page.
When no branch matches
Section titled “When no branch matches”The node also has its own output, apart from the branches. When no branch matches, the edges from that output fire. If nothing is connected to it, the run continues nowhere from the Decision, and every step after it is skipped.
A branch with no conditions always matches. Put one last to catch everything the branches above it don’t.
Output
Section titled “Output”| Field | What it holds |
|---|---|
selectedBranch |
The name of the branch taken, empty when none matched |
branchIndex |
The branch’s position, counting from 0, or -1 when none matched |
Like a Conditional, the Decision passes on the text it received. Read an earlier step’s fields as
{{ nodes.<id>.<field> }}. Later steps can use the route taken, as in
{{ nodes.route.selectedBranch }}.
Branches that meet again
Section titled “Branches that meet again”Branches may lead back into one shared step, such as a final notification. Only one edge into a step may fire in a run. A Decision takes one branch, so its branches can safely meet. If two edges into the same step fire in one run, that step fails with an error naming both. See Runs and approvals.
Example
Section titled “Example”The Support triage template has an agent classify a message, then routes on its reply:
| Branch | Condition |
|---|---|
| Bug | {{nodes.classify.response}} contains bug |
| Feature | {{nodes.classify.response}} contains feature |
| Question | {{nodes.classify.response}} contains question |
Each branch leads to an Agent node that writes the matching answer. The comparison is case-sensitive, so the classifying agent’s Task asks for one lowercase word.