Choose the next phase from what a step found
A prompt step picks one option from a list the workflow names, and later phases run or are skipped by it — or the option stops the run, or goes back.
Most teams' process forks on what the first look found: a clear bug
goes straight to a fix, and a change to an API or a migration gets a plan
someone approves before anybody writes code. A decision says that
in the workflow. A prompt step ends by picking one answer from a list
the workflow names, and a later phase's when: reads it.
The agent makes the call, in the same turn as its work. Peractor does the routing, by the same run-or-skip check every phase already gets. The choice is recorded with the agent's reason, shown on the run, and a person can change it at the phase's gate. The agent never gets to skip work by leaving it out: a decision can only skip a phase the author made conditional.
From an issue to a pull request
phases:
- id: triage
title: Triage
steps:
- id: size # a decision is read by its step's id
type: prompt
prompt: Read the issue and the code it touches.
decide:
question: How much does this need?
options:
- id: small
means: A clear bug or a contained change in one package.
- id: needs-plan
label: Needs a plan
means: An API change, a migration, or work across packages.
default: needs-plan
- id: plan
title: Plan
when: decision.size == "needs-plan"
gate: true
steps:
- id: write-plan
type: prompt
prompt: Write a short plan with scope and checks. Don't edit code.
- id: build
title: Build
steps:
- id: impl
type: prompt
prompt: Implement the change.
- { type: check, run: pnpm test }
- id: review
title: Review
gate: true
steps:
- type: prompt
prompt: Review the diff against the issue.
- { type: loop, phase: build, to: impl, until: agent-verdict }
- { type: git, action: open-pr }
Triage decides whether a plan is needed. Plan runs only when it is, and its gate holds the plan for a person before code is written. Review's loop sends findings back to Build, and its gate is where a person reviews the pull request. A small change goes Triage → Build → Review, and the run page says why Plan was skipped: "Skipped: Triage decided Small".
Options, and what to pick them for
| Key | What it does |
|---|---|
question | Optional. Shown to people and given to the agent. |
options | Two to eight. Each has an
id a when: names it by — lowercase letters,
digits and hyphens, starting with a letter — an optional
label people read (made from the id when absent:
needs-plan reads "Needs plan"), and means,
the sentence that tells the agent when to pick it. |
default | Optional. The option used when no usable answer comes back — see below. |
Write each means as the test the agent applies, not as
a label: "An API change, a migration, or work across packages" is
something it can check against the code; "Big" isn't. The agent ends
its reply with the option it chose and why, and the reason is shown on
the run beside the choice.
Only a prompt step decides, and not an
interactive one, which a person ends. The step needs an
id; the editors give it one when you turn
Decision on. A phase can hold several deciding steps, each its own
decision.
Several questions in one turn
One step can ask up to four questions, answered in the same turn,
each with its own options, fallback and reason. In the editor, press
Ask another question. In the file, decide: becomes a
list, and each question has an id:
decide:
- id: scope
question: How much does this need?
options: [...]
- id: db
question: Does it change the database?
options: [...]
A later phase reads one question as
decision.<step>.<question>:
when: decision.size.db == "migration". A step with one
question still reads decision.size. When the editor turns
one question into a list, it rewrites the conditions its pickers drew.
A condition you wrote by hand is refused at save, with the new name to
use. Only one question of a step can stop the run or go back. A reply
that misses a question is asked again for that one; after that, the
question takes its own default.
A step a person decides
Ask a person to decide, under People in Add a step, is a step with no agent: a person picks the option. The run holds no machine while it waits. The question reaches people as any question does: on the run, in Inbox, by push and in Slack. Above it they see the step's note and what the steps before it found.
- id: ship
type: decide
name: Choose the release
decide:
question: How should this fix ship?
options:
- { id: hotfix, label: Hotfix now, means: Customers are hit today. }
- { id: next, label: With the next release, means: It can wait. }
default: next # if nobody answers
timeout: 1d # how long it waits, up to 7d
When the phase's gate names its approvers, only they may answer;
otherwise whoever may answer the run's questions may. Later phases read
it as they read an agent's: decision.ship == "hotfix".
Options can stop the run, but a person's decision can't go back. If
nobody answers in time, the run takes the fallback, or the phase fails
when there is none.
In the workflow editor, a prompt step's Decision section holds the question, the options as rows, and If no answer comes back. Each option's Then says what it does on its own: Carry on, Stop the run or Go back.
Run only when
decision.<step id> is something a phase's
when: can ask about. Its
value is the option's id:
when: decision.size == "needs-plan"
when: decision.size != "small"
when: decision.size == "needs-plan" && source != "trigger"
when: decision.kind == "bug" || decision.kind == "regression"
The step has to decide in an earlier phase, and a value you
compare with has to be one of its options (a wildcard has to match at
least one); anything else is refused when the workflow is saved. When
the deciding phase was itself skipped, nothing is recorded and the
value is empty: == is false and != is true,
so a phase that runs on != "small" also runs when Triage
didn't.
In the editor, a phase's Run only when row picks the step, then the options it runs for. A condition the pickers can't draw — one that also reads the branch, say — shows as text, marked Edited in the file.
Stop the run
- id: not-a-bug
label: Not a bug
means: The issue describes intended behaviour, or it can't be reproduced.
stop:
outcome: No change needed # up to 60 characters
as: completed # or failed; completed when left out
An option that stops is how a run says "nothing to do" and ends
there, instead of skipping every phase and reading as if the work were
done. The rest of the deciding phase still runs, and its gate opens if
it has one, so a person can change the option there. Then every later
phase is skipped and the run ends Completed — or
Failed, with as: failed — showing the outcome
beside its status: "Completed · No change needed". It is never
Canceled: that stays a person's act.
Go back
- id: rework
label: Needs rework
means: Part of the issue is missing, or something is broken.
goBack:
phase: build # left out: an earlier step of this phase
to: impl
max: 3 # passes, as a loop's (3 when left out)
onMax: fail # or continue
An option that goes back is a loop
whose way out is the option the agent names, so a review can have more
than one way back, each to its own place. It is taken right after the
deciding step — the steps after it don't run on that pass and the gate
doesn't open — and the agent's reason goes with it, so the step that
runs again knows why. After max passes,
fail fails the phase and continue carries on
with the next step. The target has to be a step before the deciding
one, by the rules a loop's target follows.
An option can stop or go back, not both, and it is still a value a
later when: can read.
If no answer comes back
When the agent's reply has no usable choice — none at all, or an
option that isn't listed — it is asked once more in the same session.
If that doesn't work either, the default is taken and the
run says it was chosen by default. With no default, the phase
fails: "Triage didn't decide". A default can stop the run, but it can't
go back: going back because a reply was broken would only spend
passes.
A phase that decides goes only to a machine whose Peractor runner makes decisions. When the only one that matches runs an older runner, the phase fails and says so: update Peractor on that machine, then retry.
Changing a decision at the gate
When the deciding phase has a gate, the gate shows what was decided and why, with Change:
Triage decided Small · "One-line null check in TaskCard." · Change
Change lists the options with what each means. Pick another and approve, and the run follows the new one: the phases ahead read it, and nothing that already ran is undone. Changing is part of approving — there is no separate button on a running run, and sending the phase back for changes runs its steps again, so they decide again. Only someone who may approve the gate can change it, and every change goes in the organization's audit log as Decision changed, with who, from and to.
A stop is where this matters most: "Triage decided Not a bug · Stops the run: No change needed · Change" lets the person at the gate say it is a bug after all. You can also change to an option that stops, and the run ends after the phase. Picking an option that goes back goes back, as if the agent had chosen it, and spends a pass.
A step that asks several questions shows a row for each, each with its own Change, and the gate says what approving runs next: "If you approve: Plan › Build › Review". The plan, deliverable and held-action review pages show the same rows beside Approve.
The same change can be made from a chat or from outside. MCP's
resolve_gate takes decisions, decision id
(size, or size.db) to option id. The
assistant stages "approve and change
Triage to Needs a plan" as a gate approval you press, like any other. An
API key with Approve gates approves
through POST /api/v1/runs/<id>/gates/<gate>,
but only gates any member may: a key is never a person.
Every later step is told
Each later prompt step is handed the decision with the run's other
notes — "Triage decided: Needs a plan. Reason: …" — so the plan and the
build know what triage concluded. Prompt text stays plain text: there is
no {{ decision.size }} to write.
When the deciding step runs again — a request for changes, a loop, an option that goes back — the latest decision wins. The phases still ahead read the new one when they would start; every attempt's own choice stays in the run's history.
What the editor warns about
These save, and the editor says them under the step or the phase:
- "Nothing runs differently when Triage decides Small" — no later phase reads the decision, and the option neither stops nor goes back.
- "Not a bug ends the run with no one checking" — an option that stops, in a phase with no gate.
- "A decision can skip Review, which has a gate" — teams often do want a small change to skip a plan review, so this is said, not refused. A gate's risk rules still apply to the phase that makes the change.
- "Never runs: Not a bug stops the run" — a phase only an option that stops would run.
- "Runs when Triage didn't run, too" — a
!=on a step whose own phase can be skipped.
Lanes
A lane's decisions are its
own: its phases read decisions made in the same lane, and the run that
started it can't read them. An option that stops, in a lane, ends the
lane with its outcome, and the run carries on after the
workflows step as it does when any lane ends.
Reading it from outside
GET /api/v1/runs/<id> and MCP's
read_run carry decisions — each decision's
option, reason and who chose it: the agent, the default, or a person
— and endedByDecision with the outcome when an option
stopped the run. See the API.
Using decisions elsewhere
- Triggers. An
on: runtrigger's filter can read a run's decisions and how a stop ended it:decision.size == "not-a-bug",decision.size.db == "migration",outcome == "No change needed". - Dashboards. The Decisions widget counts how often a step chose each option over a window, with how many people changed it and how many fell back to the default. Stopped as counts the runs a stop option ended, by outcome.
- Scorers. The Decisions kept measure is the share of a run's decisions nobody changed at a gate. A run with no decisions gets no score from it, not a perfect one.
- Reading a workflow. Where a workflow is shown read-only, a step that decides lists its questions in words, and a phase that reads one says when it runs.