Condition

The Condition block branches workflow execution based on boolean expressions. Evaluate conditions using previous block outputs and route to different paths without requiring an LLM.

Condition Block

Configuration Options

Conditions

A Condition block is an if / else if / else chain. It starts with an if branch and an else branch. Add more branches and they become else if in between. Each if and else if branch has:

  • Expression: A JavaScript expression that evaluates to true or false

The else branch has no expression and cannot be removed. Each branch has its own output handle on the block. Connect a handle to the block that should run when that branch is chosen. SteelEngine evaluates branches in order. The first expression that evaluates to true determines the execution path.

Condition Expression Format

Conditions use JavaScript syntax and can reference input values from previous blocks.

// Check if a score is above a threshold
<agent.score> > 75

Accessing Results

After a condition evaluates, you can access its outputs:

  • <condition.conditionResult>: Boolean result of the condition evaluation
  • <condition.selectedOption>: ID of the condition that was matched
  • <condition.selectedPath>: Details of the chosen routing destination

Advanced Features

Complex Expressions

Use JavaScript operators and functions in conditions:

// String operations
<user.email>.endsWith('@company.com')

// Array operations
<api.tags>.includes('urgent')

// Mathematical operations
<agent.confidence> * 100 > 85

// Date comparisons
new Date(<api.created_at>) > new Date('2024-01-01')

Multiple Condition Evaluation

Conditions are evaluated in order until one matches. When none match, the else branch is chosen:

// if: Check for high priority
<ticket.priority> === 'high'

// else if: Check for urgent keywords
<ticket.subject>.toLowerCase().includes('urgent')

// else: everything that did not match above

Evaluation Context and Passthrough

Expressions run against the output of the block connected to the Condition's input. That output is also available inside the expression as the context object. Each expression must finish within 5 seconds.

The Condition block passes that upstream output through. Its own output is the source block's output, minus tokens, cost, model, toolCalls, providerTiming, and error. It adds conditionResult, selectedPath, and selectedOption. Downstream blocks can therefore read <condition1.field> for any field the source block produced.

Error Handling

If a condition expression references an undefined variable or throws a runtime error, the block will throw an error and the execution will fail (or follow the error path if one is connected). Use optional chaining (?.) or explicit null checks in your expressions to handle missing values safely.

Outputs

  • <condition.conditionResult>: Boolean result of the evaluation
  • <condition.selectedOption>: ID of the matched condition
  • <condition.selectedPath>: Details of the chosen routing destination

Example Use Cases

Customer Support Routing - Route tickets based on priority

API (Ticket) → Condition (priority === 'high') → Agent (Escalation) or Agent (Standard)

Content Moderation - Filter content based on analysis

Agent (Analyze) → Condition (toxicity > 0.7) → Moderation or Publish

User Onboarding Flow - Personalize onboarding based on user type

Function (Process) → Condition (account_type === 'enterprise') → Advanced or Simple

Best Practices

  • Order conditions correctly: Place more specific conditions before general ones to ensure specific logic takes precedence over fallbacks
  • Use the else branch when needed: If no conditions match and the else branch is not connected, the workflow branch will end gracefully. Connect the else branch if you need a fallback path for unmatched cases
  • Keep expressions simple: Use clear, straightforward boolean expressions for better readability and easier debugging
  • Test edge cases: Verify conditions handle boundary values correctly by testing with values at the edges of your condition ranges

Common Questions

No. The Condition block evaluates boolean expressions using JavaScript syntax directly — it does not call any AI model. This makes it fast, deterministic, and free of API costs. If you need AI-powered routing decisions, use the Router block instead.
If none of your defined conditions evaluate to true, the workflow follows the else branch, which every Condition block has. If the else branch is not connected to any downstream block, that workflow path ends gracefully without an error.
Conditions are evaluated from top to bottom in the order they are defined. The first condition that evaluates to true determines the execution path. Subsequent conditions are not evaluated after a match is found, so place more specific conditions before general ones.
You can use standard JavaScript operators and methods including comparison operators (===, !==, >, <), logical operators (&&, ||, !), string methods (.includes(), .endsWith(), .toLowerCase()), array methods (.includes(), .length), mathematical operations, and Date comparisons. Reference block outputs using <blockName.output> syntax.
If a condition expression references an undefined variable or throws a runtime error, the Condition block will throw an error and the execution will fail (or follow the error path if one is connected). Use optional chaining (?.) or explicit null checks in your expressions to handle missing values safely.

On this page