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.

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'

Read an environment variable with {{KEY}}:

{{MAX_RETRIES}} === 3
{{FEATURE_ON}} === true
{{TIER}} === 'pro'

Numbers, booleans, and null compare as literals. Every other value is bound as a string, so an apostrophe, quote, or newline inside a secret cannot change what the expression means.

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

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