> ## 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.

# exit

> Ends the plan early, as a success or an error, when a condition holds.

## How it works

* Gate it with `when`, `infer` or `decide`. See [Conditions and bodies](/plans/reference/conditions-and-bodies). With no gate, it always exits.
* `status: success` ends the plan with exit code 0. `status: error` ends it with exit code 4.
* `message` explains the exit.
* In an output plan, a success exit's `output` returns exactly the `finish.output` keys. Error exits, and exits in solver or silent plans, take no `output`.
* An exit inside a `route`, `map` or `reduce` body ends the whole plan.

## When to use it

* Stop with success when there's nothing to do, such as an empty search.
* Stop with an error to fail a check, such as in CI.

## Input

**decide** `object`

A yes/no question answered by a decision model (only when one is configured); fires when its probability reaches min\_confidence.

**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.question** `string` *required*

**decide.state** `any`

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

**infer** `string`

A yes/no question about prior results; exits when the answer is yes.

**message** `string`

Shown as the plan's answer / error message. May use templates.

**model** `string`

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

**status** `enum\<string\>` *required*

Available options: `success`, `error`

**when** `object`

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

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

**when.to** `any`

Comparison operand (omit for empty/not\_empty)

**when.value** `any` *required*

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

## Result

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

**passed** `boolean`

Always true. The plan only reaches later steps when the exit didn't fire.

**reason** `string`

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

**verdict** `boolean`

Whether the condition held. Always false when later steps can read it.

```yaml Plan step theme={null}
- id: E1
  tool_name: exit
  input:
    status: "{{input.status}}"
```

```json Result theme={null}
{
  "passed": true,
  "reason": "…",
  "verdict": false
}
```


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