Custom logic

Long-running orchestration without sticky memory.

Process memory is not durable state. Vadyl rejects warm-stateful-instance tricks. Long-running flows are durable workflows: ctx.step journals every advance, ctx.waitForSignal suspends durably for hours or weeks, ctx.compensate registers LIFO saga rollback. The runtime can cold-start, relocate, restart at any moment — your workflow keeps going.

The three primitives

ctx.step. ctx.waitForSignal. ctx.compensate.

Three orthogonal primitives compose into every long-running flow Vadyl supports. The runtime journals the result of every step, the durable wait of every signal, the registered compensation of every mutation.

ctx.step (journaled)

Every step's result is journaled before the workflow advances. At-most-once per logical step — replay never re-executes a completed step. Side effects are safe. The world stays consistent across restarts.

ctx.waitForSignal (durable)

Suspend the workflow until a signal arrives — payment confirmed, approval granted, rate limit cleared. The workflow can wait for hours or weeks. The host can recycle. The wait persists.

ctx.compensate (LIFO saga)

Register a compensation alongside every mutation step. On failure, the runtime walks the saga LIFO within priority — DELETE → UPDATE → INSERT. The same model as cross-provider transaction compensation.

Deterministic ctx.now / ctx.random

Replay-safe time and randomness. ctx.now() captures the wall clock at first call and replays the same value. ctx.random() is journaled. Same inputs, same outputs, every time.

Locked publication version

Each in-flight workflow pins to its LockedPublicationVersion. New deploys don't break running workflows. WorkflowInvocationIdentity carries the explicit version through every advance, signal, compensation.

Exactly-once invocation dispatch

PendingInvocation.TryClaim uses Interlocked.CompareExchange. No double dispatch under contention. Exactly-once at the orchestration boundary; idempotent contracts at every consumer.

Where workflows actually run

Out-of-process workers. gRPC over named pipe / UDS.

Workflows execute in a managed worker pool — Node.js out-of-process today, peer projections planned for Python, Go, Rust. The transport is protobuf-net.Grpc over named pipe (Windows) or UDS (Linux/macOS). Graceful drain via VADYL_DRAIN stdin signal. Kill-on-timeout escalation. Worker registry tracks live workers; the dispatcher claims invocations exactly once.

Journaled
Every step

At-most-once per logical step

Durable
Every signal

Hours, days, weeks

LIFO
Compensation

Within priority, deterministic

Pinned
Publication

In-flight runs survive deploys

Long-running flows that survive restarts.

Open a checkout workflow that waits 30 days for confirmation. Pause for human approval. Compensate when payment fails. Resume after a deploy. Vadyl handles the durability.