API Reference: Execution Options (ExecutionOptions)
The ExecutionOptions object configures runtime execution behavior across flow.run(), step.run(), and resumeWorkflow(). It governs cancellation signals, deadlines, dependency injection, durable persistence, multi-tenant namespaces, schema migrations, execution hooks, and idempotency deduplication.
Table of Contents
The ExecutionOptions Interface
Option Details
pojo and mode
Controls output normalization for the workflow result:
pojo: true(default in v1.0): Automatically strips internal proxy wrappers and execution internals, returning clean plain objects. The runtime output path always appliestoPOJOnormalization.mode: 'pojo' | 'wrapped': Compatibility configuration. Note that reserved context history accessors remain getter functions, and native types likeBigIntare not automatically JSON-serializable.
signal
An AbortSignal instance used for cooperative cancellation.
- Propagation: Passed to every step action via
param.signal(nativeAbortSignal) andparam.$signal()(callable compatibility accessor). - In-Flight Cancellation: When aborted, pending retry backoff delays and parallel sibling branches are aborted. Note that asynchronous work inside step actions must cooperate with
param.signal(e.g. passing it tofetch({ signal })). - Exception: Throws
CancellationExceptionwith the abort reason.
timeout and timeoutMs
Workflow-level SLA deadline in milliseconds.
- If the total execution time of the entire workflow exceeds this limit, execution is immediately aborted.
- Throws
FlowTimeoutExceptioncontainingtimeoutMs,stackId, andcompletedSteps.
services and dependencies
Dependency injection container for injecting repositories, external clients, database connections, and configurations into steps without coupling step implementations to global singletons.
- Accessible inside step actions via
param.$servicesorstep.requireDependency(). - Both
servicesanddependenciesare accepted as synonyms.
durable
When set to true, enables durable workflow state management:
- When a workflow encounters
waitForEvent()orwait(), Siglo suspends the workflow, serializes the current execution context into a checkpoint, persists it to the configuredStorageAdapter, and resolves with an execution descriptor containing{ status: 'waiting', stackId, waitKey }. - Allows workflows to pause for hours, days, or months and resume safely upon external event delivery via
resumeWorkflow().
workflowVersion
Declares the schema version of the workflow definition (e.g. 'v1', 'v2').
- Used during durable workflow resumption to detect code changes between when the checkpoint was created and when it was resumed.
- When resuming via
resumeWorkflow(targetFlow, key, payload, options), the target version is selected fromoptions.targetVersion, falling back totargetFlow.workflowVersion, then the checkpoint’s recorded version. - If the checkpoint’s version differs from the target version and no matching migration is provided in
migrations,WorkflowVersionMismatchExceptionis thrown.
migrations
A migration map or migration function for upgrading suspended checkpoint state when workflow definitions evolve. Transition keys use 'fromVersion->toVersion' format and receive (fromVersion, toVersion, state) => newState:
namespace
A string partition key used for multi-tenant metadata scoping and storage key partitioning.
- Partitions checkpoint keys, cached step outputs, and wait records to prevent key collisions across tenants.
restoreCheckpointchecks an explicitly supplied expected namespace when both values exist.- Security Note: Namespace scoping is logical key partitioning, not an enforced authenticated tenant boundary. Application-level tenant authentication and explicit validation are still required.
idempotencyKey
A string or generator function providing workflow-level deduplication.
- Prevents concurrent duplicate runs (e.g. double-submitted webhooks or duplicate HTTP requests).
- If an execution with this key is already running, throws
IdempotencyConflictException. - If already completed within
idempotencyTtlMs, returns the cached result.
idempotencyStore
Custom adapter implementing the IdempotencyStore interface (e.g. PostgresIdempotencyStore, RedisIdempotencyStore, or InMemoryIdempotencyStore).
idempotencyTtlMs
Retention window for idempotency records in milliseconds:
- Redis / PostgreSQL stores: Default to
86400000(24 hours). - In-Memory store: No expiration by default (
expiresAtremains undefined unlessttlMsis explicitly supplied; TTL starts at claim time). - Queue adapters (Kafka, BullMQ, SQS): Pass
undefinedthrough to the store whenidempotencyTtlMsis omitted.
stepExecutionHook
Intercepts step execution boundaries within Node’s AsyncLocalStorage context. Enables custom per-run logging, timing metrics, and distributed APM spans without registering global plugins.
