Wait for approval
Pause a workflow until an authorized person accepts or rejects the next step.
Save the four files below together and run node release.ts in an ESM project with Outpost installed. This offline demonstration submits a sample decision immediately; replace that submission with your authenticated user’s decision in an application. It does not deploy a service.
Add a gate
Section titled “Add a gate”Add an approval task before a step that needs a person’s agreement, such as a merge or deployment. The workflow pauses at that task; dependent tasks wait until an allowed actor approves.
It prints paused Deploy release 1.4 to production?, then done Deployed, approved by maintainer.
A gate needs a checkpoint, the saved state of the run under .outpost/storage. The second start() can run in another process, days later.
Submit a decision
Section titled “Submit a decision”The rejection and its reason survive checkpoint resumption. Independent branches still follow normal scheduling; if one fails technically, the workflow returns failed with that failure’s termination code.
API reference: WorkflowDecision.
start() throws, applying no decision, when one does not match the pending request.
Pause without approving
Section titled “Pause without approving”definePauseTask() takes the same options and holds the run until someone lets it go on, for example after a maintenance window. Continue with action: "resume" or stop with "reject".
Authenticate the actor
Section titled “Authenticate the actor”Outpost checks that actor is listed in actors, not who the person is. Log the person in and check their right to decide before you call start().
Asking an agent in its brief to wait for approval is not a gate: only a gate task stops the run.
Decide a run started by a job
Section titled “Decide a run started by a job”A cron schedule or a webhook runs its workflow in a queue worker. The job value reports the runId, pending pauses and effective checkpoint version, which adds a digest of the job input.
Submit decisions with checkpoint: { store, runId, version } from that value: see Job queues and workers.
Limits
Section titled “Limits”- A gate takes no condition, retry, timeout or cache.
- A queued workflow job takes no decisions: call
start()outside the worker. - Changing a gate’s
prompt,actorsorauthenticationmakes a paused run’s checkpoint incompatible: resume it with the unchanged gate. - Signatures do not protect the checkpoint: anyone who can write its store is trusted.
- A custom
decisionVerifiermust check the signature, actor and expiry itself. - For questions the agent asks while working, use interactive tasks.
API: defineApprovalTask · definePauseTask · WorkflowDecision · signWorkflowDecision · createEd25519DecisionVerifier · WorkflowApproverKey.

