Skip to content
Français

WorkflowOptions

import type { WorkflowOptions } from "@elie-laloum/outpost";
  • onQuotaOptional
    WorkflowQuotaPolicy | undefined
    Opt-in policy that pauses a task on a quota error instead of retrying or failing it; requires a checkpoint. Quota pauses release on a later start() once the reset is known to be reachable within maxWaitMs, or when it is unknown or past.
  • answersOptional
    readonly WorkflowAnswer[] | undefined
    Answers to pending input requests, not empty; requires a checkpoint. All are validated before any is applied, and an invalid, stale or duplicate answer makes start() reject.
  • timeoutMsOptional
    number | undefined
    Deadline in milliseconds for this start() call, a positive integer up to 2147483647, covering checkpoint acquisition, conditions, attempts and retry waits. Expiry cancels running tasks and the status is failed with an OutpostError code timeout; each call gets a fresh deadline.
  • observationOptional
    ObservationHub | undefined
    Parent hub receiving workflow, task, agent and operation envelopes; historical observe callbacks still receive WorkflowEvent.
  • decisionVerifierOptional
    WorkflowDecisionVerifier | undefined
    Trusted verifier invoked for each submitted proof; required to accept decisions on signed gates. Verification failures leave all pending decisions unapplied.
  • decisionsOptional
    readonly WorkflowDecision[] | undefined
    Explicit decisions for persisted pending gates.
  • checkpointOptional
    WorkflowCheckpointOptions | undefined
    Store, runId and version that persist task states, outputs and usage between start() calls. Required for gates, interactions, answers, decisions and onQuota.
  • signalOptional
    AbortSignal | undefined
    Cancels the run: running tasks see context.signal abort, pending tasks end cancelled and the status is cancelled.
  • concurrencyOptional
    number | undefined
    Maximum tasks running at once, default 1 (tasks run in list order). Must be a positive integer.
  • budgetOptional
    WorkflowBudget | undefined
    Attempt and token limits shared by every task, including restored usage; reaching one fails the run with WorkflowBudgetExceeded.
  • stopOnErrorOptional
    boolean | undefined
    Defaults to true: the first failure aborts the run, cancelling running and pending tasks. With false, only dependents of the failed task are skipped and independent tasks continue.
  • telemetryOptional
    WorkflowTelemetry | undefined
    Adapter that receives each WorkflowEvent before observe, such as createOpenTelemetryObserver({ tracer, meter }). Its errors go to observerErrors; you own its lifecycle.
  • observeOptional
    ((event: WorkflowEvent) => void) | undefined
    Receives each WorkflowEvent after telemetry; thrown errors are collected in observerErrors without changing the run.
export interface WorkflowOptions {
  readonly onQuota?: WorkflowQuotaPolicy;
  readonly answers?: readonly WorkflowAnswer[];
  readonly timeoutMs?: number;
  readonly observation?: ObservationHub;
  readonly decisionVerifier?: WorkflowDecisionVerifier;
  readonly decisions?: readonly WorkflowDecision[];
  readonly checkpoint?: WorkflowCheckpointOptions;
  readonly signal?: AbortSignal;
  readonly concurrency?: number;
  readonly budget?: WorkflowBudget;
  readonly stopOnError?: boolean;
  readonly telemetry?: WorkflowTelemetry;
  readonly observe?: (event: WorkflowEvent) => void;
}