DocsOpen Workflows

Step reference · Logic

If

Send the flow down the first path whose condition holds. Conditions compare values the run already has, or put one yes-or-no question to the model.

LogicIf
Step kind
Branch
Case
GreaterThan: Read.Amount, 500
Then
Wait
Else
(continue)
If is written as Branch in YAML. The example below declares this step.

Inputs

Casescase[]Required
Tested in order; the first case whose condition holds is taken.
WhenconditionRequired
An expression over the run’s values, or a Judge question.
Thenstep[]Required
The steps this case runs.
Elsestep[]
The steps run when no case holds. Where absent, the flow moves on.
Outputoutput contract
What the taken path’s last value is narrowed to.
AttemptsintegerDefault 1
How many tries a Judge question whose reply fails may take.
OnExhaustedpolicy
What happens when those attempts run out.

Outputs

<last value>any
The last value the taken path produced, under the branch’s name. Where no case holds and there is no Else, the branch produces nothing and the flow continues.

Conditions

NodeHolds when
Equals, NotEquals
The value at Field equals, or does not equal, Value.
GreaterThan, GreaterOrEqual, LessThan, LessOrEqual
Numbers or strings compare that way. Values of different types compare false.
Contains, In
A string holds a string or a list holds a value; or the value is in a list.
Exists
The path resolves to a value with content: not empty, not absent.
And, Or, Not
Combine conditions. And and Or stop as soon as the answer is known.
Judge
The model answers Prompt with yes or no. Plain conditions are tested first.

Example

- Branch: Check
  Cases:
    - When: { GreaterThan: { Field: Read.Amount, Value: 500 } }
      Then:
        - Wait: Approve
          Operation: Clarification
          Question: This refund is over $500. Approve it?
    - When: { Judge: { Prompt: Does the request mention fraud? } }
      Then:
        - Wait: Review
          Operation: Clarification
          Question: This refund request mentions fraud. Should it go ahead?
Decided onceThe case taken is recorded as branch.taken. A turn that is resumed later follows the recorded case instead of testing the conditions again.
Updated Oct 22, 2026
Esc