Branching with Ports and Expressions
This guide demonstrates the syntax for using Ports and Expressions to control the flow of execution in Vellum Workflows.
Basic Port Types
Below is a basic example:
Prefer using Ports directly on Nodes rather than using legacy Conditional Nodes.
LazyReference for Self-Referencing
A common use case for Ports is to branch based on the result a node’s own outputs. For example, if a Prompt Node classifies text as “positive” or “negative”, you can use a Port to immediately branch based on the result.
In this case, the node needs to reference its own outputs in port conditions, use LazyReference
to do so:
Expressions
Ports use Expressions to evaluate which Port to route to. Below is a list of all available expression operators.
Equality and Inequality
Numeric Comparisons
Collection Operations
Null and Undefined Checks
Data Processing
Working with JSON
Access JSON fields using bracket notation:
Logical Operators
AND Operations
Use the &
operator to combine conditions with AND logic:
OR Operations
Use the |
operator to combine conditions with OR logic: