Skip to content

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.

Under Branches:

  1. Press Add branch.
  2. Name it in its field, labelled Branch 1, Branch 2 and so on, such as “Large order”. The name is what the run records.
  3. Add its conditions with Add condition, the same rows a Conditional uses.
  4. 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.

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.

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 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.

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.