A worked example of `resonate.schedule()` — what the server persists, what the worker claims, and what the function author writes.
Run a TypeScript function on a cron schedule with crash-recoverable execution. Each tick fires a fresh durable promise that a worker claims and executes; a crash mid-execution is retried, not lost.
How an AI-vs-AI chess match becomes a generator on a serverless function — durable, bounded in replay, recursive across games via ctx.detached.
Two AI players take turns through a generator function on a Cloud Function. Each move is a durable checkpoint, each pause is a durable sleep, and a detached tail call re-roots the workflow after every game so replay scope stays bounded forever.
How an Express route handler triggers a durable generator workflow with no separate worker process, no event schema, and no mount point.
A POST /orders Express route kicks off a 4-step order workflow that retries failed steps without re-running prior ones and deduplicates client retries on the order id.
A nested loop over priority tiers becomes the scheduler when every yield* is a durable Resonate checkpoint.
Process a batch of jobs in strict priority-tier order with up to 2 jobs running concurrently per tier. Each job is a durable checkpoint, so a mid-batch crash only retries the failing job — completed higher-priority jobs are not re-run.
How a stateless Edge Function runs a stateful, checkpointed onboarding workflow keyed by user id.
A Supabase Database Webhook fires an Edge Function on user INSERT; Resonate makes the four-step onboarding workflow durable across function invocations, retries, and duplicate webhook deliveries.
How the fan-out / fan-in pattern collapses to four ctx.beginRun calls plus four yields when every branch is a durable promise.
Notify a customer over email, SMS, Slack, and push in parallel. Each channel is an independent durable checkpoint, so a retry of one branch does not re-send the others.
How an Express gateway dispatches durable work to a worker pool and lets clients poll a non-blocking status endpoint.
Accept an HTTP request, dispatch durable work to a separate worker process, and let the client poll for completion. The gateway holds no state; Resonate keeps the promise alive across worker crashes and restarts.
How a generator workflow suspends on a latent durable promise and resumes when an HTTP handler settles it by ID.
Block a Resonate generator workflow on human approval for an indefinite duration. The workflow yields a latent durable promise; an Express gateway settles it from outside, and the suspension survives worker crashes.
How a Server Action and a status route share a durable promise id so the page can poll for completion without holding the request open.
A Next.js Server Action kicks off a 4-step background workflow keyed by a report id; a separate API route resolves the same id to poll for completion. The workflow and the status route share one in-process Resonate registry.
How a 15-line generator workflow produces mutual exclusion across workers without signals, lock workflows, or external coordination.
Serialize N workers around a shared resource without a lock workflow or signal channel. A generator that yields each worker in a for-loop IS the mutex; the SDK handles crash recovery and retry.
How a two-step money-transfer saga is exposed over HTTP with two layers of idempotency and crash-recoverable replay.
Move funds between two accounts as a debit + credit saga, triggered by an Express POST and made durable by Resonate. Idempotency is enforced at the execution id and at the ledger row.
Two stdio MCP servers — weather forecast and invoice approval — each backed by a registered Resonate generator workflow.
Wrap a Resonate workflow behind a stdio MCP server so an AI client can call it as a tool. Each tool invocation runs as a durable execution with replay, retry on throw, and durable timers.
How three sequential LLM calls collapse to three lines of generator code when every yield is a Resonate checkpoint.
Sequence three LLM agents — researcher, writer, reviewer — through one generator workflow. Each `yield* ctx.run(...)` is a durable checkpoint, so a mid-pipeline failure retries only the failed agent.
How the same recursive fan-out / fan-in workflow runs across six deployment shapes in three languages.
A recursive LLM agent that decomposes a topic into subtopics and dispatches a fresh durable workflow per subtopic, with six sibling variants spanning plain Node, Cloudflare Workers, Google Cloud Functions, Supabase Edge Functions, Python, and Rust.
How a chain-triggered off-chain workflow checkpoints every step through ctx.run and resumes from the last completed child on replay.
A blockchain event triggers a multi-step off-chain workflow whose every step is a durable child promise. The orchestrator is a generator function; each child is registered separately on a named worker group.
How a Stripe-style payment webhook becomes exactly-once when the event_id is the durable promise id and each step is a checkpoint.
Process Stripe-style payment webhooks exactly once by using the event_id as the Resonate promise id. Retries from the provider reattach to the existing durable execution instead of triggering a second charge.
How a user session lifecycle is expressed as a single generator function when each step is a Resonate durable checkpoint and the idle timer survives crashes.
Model a user session as a long-running generator: login, per-activity checkpoints, durable idle timeout, and cleanup. Crashes resume mid-lifecycle without re-recording earlier activities or restarting the timer.
Three remote-invocation shapes — rpc, detached, rfi — across an Express gateway and nine service groups, with crash recovery.
Cross-process function calls survive node crashes when the call graph is a durable promise. The example shows await-chain, detached-chain, and fan-out flows using a single TypeScript SDK with three RFI shapes.
The smallest unit of a Resonate TypeScript program — a generator workflow, two leaf functions, a registered handle — annotated for retrieval.
The minimum durable program in the Resonate TypeScript SDK: one generator workflow, two async leaf functions, no server required. Each ctx.run call is a durable checkpoint that short-circuits on replay.
How a multi-turn chatbot stops re-prompting users and re-charging tokens when every LLM call is a Resonate durable checkpoint.
A multi-turn chatbot must survive transient LLM failures mid-turn without re-prompting the user or paying twice for the same completion. On Resonate, each turn is a workflow keyed by session and turn number, and the Claude call inside it is a ctx.run checkpoint.
How the Write Last, Read First state machine collapses to a short generator when each step is a durable checkpoint.
Create an account in a System of Reference (SQLite) and a System of Record (TigerBeetle) without a distributed transaction. Each step is a Resonate durable checkpoint; replays after a crash skip completed steps and finish the write.
How an infinite monitoring loop, an LLM call per story, and an in-memory deduplication set survive process restarts without an external state store.
A continuous LLM-driven monitor that scans Hacker News, scores stories for relevance, and notifies on findings. Each step is a durable checkpoint and the deduplication set rebuilds itself from the promise store on restart.
How `ctx.sleep` collapses long-lived waits into one yield by suspending the workflow against a durable timer promise.
Suspend a generator workflow for seconds, days, or years without holding a process open. The sleep is a server-backed timer promise; any worker in the group resumes the workflow when the timer fires.
How a Lambda handler triggers a durable Resonate workflow without inheriting Lambda's 15-minute execution limit.
AWS Lambda accepts a document-processing request and returns 202, then a Resonate durable workflow runs the multi-step pipeline on a separate worker that has no 15-minute ceiling.
How a saga collapses to a generator function with try/catch when every step is a Resonate durable checkpoint.
Book a flight, hotel, and car rental as a single transaction. If the car rental fails, hotel and flight are cancelled in reverse order. Each step is a durable checkpoint, so a crash mid-compensation resumes where it left off.
How a node drain that may block for arbitrary human response time is written as a single generator function with checkpointed steps and a blocking durable promise.
Drain Kubernetes worker nodes durably: each node drain is a checkpoint, and when a Pod Disruption Budget blocks eviction the workflow blocks on a durable promise until an operator resolves it over HTTP.
How a browser tab registers as a Resonate worker, claims recursive factorial invocations addressed by the poll://any@default invoke tag, and resumes its work after a refresh.
Host a Resonate worker inside a browser tab so durable invocations are claimed and executed by client-side code. The tab subscribes to the Resonate server over SSE, claims tasks for its worker group, and resumes work after a refresh because every step is a durable promise.
A one-click checkout where the cancellation window is a durable `ctx.run` over a Promise race, not a `PENDING / CONFIRMED / CANCELLED` state row.
Start a purchase, open a 5-second window in which the user can cancel, then confirm or cancel. The window is one `ctx.run` over a Promise that races a timer against an EventEmitter signal — checkpointed, so a crash mid-window resumes from where it left off.
How an unbounded health-check loop stays durable across step failures using ctx.run plus ctx.sleep, with no periodic history-reset step.
A health monitor that loops forever — check services, alert, sleep, repeat. The loop is a plain while; each iteration is a Resonate checkpoint, each pause is a durable sleep, and there is no history-size limit to reset by hand.
How a six-step delivery pipeline with a no-driver compensation branch fits inside a single generator function when every yield is a Resonate durable checkpoint.
A six-step food delivery pipeline — order, prepare, assign driver, pickup, deliver, complete — where every step is a durable checkpoint and a transient mid-step failure retries in place without re-invoking earlier steps.
How the Resonate TypeScript SDK enforces server-side authentication and per-client promise-ID isolation through two constructor options.
Restrict which clients can talk to the Resonate server and which promise IDs each client can touch by passing a signed JWT and a prefix claim to the Resonate constructor.
How a generator with one ctx.run per event becomes a crash-resumable event sourcing pipeline without an external event store.
Reduce a stream of domain events into a state projection where each event is one durable checkpoint. Crash at event 5, resume at event 5; events 0-4 return from the durable promise store without re-applying.
How a download/summarize/approve agent reads as straight-line generator code when scrape, LLM, notification, and human gate are all Resonate primitives.
Scrape a page, summarize it with an LLM, gate the result on human approval, and regenerate on rejection — as one generator workflow. Each step is a durable checkpoint and the approval pause is a latent durable promise the gateway settles from outside.
How one durable-sleep workflow runs on Lambda, Workers, Cloud Functions, Edge Functions, Kafka, browsers, and Python without changing the function body.
A countdown loop that sleeps between steps and survives crashes, shown across 8 deployment shapes. The workflow body is one generator; only the platform adapter changes.
How fan-out / fan-in over an AI-provider call collapses to two for-loops when each branch is a Resonate durable promise.
Generate multiple style variations of an image prompt in parallel, with per-branch crash recovery. Each generator call is a durable checkpoint; a failed call retries independently while the others continue.
How a six-state order workflow collapses to straight-line generator code when each ctx.run call is a durable checkpoint.
An order moves through created, confirmed, shipped, delivered (or cancelled, refunded), and must resume cleanly mid-transition after a crash. With Resonate the generator's execution position IS the state — each transition is a ctx.run checkpoint, no K/V store required.
How recursion stays straight-line code when every invocation is its own durable promise.
A function that calls itself across worker processes, with each invocation backed by a durable promise so crashes resume from the last completed sub-call and repeat top-level calls return the stored result.
How a ~50-line AES-256-GCM Encryptor keeps PII out of the promise store without touching workflow logic.
Encrypt every value Resonate stores — function arguments, return values, intermediate state — by implementing a two-method Encryptor interface. Workflow code is unchanged; the codec calls encrypt() on the way in and decrypt() on the way out.
How a for-loop with ctx.sleep between calls becomes a crash-safe per-workflow rate limiter with no external token bucket.
Send N API calls at a fixed rate using ctx.sleep between calls. The sleep is a durable checkpoint, so a crash mid-batch resumes at the next request without duplicating earlier ones and without bursting after restart.
How a worker group plus a `poll://any@workers` target collapses service discovery, load balancing, and crash recovery into a constructor arg and an option string.
Run multiple TypeScript workers in a named group and dispatch durable RFIs to any one of them. The Resonate Server handles service discovery, load balancing, and dispatch recovery; the worker code is one function and a group string.
How a Kafka-fed worker collapses head-of-line blocking and crash-resume into straight-line code by treating each message as a durable promise.
A Kafka consumer kicks off one durable workflow per message and returns immediately. Each step is a checkpoint; a worker crash mid-deletion resumes from the last completed batch, and the record id deduplicates retries.
How the batch-processor pattern collapses to a for-loop of ctx.run calls when each iteration is a durable checkpoint.
Process a large record set in fixed-size batches and resume from the last completed batch after a crash. Each batch is a durable checkpoint; completed batches return from cache on replay without re-running.
How a self-spawning workflow walks a social graph using context.detached, with each step durably checkpointed.
Walk a Bluesky follower graph to bounded depth by spawning a detached durable workflow per follower. Each step is a checkpoint; the recursion survives worker restarts.
We use strictly necessary cookies to run this site. With your consent we also use Google Analytics to understand traffic. We do not load analytics until you choose to allow it. Privacy Policy.