Dive

Control steps

route

Runs one of two or more branches, depending on a condition.

How it works

  • Gate it with exactly one of if, infer or decide. See Conditions and bodies.
  • then runs when the condition holds; else runs otherwise. Omit else to continue without running anything.
  • With a decision model, decide.options and cases turn it into an N-way choice.

Limits

  • A branch is one tool call or a list of steps. It can contain exit, agent, ask, filter and route, but not map or reduce.

Input

casesmap<string, object | object[]>

One branch per decide.options key, used instead of then.

decideobject

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

decide.optionsmap<string, string>

Case name → what that case means; 2 to 255 entries. Each name needs a branch under cases.

decide.questionstringrequired

The data to judge, usually a template like {{E2.text}}

elseobject | object[]
ifobject
if.openum<string>required

Available options: eq, ne, gt, lt, gte, lte, empty, not_empty, contains

Comparison operand (omit for empty/not_empty)

if.valueanyrequired

Usually a template like {{E0.issues.length}}

inferstring

A yes/no question about prior results; runs then on yes.

modelstring

Model role for the infer verdict (any configured role, standard or custom); defaults to the judge role.

thenobject | object[]

Result

Later steps read these as {{<step id>.<field>}}.

branchstring

Which branch ran, then or else, or the case name with cases.

reasonstring

Why the gate decided as it did, for infer and decide gates.

resultobject

The output of the branch that ran.

verdictboolean

Whether the condition held.

- id: E1
  tool_name: route
  input: {}
{
  "branch": "then",
  "reason": "…",
  "result": {
    "…": "…"
  },
  "verdict": true
}