AI Flows
Filter step
Route an AI flow down different steps with if / else conditions on earlier results.
What it does#
A Filter step checks conditions and picks which step runs next. It doesn't call a model and doesn't reply by itself.
It has one or more condition groups (each starts with IF) and an Else. Groups are checked from top to bottom: the flow follows the first group that is true. If none is true, it follows Otherwise.
Classify
LLM with a schema
Filter
intent = refund?
Refund reply
Then go to
Answer
Otherwise
Build a Filter#
- 1
Add the step
Add a step after the one you want to check (often an LLM step that answers with a schema). Double-click it and choose Filter in the type menu.
- 2
Add the branches
Right-click the Filter on the canvas and choose Add branch for each extra path. Each branch is a new step under the Filter; set each one up like any other step.
- 3
Add a condition group
In the Filter's settings, click Add condition group. In Field, type
@and pick a variable, such as{{Classify.intent}}. - 4
Pick an operator and value
Choose an Operator, such as equal to, and type the Value, such as
refund. - 5
Choose where it goes
Under Then go to, pick the step that runs when this group is true.
- 6
Set the fallback
Under Else, pick the step for Otherwise. It runs when no group matches.
Need two checks in one group? Click Add condition, then choose AND (both must be true) or OR (either is enough).
Operators#
| Group | Operators | Use for |
|---|---|---|
| Basic | exists, does not exist | Checking whether a value is there |
| Text | equal to, not equal to, contains, does not contain, starts with, does not start with, ends with, does not end with (each also case insensitive) | Words, ids, One of… fields |
| Number | equal to, not equal to, greater than, greater than or equal to, less than, less than or equal to | Amounts, scores, counts |
Text checks ignore spaces at the start and end. Number checks compare numbers, so 10 is greater than 9. If a value can't be read as a number, that condition is skipped.
Example: hand urgent messages to a person#
A Classify step answers with a schema that has intent (One of… order_status, refund, other) and urgent (True/False). The Filter has two groups:
| Group | Condition | Then go to |
|---|---|---|
| IF 1 | {{Classify.urgent}} equal to (case insensitive) true | Escalate (Text: "Thanks, a teammate will reply within the hour.") |
| IF 2 | {{Classify.intent}} equal to order_status | Order answer (LLM) |
| Else | Answer (Knowledge + LLM) |
Order matters: urgent messages are caught by the first group even if they're about an order.
Common mistakes#
- The Filter always takes Otherwise. Compare with the exact value the earlier step returns. Use One of… schema fields so the value is predictable, or a case insensitive operator.
- "This step can lead to only one next step". Only a Filter can have several branches. To turn a step with several branches into another type, remove the extra branches first.
- "Missing placeholders" error. The Field uses a variable that doesn't exist when the Filter runs, for example a step on another branch or a renamed step. The Filter can only read steps that ran before it.
- Numbers compared as text. Use a Number operator for amounts and scores.