A worker is a separate pi process started in RPC mode. It has its own context
window, tools, model and session, works in the coordinator's directory, and
reports back exactly once per run (or once per follow-up).
starting → running → (question ↔ running)* → settled
└→ stopped | failed | timeout | lost
| Status | Meaning |
|---|---|
starting |
Process spawned, prompt not yet accepted. |
running |
Working; events streaming into the log. |
question |
Blocked on orchestra_ask until answered. |
settled |
agent_settled observed; report captured. |
stopped |
Aborted by worker_stop, /orchestra stop, or shutdown. |
failed |
Process exited without settling, or the prompt was rejected. |
timeout |
timeoutMs expired; the process was stopped. |
orphaned |
A coordinator restart found the process still alive (⚡): stoppable by pid, resumable. |
lost |
State said running, and the process is gone. |
--append-system-prompt .pi/orchestra/prompts/<dispatch>.md when the agent
defines a system prompt.orchestra_ask for decisions that belong to
the coordinator, never delegate, and end with a short report of changes,
evidence and open items.orchestra_ask), or every built-in tool when the
agent has no tools list.---
name: reviewer
description: Read-only code review
tools: read, grep, find, ls
model: claude-sonnet-4-5
provider: anthropic
thinking: high
---
You review code and report findings ordered by severity. You do not edit files.
~/.pi/agent/agents/*.md — user agents.pi/agents/*.md — project agents (override user agents with the same name)name defaults to the file name. description, tools, model, provider and thinking
are optional.
A spec must be self-contained — the worker cannot see the coordinator's conversation:
worker: orchestra_ask question="Migrate or keep the old table?"
coordinator (wake): ? Worker dispatch_ab12 is blocked on a question
coordinator: orchestra_answer questionId=q_9f3c1a2b answer="Keep it, add a view."
worker: resumes with the answer
The question is a file in .pi/orchestra/mail/<dispatch>/. The coordinator polls
once a second, records the gate in state, and messages the model. orchestra_wait
returns as soon as a gate appears, so a blocked worker never deadlocks a wait.
orchestra_send queues a steering message, delivered after the
current assistant turn's tool calls.keepOpen: true: the message starts a follow-up turn in the
same context; the task reopens and the worker reports again.| Need | Call | Behaviour |
|---|---|---|
| Continue the same worker | orchestra_send |
Only while it is alive (keepOpen: true). Same process, same context. |
| Reopen an ended one | worker_resume dispatch=<id> |
New dispatch on the same pi session (sessionMode: "session" required), linked with resumedFrom; the prompt is just the continuation. |
| Start clean after a failure | worker_start retryOf=<id> |
New dispatch, fresh context, but the spec/agent/tools/model are reused and the prompt leads with the previous status, error, last tool and report. |
A resume of a task that was already done puts the task back to running, so
readiness and the widget stay honest.
retries closes the loop: when a worker ends failed/timeout (not a
deliberate stop, not a resumed session), the coordinator queues a repair
dispatch after retryBackoffMs (doubling per attempt, capped at 5 minutes), up
to the attempt budget, and reports when the next attempt starts.
maxConcurrency running workers (default 4).timeoutMs per worker (default 15 minutes) — a hard kill, measured from spawn
in timeoutMode: "total" (default), or from the worker's last event in
"idle". 0 disables it; worker_start timeoutMs= overrides it per dispatch.budgetMsPerWorker — a soft deadline: the worker is asked to wrap up, then
stopped after budgetGraceMs.budgetUsdPerWorker / budgetUsdPerRun — cost ceilings checked on every event.stallMs — a worker with no events for this long is flagged stalled
(⚠ stalled 12m), and stopped instead when stallAction: "abort".A worker is its own process, so the coordinator does not need to block:
orchestra action=worker_start … returns as soon as the process is up..pi/orchestra/, so a restart or /orchestra browse picks the run up.orchestra_wait timeoutMs=… is for the cases where the next step needs the result:
it returns on settle, on a question, or on its own timeout, and replaces polling.
For long jobs, see Configuration — timeoutMode: "idle" or
timeoutMs: 0 keeps a busy worker alive for as long as it needs.