> ## Documentation Index
> Fetch the complete documentation index at: https://graph.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 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](/plans/reference/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

**cases** `map\<string, object | object[]\>`

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

**decide** `object`

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.

**decide.criteria** `object`

**decide.criteria.false** `string`

**decide.criteria.true** `string`

**decide.min\_confidence** `number`

0 to 1; default 0.5

**decide.model** `string`

A decision model role; defaults to decider

**decide.options** `map\<string, string\>`

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

**decide.question** `string` *required*

**decide.state** `any`

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

**else** `object | object[]`

**if** `object`

**if.op** `enum\<string\>` *required*

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

**if.to** `any`

Comparison operand (omit for empty/not\_empty)

**if.value** `any` *required*

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

**infer** `string`

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

**model** `string`

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

**then** `object | object[]`

## Result

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

**branch** `string`

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

**reason** `string`

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

**result** `object`

The output of the branch that ran.

**verdict** `boolean`

Whether the condition held.

```yaml Plan step theme={null}
- id: E1
  tool_name: route
  input: {}
```

```json Result theme={null}
{
  "branch": "then",
  "reason": "…",
  "result": {
    "…": "…"
  },
  "verdict": true
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.