Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.anyreach.ai/llms.txt

Use this file to discover all available pages before exploring further.

The Condition step splits the workflow into multiple branches. Execution routes down the first branch whose expression matches — or down the default branch if none match.

How it works

The Condition step evaluates each branch’s expression in order against the workflow context (ctx). The first expression that evaluates to true determines which branch executes next. If no expression matches, execution follows the default condition branch.
Condition step showing branches on canvas
To add a new condition branch, hover over a condition node. A ”+” icon will appear, click it to create an additional branch for your condition logic.
Condition step showing branches on canvas

When to use it

Use Condition whenDon’t use it when
Routing based on a data value (status code, field value, tier)The logic is computational — use a Code step
Classifying free-text with AI judgmentYou already have structured data — use JSONata, not AI
Implementing a switch over an enum

Inspector

Clicking on a condition branch in the workflow opens an editor in the inspector. Here, you can set a custom name for the branch and define its associated condition expression.
Condition step showing branches on canvas

Expression Types

Each branch in a Condition step uses an expression to determine when that branch should be followed. There are two supported types: JSONata expressions — These are evaluated at runtime against the current workflow context (ctx). Use JSONata when you want to perform checks on structured data. Examples:
{{ n1.name = "Adam Zampa" }}
{{ n1.score > 50 }}
You can also use the AI-powered expression generator in the editor to help you craft the right condition. AI expressions — These let you phrase your condition as a natural language question to the LLM (Large Language Model). The model returns a true or false answer, allowing for more flexible or fuzzy logic that can use free text fields. Example:
${ does {{n1.name}} contain the word "Adam"? respond yes/no }
Use JSONata for strict, structured logic where possible. Use AI expressions for complex, human-like reasoning needs.

Branch ordering

Conditions are evaluated top to bottom. First match wins — once a branch matches, the others are not evaluated. Order from most specific to least specific:
Branch 1: {{ n2.status_code = 200 }}     ← most specific
Branch 2: {{ n3.status_code >= 400 }}    ← catches all errors
default:                               ← fallback

Default branch

Every Condition step has a default branch that executes when no other branch matches. Always wire it to a meaningful step — leaving the default unconnected means the workflow silently stops if nothing matches.