Reference

Condition

The Condition block branches a workflow on boolean expressions. It checks each branch in order and runs the path of the first one that is true, with no model call. When you want a model to decide the route, use a Router instead.

Condition
if-
else if-
else-
error

Configuration

Conditions

A list of branches: an if, any number of else if rows, and a final else. Each branch holds a JavaScript expression that evaluates to true or false, and connects to its own path. Sim checks them top to bottom and takes the first branch that is true; the else branch runs when none match.

Reference an earlier output inside an expression with a connection tag:

<agent.score> > 75
<ticket.subject>.toLowerCase().includes('urgent')
<user.email>.endsWith('@company.com') && <user.plan> === 'pro'

If an expression throws, for example because it reads a field that is not there, the block errors and the run follows the error path if one is connected. Guard missing values with optional chaining (?.) or a null check.

Outputs

OutputWhat it is
<condition.conditionResult>The boolean result of the branch that matched
<condition.selectedOption>The id of the matched branch
<condition.selectedPath>The destination block the workflow routed to

Examples

Route a support ticket by priority

The Condition checks <start.priority> and runs one downstream path. The other does not run, so a reference to a block on the path that did not run comes back empty.

Moderate content by score

An Agent scores the content, and the Condition publishes it or blocks it on <moderate.toxicity>.

Branch onboarding by account tier

A Function reads the account, and the Condition sends enterprise accounts through guided setup and everyone else through the quick start.

Best Practices

  • Order branches from specific to general. The first true branch wins, so put narrow checks before catch-alls.
  • Always give unmatched runs a path. Connect the else branch, or make the last condition true, so nothing dead-ends silently.
  • Keep expressions simple. Short boolean checks are easy to read and debug. Do heavy logic in a Function block first and branch on its result.
  • Guard missing values. Use optional chaining (?.) or a null check so an absent field does not throw.

Common Questions

No. It evaluates boolean expressions using JavaScript syntax directly, with no model call. That makes it fast, deterministic, and free of API cost. For AI-powered routing, use the Router block instead.
The workflow follows the else branch. If the else branch is not connected to a downstream block, that path ends gracefully without an error. Add a final condition of simply true to guarantee a match.
Top to bottom, in the order they are defined. The first branch that evaluates to true determines the path, and later branches are not checked after a match. Place more specific conditions before general ones.
Standard operators and methods: comparisons (===, !==, >, <), logical operators (&&, ||, !), string methods (.includes(), .endsWith(), .toLowerCase()), array methods (.includes(), .length), math, and Date comparisons. Reference block outputs with <blockName.output> syntax.
If an expression references an undefined variable or throws at runtime, the block errors and the run fails, or follows the error path if one is connected. Use optional chaining (?.) or explicit null checks to handle missing values safely.

On this page