How a self-calling function stays durable and content-addressed when every invocation is its own durable promise.
A Resonate Python worker computes factorial recursively across a worker pool. Each invocation is a durable promise keyed by the input, so prior results are returned from the store on replay without re-execution.
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 the fan-out / fan-in pattern collapses to four `yield ctx.rfi(...)` calls plus four `yield <handle>` fan-in points 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 `ctx.sleep` collapses long-lived waits into one line by suspending the workflow against a durable timer promise.
Suspend a workflow for seconds, days, or years without holding a process open. The sleep is a server-backed timer promise; another worker resumes the workflow when the timer fires, even if the original worker is gone.
How a Redpanda-fed Python worker collapses head-of-line blocking and crash-resume into straight-line generator code by treating each message id as a durable promise id.
A Redpanda 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 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 worker group plus a `poll://any@workers` target collapses service discovery, load balancing, and crash recovery into config strings.
Run multiple Rust workers in a named group and dispatch durable RPCs to any one of them. The Resonate Server handles service discovery, load balancing, and recovery; the worker code is one function and a group string.
How a Lambda handler hands a multi-step Python workflow to a long-running Resonate worker that survives Lambda's 15-minute timeout.
AWS Lambda has a hard 15-minute execution ceiling. Split the work: Lambda accepts the request and dispatches a durable RPC, and a long-running Resonate worker runs the multi-step workflow with each step checkpointed.
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 generator-style workflow blocks indefinitely on a ctx.promise() and resumes the moment an external HTTP handler calls resonate.promises.resolve.
Block a workflow on a human click without polling, schedulers, or queues. The workflow yields a durable promise that an HTTP gateway resolves from outside on a later request.
How a self-calling calculator function distributes its sub-tasks across task groups while keeping each step a durable checkpoint.
Parse an arithmetic expression into a tree, then recursively dispatch each sub-expression to a worker pool and the operator to a separate pool. Every sub-expression is its own durable promise, so partial results survive crashes and the recursion is plain Python.
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.
How a single recursive function plus durable-promise IDs gives you distributed computation and a permanent result cache in one shape.
Compute factorial(n) by having one function call itself across a worker group. Each call pairs with a durable promise keyed by n, so previously computed results return without recomputing.
How three sequential LLM agents become four lines of generator code when every yield is a Resonate checkpoint.
Coordinate researcher, writer, and reviewer agents in sequence. Each agent handoff is a durable checkpoint, so a failure mid-pipeline retries only the failed agent — completed agents are not re-run.
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.
Three remote-invocation shapes — rfc, detached, rfi — across a Flask gateway and nine Python 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 in Python using rpc, rfc, rfi, and detached.
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 workflow suspends on a latent durable promise and resumes when an HTTP handler resolves it by ID.
Block a Resonate workflow on human approval for an indefinite duration. The workflow awaits a latent durable promise; an HTTP gateway resolves it from outside, and the suspension survives worker crashes.
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 an axum 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 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 MCP tools coordinate on one durable promise keyed by job name — work survives MCP-server restarts and deduplicates by id.
Three MCP tools — start_gathering, probe_status, await_result — coordinate on one Resonate durable promise keyed by job name; after a crash the worker reclaims the promise and re-runs the function from the top.
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 Resonate workflow combines an LLM step with a durable-promise approval gate and a re-summarize loop when the human rejects.
Scrape a URL, summarize it with a local LLM, then block on a durable promise until a human confirms or rejects. Rejection re-runs the summarize step; confirmation completes the workflow.
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 tagging a Python process with `group="worker-group"` and addressing an RPC to `poll://any@worker-group` handles service discovery, load balancing, and crash recovery.
Spread work across N identical Python workers and recover in-flight executions when one of them crashes, by tagging each worker with a group name and addressing the call to any member of that group.
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 a Python webserver route invokes a registered function under durable execution and reads its result without standing up a separate worker process.
A request handler invokes a Resonate-registered function; the SDK executes it as a durable promise inside the same process and returns the result inline.
How a two-step money transfer with compensating reversal is written as straight-line Python when each step is a Resonate durable checkpoint.
Move funds between two accounts with debit + credit + compensating reversal against a SQLite ledger. Each step is a durable checkpoint and replays are idempotent on a deterministic op_id.
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 long-running keyword-monitoring agent collapses to a generator workflow when every yield is a durable checkpoint and the promise store IS the state store.
Continuously scan Hacker News, score each story with an LLM, and notify on hits — without re-analyzing stories after a crash. Every step is a Resonate checkpoint and the dedup set rebuilds on replay, so no external database is needed.
How `resonate.schedule(name, cron, func_name, args)` registers a server-side cron whose ticks become durable promises picked up by any worker in the group.
Run a Rust function on a cron expression where every tick is a durable promise on the server. If a worker crashes mid-tick, another worker in the group resumes the same execution — the tick is not lost.
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.
The smallest unit of a Resonate Rust program — a workflow, a leaf function, and a worker — annotated for retrieval.
The minimum durable program in the Resonate Rust SDK: one workflow function, one leaf function, one worker process. Crash the worker mid-run and the execution resumes from the last checkpoint.
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 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 an MCP tool call dispatches into a Resonate workflow that checkpoints each step and deduplicates by promise ID.
Expose a durable Resonate workflow as a Model Context Protocol tool over stdio. The MCP server stays stateless, the workflow checkpoints each step on a worker process, and concurrent calls for the same input deduplicate by promise ID.
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 `ctx.run(...).spawn()` turns parallel work items into individually durable promises that survive process crashes.
Run several work items in parallel and collect their results, while keeping per-item progress durable across crashes. Each spawned task is its own durable promise, so a restart only re-executes items that had not completed.
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 RPC, RFI, and ctx.detached split a FaaS submission into one durable orchestration on a router process and a pool of replaceable executors in a named worker group.
Submit function executions to a named worker group via durable RPC, RFI, and detached invocations; the orchestration survives worker crashes because the durable promise lives on the Resonate server, not in the router process.
How an MCP server returns a promise id instead of blocking, and lets the agent ask back later — backed by a Resonate-registered function and a durable sleep.
Expose a long-running job to an LLM as an MCP tool that returns a promise id immediately, then let the agent poll for completion against a durable promise on the Resonate server.
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 FastAPI gateway dispatches durable work to a worker group 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 FastAPI gateway holds no state; Resonate keeps the promise alive across worker crashes and restarts.
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 single generator orchestrator triggers a long-running Databricks job and blocks on a durable promise that the notebook resolves out-of-band.
Trigger a Databricks job from a FastAPI service and resume a workflow when the job calls back, without splitting business logic across event handlers. The orchestrator yields a durable promise that the notebook resolves over HTTP.
How `ctx.sleep` collapses long-lived waits into one yield by suspending the workflow against a durable timer promise.
Suspend a workflow for seconds, days, or years without holding a Python process open. The sleep is a server-backed timer promise; another worker resumes the workflow when the timer fires, even if the original worker is gone.
How an autonomous agent loop with a long-lived sleep step collapses to straight-line generator code when each yield is a durable checkpoint.
An LLM-driven reminder assistant that parses a natural-language request, picks a target timestamp, and sleeps until then before sending the reminder. The sleep is a durable timer, so no cron, queue, or database is needed.
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 three-function greeting program demonstrates the Resonate Python SDK's local-mode workflow, registration, and ctx.run primitive.
The minimum Resonate Python workflow: one generator function calls two ordinary functions through ctx.run, and the SDK turns each call into a durable checkpoint with zero server setup.
How the Rust SDK turns a per-Kafka-message handler into a durable workflow keyed by the message id, with non-blocking dispatch and replay from the last checkpoint.
A Redpanda consumer dispatches one durable Resonate workflow per message and immediately moves on. Each ctx.run is a checkpoint; a crash mid-deletion resumes from the last completed batch, and the record id deduplicates retries.
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.
A multi-turn tool-using LLM agent expressed as one generator function with three branches, where every LLM call, web call, and user prompt is a Resonate durable checkpoint.
An LLM agent that searches the web, scrapes pages, and converses with a user across many turns must not lose context to a crash. Each LLM call, tool call, and user input becomes a durable checkpoint via `ctx.lfc`.
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.