Durable operations
Durable operations are the places a program may stop and later continue. After one commits, it is legal for the process to die. Recovery resumes from that point.
effect
Section titled “effect”External work: HTTP, payments, model calls, anything nondeterministic.
const payment = await effect("payment", () => charge(input));When the effect completes, the result is committed with execution state. Recovery reuses that result. The function body does not run again.
waitForEvent
Section titled “waitForEvent”Park the execution. No compute is held while it waits for a human, a webhook, or another signal.
const approval = await waitForEvent("approved");Recovery of a waiting execution re-arms the wait. It does not replay the prefix that got there.
invoke
Section titled “invoke”Start a child execution. The parent suspends at that boundary and resumes with the child’s result. Child identity is stable: recovery does not spawn a second child for an invoke that already started.
const analysis = await invoke(analyzeSources, { sources });Promise.all
Section titled “Promise.all”The supported parallel form is a structured join over invokes:
const [research, analysis] = await Promise.all([ invoke(runResearch, { query }), invoke(runAnalysis, { query }),]);Completed children are not replayed. Promise.race and unstructured floating promises are not in the TypeScript subset.
Timers are the same idea as waits: sleep, persist, wake.