Skip to content

Conditional Node

The Conditional node picks exactly one of its outgoing branches based on a runtime condition, activating that branch’s target and marking every other branch target as skipped.

Use Conditional whenever the path through the workflow depends on runtime data — classification outputs, success/error signals, user choice, etc. For fixed forks where all branches should run in parallel, use straight-line edges instead.

FieldDescription
condition_typeHow the condition is evaluated. jq evaluates a jq expression against input data and reads its string output as the chosen label. regex matches a pattern with a named label group. llm asks an LLM to classify the input into one of the branch labels.
condition_expressionThe expression or prompt, interpreted per condition_type.
branchesMap from label to target node ID. The label returned by evaluation selects which target activates.
default_branch (optional)Fallback target when evaluation returns a label that is not in branches.
  • jq.category, .status == "ok" | if . then "ok" else "err" end. The output is coerced to a string and used as the label.
  • regexstatus:\s*(?<label>\w+). The named capture group label is used.
  • llm — a classification prompt. The LLM is instructed to output exactly one of the branch labels.
  1. When cascade reaches the Conditional, it is inserted as completed, and the condition is evaluated against its input data.
  2. The chosen label is looked up in branches to find the target node ID; if not found, default_branch is used.
  3. All outgoing edges other than the chosen one have their targets inserted as skipped (so downstream joins can see they settled).
  4. The chosen target is activated via the normal registry path (so nested fan-outs/conditionals still get type-specific activation).
  5. The Conditional’s output_data is updated with _chosen_branch and _target_node for auditability.

If neither branches nor default_branch resolves, a warning is logged and the graph stalls at this point — always configure a default_branch when the evaluation output isn’t fully predictable.

  • condition_type is required.
  • Either branches (non-empty) or default_branch must be set.
  • Every target referenced in branches must be a real node.
  • For every label in branches, an outgoing edge to the target must exist on the graph.
  • Outgoing edges whose condition_label is set must match one of the branches labels.
  • default_branch, if set, must reference an existing node.
flowchart LR
Classify["Skill: classify-ticket"] --> C{{"Conditional"}}
C -->|bug| Bug["Skill: bug-triage"]
C -->|feature| Feat["Skill: feature-intake"]
C -->|other| Other["Skill: fallback"]

With condition_type: llm and a prompt “classify as bug, feature, or other”, the LLM’s label picks the branch. Setting default_branch: other protects against unexpected LLM output.