Dive

Control steps

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

decideobject

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

0 to 1; default 0.5

A decision model role; defaults to decider

decide.questionstringrequired

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

inferstring

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

messagestring

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

modelstring

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

statusenum<string>required

Available options: success, error

whenobject
when.openum<string>required

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

Comparison operand (omit for empty/not_empty)

when.valueanyrequired

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

Result

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

passedboolean

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

reasonstring

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

verdictboolean

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

- id: E1
  tool_name: exit
  input:
    status: "{{input.status}}"
{
  "passed": true,
  "reason": "…",
  "verdict": false
}