Skip to content

VIP-56: Durable waits: timers, signals and human answers

Status: accepted by Will, 2026-11-23. Will: "56 I accept". Built 2026-11-23: runtime (Experimental.Durable.sleep, until, signal, race, raceSteps, DeadlineExceeded, declared-workflow targets on send/answer/run/spawn/start, Experimental.Human) and compiler (binding-resolved wait recognition, EK5504 fiber-wait messages, EK5601 wait-outside-workflow, try.race/try.any workflow lowering, static readonly deadline). (Previously reopened 2026-11-11 awaiting Will's review.)

Will's words

Vibelang is meant to have most of the features of durable execution agents etc. built into it. What is that status? Are the VIP open or are VIP missing for things like adding llm calls or jev calls to language sandboxing durable execution etc?

Summary

One sentence. Inside a workflow a wait parks the run instead of holding a fiber, and the compiler turns three library calls into plan nodes: Experimental.Durable.sleep for time, a signal's wait() for a typed value from outside, and Experimental.Human for a person.

One paragraph. A workflow that waits a week for an approval must not keep a process alive for a week. The reference engine (an existing Effect durable-execution framework these built-ins are modelled on) records the wait in the journal and releases the run; a timer, a token or an answer wakes it later, on any machine. This VIP gives those waits Vibe forms and adds no keyword. It is a language VIP because the compiler must recognize each call, by the binding it resolves to, and lower it to a node in the workflow's plan (durable-tasks-workflows). It must also refuse a fiber wait in a workflow body, where sleep would hold a process and vanish on a restart.

 Release("build-42")
   │
   ├─ Human.confirm("ship", …)   park: approval   no process held   ◄── Human.answer(Release, run, "ship", true)
   ├─ Durable.sleep("1 minute")  park: timer      wake time is in the journal
   └─ Deploy("build-42")         runs once

Decision

// proposed
task Deploy {
  static readonly tier = "irreversible"
  static readonly idempotencyKey = (build: string) => `deploy:${build}`
  effect call(build: string): string
}
 
export workflow Release {
  effect call(build: string) {
    const approved = try Experimental.Human.confirm("ship", `Ship ${build}?`, { timeout: "6 hours" })
    if (!approved) return "held"
    try Experimental.Durable.sleep("1 minute")
    return try Deploy(build)
  }
}
 
export effect function approve(run: string) {
  try Experimental.Human.answer(Release, run, "ship", true)
}

A signal carries a typed value into a run. Both ends import one value:

// proposed
schema Paid { amount: number }
export const paid = Experimental.Durable.signal("paid", Paid)
 
export workflow Checkout {
  effect call(order: string) {
    const payment = try.race [paid.wait(), Experimental.Durable.sleep("1 day")]
    return payment ? try Ship(order, payment.amount) : try Cancel(order)
  }
}
 
export effect function onWebhook(run: string, amount: number) {
  try paid.send(Checkout, run, { amount })
}

Signals

  • Experimental.Durable.signal(name, schema) declares a wait point. The schema is a durable boundary (VIP-44), and the value crosses in its JSON form.
  • Clarified 2026-11-11: "its JSON form" is VIP-44's default, not a second rule. The value crosses through its schema as VIP-44 rules: its identity comes from canonical JSON, and its stored and sent bytes come from the injected RpcSerialization, whose default is RpcSerialization.layerJson. The journal holds the schema's encoded form and the waiting run receives the decoded type, so a Date field is journaled as its ISO string and arrives as a Date. VIP-29's "encoding is not JSON serialization" says the same from the other side: the schema gives the encoded value, and the serializer turns it into bytes.
  • name is local to a run. The address of a wait is the workflow, the run and the name, so two workflows may both use "paid".
  • try paid.wait() in a workflow body waits for the value. try paid.wait("second") names a second wait point on the same signal in one run.
  • try paid.send(W, run, value) in Effect code delivers a value to run run of workflow W. try handle.send(paid, value) does the same through a Run handle.
  • The first delivery wins. A later one does not replace it (flow/docs/guides/wait-for-an-external-signal.md).
  • An address is not a credential. Anyone who knows the workflow and the run id can rebuild it, so the endpoint that calls send authorizes the caller first.
  • A parked run decodes with the schema it parked under. Change a signal's schema and you change its name.

Timers

CallMeaningReference engine
try Experimental.Durable.sleep("7 days")Park for a durationSleep.action.call({ millis })
try Experimental.Durable.until(date)Park until an instantSleep.action.call({ until })
static readonly deadline = "1 hour" on a workflowBound the whole run, across restartsFlow.make's deadline
try.race [Step(), Experimental.Durable.sleep("30 seconds")]Bound one step; the winner is recordedNode.race
  • A timer writes its absolute wake time before it parks, so a restart does not restart the delay.
  • A deadline that has already passed settles the node at once.
  • Two sleeps of the same length are two waits.

Experimental.Human

CallThe person suppliesResult type
Human.confirm(name, prompt, options?)Yes or noboolean
Human.ask(name, prompt, options?)Prosestring
Human.select(name, prompt, choices, options?)One of choicesThe union of choices
Human.json(name, prompt, Schema, options?)A value the schema acceptsThe schema's type
  • options is { timeout?, maxAttempts? }. maxAttempts defaults to 10, the reference engine's HumanTask.defaultMaxAttempts.
  • A refused answer is recorded, and the run parks on the next attempt. Refusing is an answer; it is not a failure of the transport.
  • The call fails with Human.Failed, whose code is request_invalid, rejected or timeout.
  • Human.answer(W, run, name, value) records an answer. It reads the current attempt from the engine's waiting row. Human.validate(value, request) checks an answer before it is sent.
  • Human.json takes one schema. The reference engine takes two descriptions of the answer, a JSON Schema for the question and an Effect Schema for HumanTask.decode, and "a disagreement surfaces as a defect" (flow/docs/guides/ask-a-person.md). The library derives the first from the second.
  • An answer approves the workflow's question and nothing else. It grants no file, network or process permission. A permission prompt is the kernel's, in capabilities.

What a wait is in the plan

WaitWaiting reasonWakes on
Durable.sleep, Durable.untiltimer, with wakeAtThe clock
a signal's wait()event, with the tokensend
Human.*approval, with the attempt's tokenHuman.answer

The reasons are the reference engine's WaitingAnnotation (flow/docs/concepts/suspension-and-replay.md). An operator reads them off a parked run.

What the compiler emits

The compiler recognizes a wait by the declaration its callee resolves to. An alias keeps the meaning, and a local function named sleep gains none.

In a workflow bodyEmitted
try Experimental.Durable.sleep(d)Sleep.action.call({ millis })
try paid.wait()WaitFor.action.call({ name: "paid" }), then Node.map with the schema's decoder
try Experimental.Human.confirm(name, prompt, { timeout })HumanTask.action.call({ name, kind: "confirm", prompt, timeoutMs })
In Effect codeEmitted
paid.send(Checkout, run, v)DurableDeferred.succeed(gate, { token, value }), with gate = WaitFor.deferred("paid") and token = DurableDeferred.tokenFromExecutionId(gate, { flow: Checkout, executionId: run })
Experimental.Human.answer(W, run, name, v)HumanTask.answer({ token, value }), the token built from HumanTask.deferred(name, attempt)

The signal value and Human are thin library code over WaitFor, DurableDeferred and HumanTask. The compiler adds Sleep.layer, WaitFor.layer and HumanTask.layer to W.layer for a workflow that uses them, because the reference engine's system actions "push no layer obligation onto callers" and fail at run time when the layer is missing.

Diagnostics

CodeSlugWhenThe message names
EK5504workflow-trytry sleep(…), timeout(…) or another fiber wait in a workflow bodyExperimental.Durable.sleep, or try.race with it
EK5601wait-outside-workflowA signal's wait(), a Human question or Durable.sleep in Effect code that is not a workflow bodysleep, or moving the wait into a workflow

Maintainers' decisions

This record comes from the 2026-11-09 built-in set review. The Status line above records Will’s subsequent ruling.

  • A signal carries a typed value into a run. Design · Review.
  • Both ends import one value: Design · Review.
  • Experimental.Durable.signal(name, schema) declares a wait point. Design · Review.
  • The schema is a durable boundary (VIP-44), and the value crosses in its JSON form. Design · Review.
  • name is local to a run. Design · Review.
  • The address of a wait is the workflow, the run and the name, so two workflows may both use "paid". Design · Review.
  • try paid.wait() in a workflow body waits for the value. Design · Review.
  • try paid.wait("second") names a second wait point on the same signal in one run. Design · Review.
  • try paid.send(W, run, value) in Effect code delivers a value to run run of workflow W. Design · Review.
  • try handle.send(paid, value) does the same through a Run handle. Design · Review.
  • The first delivery wins. A later one does not replace it (flow/docs/guides/wait-for-an-external-signal.md). Design · Review.
  • An address is not a credential. Anyone who knows the workflow and the run id can rebuild it, so the endpoint that calls send authorizes the caller first. Design · Review.
  • A parked run decodes with the schema it parked under. Design · Review.
  • Change a signal's schema and you change its name. Design · Review.
  • Call try Experimental.Durable.sleep("7 days"): Meaning: Park for a duration; Reference engine: Sleep.action.call({ millis }). Design · Review.
  • Call try Experimental.Durable.until(date): Meaning: Park until an instant; Reference engine: Sleep.action.call({ until }). Design · Review.
  • Call static readonly deadline = "1 hour" on a workflow: Meaning: Bound the whole run, across restarts; Reference engine: Flow.make's deadline. Design · Review.
  • Call try.race [Step(), Experimental.Durable.sleep("30 seconds")]: Meaning: Bound one step; the winner is recorded; Reference engine: Node.race. Design · Review.
  • A timer writes its absolute wake time before it parks, so a restart does not restart the delay. Design · Review.
  • A deadline that has already passed settles the node at once. Design · Review.
  • Two sleeps of the same length are two waits. Design · Review.
  • Call Human.confirm(name, prompt, options?): The person supplies: Yes or no; Result type: boolean. Design · Review.
  • Call Human.ask(name, prompt, options?): The person supplies: Prose; Result type: string. Design · Review.
  • Call Human.select(name, prompt, choices, options?): The person supplies: One of choices; Result type: The union of choices. Design · Review.
  • Call Human.json(name, prompt, Schema, options?): The person supplies: A value the schema accepts; Result type: The schema's type. Design · Review.
  • options is { timeout?, maxAttempts? }. Design · Review.
  • maxAttempts defaults to 10, the reference engine's HumanTask.defaultMaxAttempts. Design · Review.
  • A refused answer is recorded, and the run parks on the next attempt. Design · Review.
  • Refusing is an answer; it is not a failure of the transport. Design · Review.
  • The call fails with Human.Failed, whose code is request_invalid, rejected or timeout. Design · Review.
  • Human.answer(W, run, name, value) records an answer. Design · Review.
  • It reads the current attempt from the engine's waiting row. Design · Review.
  • Human.validate(value, request) checks an answer before it is sent. Design · Review.
  • Human.json takes one schema. Design · Review.
  • The reference engine takes two descriptions of the answer, a JSON Schema for the question and an Effect Schema for HumanTask.decode, and "a disagreement surfaces as a defect" (flow/docs/guides/ask-a-person.md). Design · Review.
  • The library derives the first from the second. Design · Review.
  • An answer approves the workflow's question and nothing else. It grants no file, network or process permission. Design · Review.
  • A permission prompt is the kernel's, in capabilities. Design · Review.
  • Wait Durable.sleep, Durable.until: Waiting reason: timer, with wakeAt; Wakes on: The clock. Design · Review.
  • Wait a signal's wait(): Waiting reason: event, with the token; Wakes on: send. Design · Review.
  • Wait Human.*: Waiting reason: approval, with the attempt's token; Wakes on: Human.answer. Design · Review.
  • The reasons are the reference engine's WaitingAnnotation (flow/docs/concepts/suspension-and-replay.md). Design · Review.
  • An operator reads them off a parked run. Design · Review.
  • The compiler recognizes a wait by the declaration its callee resolves to. Design · Review.
  • An alias keeps the meaning, and a local function named sleep gains none. Design · Review.
  • In a workflow body try Experimental.Durable.sleep(d): Emitted: Sleep.action.call({ millis }). Design · Review.
  • In a workflow body try paid.wait(): Emitted: WaitFor.action.call({ name: "paid" }), then Node.map with the schema's decoder. Design · Review.
  • In a workflow body try Experimental.Human.confirm(name, prompt, { timeout }): Emitted: HumanTask.action.call({ name, kind: "confirm", prompt, timeoutMs }). Design · Review.
  • In Effect code paid.send(Checkout, run, v): Emitted: DurableDeferred.succeed(gate, { token, value }), with gate = WaitFor.deferred("paid") and token = DurableDeferred.tokenFromExecutionId(gate, { flow: Checkout, executionId: run }). Design · Review.
  • In Effect code Experimental.Human.answer(W, run, name, v): Emitted: HumanTask.answer({ token, value }), the token built from HumanTask.deferred(name, attempt). Design · Review.
  • The signal value and Human are thin library code over WaitFor, DurableDeferred and HumanTask. Design · Review.
  • The compiler adds Sleep.layer, WaitFor.layer and HumanTask.layer to W.layer for a workflow that uses them, because the reference engine's system actions "push no layer obligation onto callers" and fail at run time when the layer is missing. Design · Review.
  • Codes are assigned when this VIP is built. Design · Review.
  • Slug workflow-try: When: try sleep(…), timeout(…) or another fiber wait in a workflow body; The message names: Experimental.Durable.sleep, or try.race with it. Design · Review.
  • Slug wait-outside-workflow: When: A signal's wait(), a Human question or Durable.sleep in Effect code that is not a workflow body; The message names: sleep, or moving the wait into a workflow. Design · Review.

Adopted review answers

  • Keep Experimental.X names under VIP-33. Promotion to a bare module name requires a later decision. Review question 1.
  • Signals are library values recognized by the compiler; there is no signal keyword. Review decision.

Decisions made while building

The implementation settled these points, which the design above left open or stated in the reference engine's terms. The maintainers decided each one on 2026-11-10. Will has not reviewed them.

  • The waits run on Effect's DurableClock and DurableDeferred under the Experimental.Durable engine (VIP-60), not on the reference engine's Sleep, WaitFor and HumanTask actions, because that engine is Effect's WorkflowEngine. A wait needs no layer, so the compiler adds none to W.layer.
  • Each wait is one recorded step whose start carries its waiting reason. Experimental.Durable.waiting(run) reads a run's open waits from its journal: { reason, name, seq, since, wakeAt?, token?, attempt?, request? }. This is the waiting row Human.answer reads the attempt from.
  • A wait point is the optional last argument of both ends: try paid.wait("second") and try paid.send(W, run, value, "second").
  • A delivery made before the run reaches the wait is kept and returned when it does. The run must exist: send to an unknown run is a defect.
  • send and Human.answer resume the run after they record, so an engine started after a crash wakes it.
  • Experimental.Durable.sleep and until take { name }. A named timer's identity does not depend on which concurrent branch reaches it first; an unnamed timer is numbered in the order its run reaches it.
  • Experimental.Durable.until takes a Date or epoch milliseconds. A wake time that is not an instant, such as NaN, dies with Experimental.Durable.TimerInvalid.
  • Human.answer fails with Human.AnswerInvalid, whose code is answer_invalid (the value is not JSON, or is larger than 256 KiB) or answer_not_open (the run is not parked on that question). These are the reference engine's HumanAnswerInvalid codes.
  • Human.answer records the value as it is, and the run validates it. Human.validate(value, request) takes { kind, choices?, schema? }, where schema is the question's own schema. The JSON Schema derived from it is published for display and validates nothing.
  • Human.Failed carries code, question, attempts, rejections and message. question is the reference engine's task field under the name of the call's first argument.
  • A race over waits is Experimental.Durable.race({ name, success, error?, effects }): Effect's DurableDeferred.raceAll with a scope of its own, which is what try.race in a workflow body lowers to. The winner is journaled under name, and task calls and unnamed timers inside the race are numbered within it. A task call or an unnamed timer inside Effect's own DurableDeferred.raceAll or into dies with Experimental.Durable.UnstableStep, because a recorded race skips its body on a replay and the numbers after it would shift.
  • Human.answer can be sent again after a crash: an equal answer already in the journal is not recorded twice, and the run is woken.
  • A question's deadline is journaled once, when it is first asked. An answer already recorded wins over a deadline that passed while the run was down.

Compared

The first example for the reference engine 1.x. It type-checks against the reference engine's flow and plan packages at 1.0.0-rc.16.

import { Action, DurableDeferred, Flow, HumanTask, Sleep } from "@smthrs/flow"
import { Node } from "@smthrs/plan"
import { Schema } from "effect"
 
export const Deploy = Action.make("release/Deploy", {
  payload: { build: Schema.String },
  success: Schema.String,
  tier: "irreversible",
  idempotencyKey: ({ build }) => `deploy:${build}`
})
 
export const Release = Flow.make("release/Release", {
  payload: { build: Schema.String },
  success: Schema.String,
  error: Schema.Union([HumanTask.HumanTaskFailed, Sleep.SleepRequestInvalid]),
  body: ({ build }) =>
    HumanTask.action.call({ name: "ship", kind: "confirm", prompt: `Ship ${build}?`, timeoutMs: 6 * 60 * 60 * 1000 }).pipe(
      Node.branch({
        if: (approved) => approved === true,
        then: () => Sleep.action.call({ millis: 60_000 }).pipe(Node.andThen(Deploy.call({ build }))),
        else: () => Node.succeed("held")
      })
    )
})
 
export const approve = (executionId: string, attempt: number) =>
  HumanTask.answer({
    token: DurableDeferred.tokenFromExecutionId(HumanTask.deferred("ship", attempt), { flow: Release, executionId }),
    value: true
  })
ProgramTokens (o200k_base)Lines
Vibe, proposed13318
Reference engine 1.x29930

The signal example is 97 tokens in 13 lines.

Checked. The reference-engine program type-checks as shown. The three calls, Human.confirm, Durable.sleep and a signal's wait and send, compile under vibelang 0.0.13 in an effect function against a declaration of the proposed module. task and workflow are new. Effect's own DurableClock.sleep({ name: "cooldown", duration: "1 minute" }) compiles today, which is the name clash the Principles section describes.

Principles

  • TypeScript-first. No new syntax. Three plain calls and one exported value.
  • Effect-second. Bends with durable-tasks-workflows. Effect's DurableClock and DurableDeferred are in scope and belong to Effect's replay engine. The reference engine has modules with the same names for its own engine. A Vibe program writes neither name.
  • Optimized for agentic programs. An agent's run stops for a person and costs nothing while it waits.
  • Highly forkable. The recognized calls are one table. A fork that wants Temporal's per-workflow signals changes one row.
  • Factory-first. The factory's own approvals are Human.confirm calls in its workflows.
  • One meaning per form. sleep stays Effect.sleep everywhere. A durable timer has its own name, and a workflow refuses the fiber one.
  • Hand-written Effect. Each form lowers to the reference engine's call in the table.

What this changes

  • The workflow lowering table gains three rows. The grammar does not change.
  • vibelang-runtime/experimental/Durable exports sleep, until and signal. Experimental.Human is new.
  • The proposals page's sleep and waitSignal<T> spellings are replaced. waitSignal<T> derived a schema from a type argument at a call, which no TypeScript form does.

Alternatives

  • A signal Paid { amount: number } declaration. It saves about 13 tokens a signal (8 against 20 to declare one, 3 against 4 to wait) and derives a tag. The tag is not needed: a wait's address already holds the workflow and the run. The keyword would also sit on TC39's Signals proposal, which gives Signal a different meaning.
  • waitSignal<T>("name"), the earlier design. The sender has no value to import, so nothing ties its payload to the waiter's type.
  • Let sleep mean a durable timer inside a workflow. Fewer names, and one form with two behaviors. Refused by principle 6.
  • A human question as a signal with a prompt. HumanTask adds validation, re-asking and a rejection record. It is its own call.
  • Every approval inside an opaque task. The plan would no longer show where a run can stop.

Follow-up questions

  1. Waits inside a task body. This VIP allows waits in workflow bodies only. The reference engine offers DurableClock.sleep and DurableDeferred.await to an implementation. Decide with question 3 of durable-tasks-workflows.
  2. Who may answer. The reference engine leaves authorization to the endpoint. Should Human.answer and send require a capability, such as human:answer:<name>? Recommendation: yes, in a later revision. It adds two actions to a closed list in capabilities.
  3. Notifications. The reference engine's notifications package tells a run's launcher, by email or a chat message, that someone is waiting. It is a product surface, and a notification is never the answer. This VIP leaves it out.

Depends on