Skip to content

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.

  1. Classify

    LLM with a schema

  2. Filter

    intent = refund?

  3. Refund reply

    Then go to

  4. Answer

    Otherwise

Example: route on a Classify step's intent.

Build a Filter#

  1. 1

    Add the step

    Click Add a step after the one you want to check (often an AI agent that answers with a schema) and choose Filter. Double-click it to open its settings.

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

    Pick an operator and value

    Choose an Operator, such as is, and type the Value, such as refund.

  5. 5

    Choose where it goes

    Under Then go to, pick the step that runs when this group is true.

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

GroupOperatorsUse for
Any answerhas an answer, is emptyChecking whether a value is there
Textis, is not, contains, does not contain, starts with, does not start with, ends with, does not end withWords, ids, One of… fields
Numberis, is not, is more than, is at least, is less than, is at mostAmounts, scores, counts

Text checks ignore letter case unless you turn on Match letter case under the operator. They also ignore spaces at the start and end. Number checks compare numbers, so 10 is more 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:

GroupConditionThen go to
IF 1{{Classify.urgent}} is trueEscalate (Text: "Thanks, a teammate will reply within the hour.")
IF 2{{Classify.intent}} is order_statusOrder answer (LLM)
ElseAnswer (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, and leave Match letter case off.
  • "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.