Control steps
route
Runs one of two or more branches, depending on a condition.
How it works
- Gate it with exactly one of
if,inferordecide. See Conditions and bodies. thenruns when the condition holds;elseruns otherwise. Omitelseto continue without running anything.- With a decision model,
decide.optionsandcasesturn it into an N-way choice.
Limits
- A branch is one tool call or a list of steps. It can contain
exit,agent,ask,filterandroute, but notmaporreduce.
Input
One branch per decide.options key, used instead of then.
A question answered by a decision model (only when one is configured). Without options it is yes/no and runs then when its probability reaches min_confidence; with options the model picks one and the matching entry in cases runs.
0 to 1; default 0.5
A decision model role; defaults to decider
Case name → what that case means; 2 to 255 entries. Each name needs a branch under cases.
The data to judge, usually a template like {{E2.text}}
Available options: eq, ne, gt, lt, gte, lte, empty, not_empty, contains
Comparison operand (omit for empty/not_empty)
Usually a template like {{E0.issues.length}}
A yes/no question about prior results; runs then on yes.
Model role for the infer verdict (any configured role, standard or custom); defaults to the judge role.
Result
Later steps read these as {{<step id>.<field>}}.
Which branch ran, then or else, or the case name with cases.
Why the gate decided as it did, for infer and decide gates.
The output of the branch that ran.
Whether the condition held.
- id: E1
tool_name: route
input: {}{
"branch": "then",
"reason": "…",
"result": {
"…": "…"
},
"verdict": true
}