Conditional steps
Branch the workflow on data — expressions, comparators, and the rules of the road.
When to branch
Use a conditional when the rest of the workflow depends on data only known at run time: a deal value, a customer's region, the success of an upstream node. Static configuration belongs in the workflow's settings, not in a branch.
Expression syntax
Conditional nodes evaluate a small expression language. The grammar is intentionally tiny — easier to read at 3am than a full Turing-complete language.
deal.amount >= 50000 and deal.region == "US"
Operators: ==, !=, <, <=, >, >=, and, or, not, in, startsWith, endsWith, matches.
Functions: now(), daysBetween(a, b), len(x), coalesce(a, b).
Anything more complex belongs in an agent step that returns a structured decision — that's traceable; a deeply nested expression is not.
Common patterns
| Pattern | Branch |
|---|---|
| Triage by deal size | deal.amount >= 50000 → AE; else → SDR |
| Region-aware routing | order.shipTo.country == "US" → US warehouse; else → EU warehouse |
| Customer health | customer.health < 50 → CSM intervention; else → standard nurture |
| Tax rules | invoice.region == "GB" → VAT path; "NG" → VAT (NG); else → no tax |
Default branches
Every conditional has an else branch — even if you only added if and else if. ThorStack auto-generates the implicit else so a run never has nowhere to go.
Validating expressions
The editor evaluates expressions against a sample payload so you can sanity-check before saving. The sample comes from the most recent successful run of the same workflow, or a hand-crafted one if there hasn't been a run yet.
Next
- Workflow basics for the surrounding model.
- Approval gates for human-in-the-loop branches.