Branches and loops
If / else and While steps, the CEL expressions that drive them, and the loop limits.
If / else
If / else evaluates an expression and follows True or False. Connect each port to the step that should run in that case.
lastOutput.category == "refund"While
While follows the Loop path for as long as its expression is true, then follows Done. Connect the end of the loop back into the While step so the expression is checked again.
lastOutput.wordCount > 100A loop runs at most 5 times unless you raise the limit on the step. Every pass also counts toward the run's 20 step visits.
Expressions
Conditions are written in CEL, an expression language that can read values but not change them.
lastOutput holds the previous step's result. Values stored with Set state are also available.
| Expression | True when |
|---|---|
lastOutput == "yes" | The previous step returned exactly yes |
lastOutput.contains("refund") | The previous step's text mentions a refund |
lastOutput.score >= 0.8 | A JSON field is at or above a threshold |
lastOutput.items.size() > 0 | A JSON list is not empty |
Matching on free text breaks when the wording changes. Have the step before a branch return JSON, then compare a field.