Your code dies when the process dies. Resonate makes that not happen. You write normal functions; Resonate persists each step so they survive crashes, restarts, and long waits — minutes, hours, or weeks.
That's durable execution: the function's progress is the source of truth. If the worker crashes mid-saga, the next worker resumes at the last completed step. No state-machine DSL, no orchestration glue. And because it's just ordinary code, it works the same way whether a human wrote it or an agent did — Resonate's SDKs, CLI, and protocol are shaped for both.
The repos in this org demonstrate the patterns end-to-end. Pin the SDK, clone, run.
brew install resonatehq/tap/resonate # the server
npm install @resonatehq/sdk # or: pip install resonate-sdk · cargo add resonate-sdkDocumentation · Distributed async/await
Here's a saga in Resonate — book a flight, hotel, and car; if any step fails, compensate in reverse. Every yield* ctx.run() is a durable checkpoint.
// from example-saga-booking-ts/src/workflow.ts
// https://github.com/resonatehq-examples/example-saga-booking-ts/blob/873a793/src/workflow.ts
import type { Context } from "@resonatehq/sdk";
// ... service imports + a `noRetry` retry policy + a `BookingResult` type
export function* bookTrip(
ctx: Context,
tripId: string,
shouldFail: boolean,
): Generator<any, BookingResult, any> {
let flightId: string | undefined;
let hotelId: string | undefined;
try {
flightId = yield* ctx.run(bookFlight, tripId);
hotelId = yield* ctx.run(bookHotel, tripId);
const carId = yield* ctx.run(
bookCarRental,
tripId,
shouldFail,
ctx.options({ retryPolicy: noRetry }),
);
return { status: "success", tripId, flightId, hotelId, carId };
} catch (error) {
const message = (error as Error).message;
const compensated: string[] = [];
// Compensate in reverse order — each compensation is also durable
if (hotelId) {
yield* ctx.run(cancelHotel, tripId, hotelId);
compensated.push("hotel");
}
if (flightId) {
yield* ctx.run(cancelFlight, tripId, flightId);
compensated.push("flight");
}
return { status: "failed", tripId, error: message, compensated };
}
}What happens when the worker crashes mid-booking:
sequenceDiagram
participant App as bookTrip
participant R as Resonate
App->>R: yield ctx.run(bookFlight)
R-->>App: persisted (flightId)
App->>R: yield ctx.run(bookHotel)
R-->>App: persisted (hotelId)
Note over App,R: process crashes
Note over App,R: a new worker starts later
R->>App: resume from last persisted step
App->>R: yield ctx.run(bookCar)
R-->>App: persisted (carId)
App->>App: return success
No checkpoint table to maintain. No replay logic to write. The generator's position is the state.
New to Resonate? Begin with one of these.
- Quickstart (TypeScript) — a countdown that survives restarts
- Quickstart (Python) — same shape, Python idioms
- Hello World (Rust) — the first Rust SDK example
A curated set, organized by what each one demonstrates.
- Saga + compensation — flight + hotel + car; failure triggers the compensation chain
- Fan-out / fan-in — parallel notification channels with per-channel retry
- Distributed mutex — a serialized lock in ~15 lines; the generator IS the lock
- Next.js (App Router) — Server Actions trigger durable workflows; status polling
- AWS Lambda — Lambda as a stateless trigger; breaks the timeout ceiling
- Cloudflare Workers — durable sleep across edge invocations
- Templated agent — extensible agent template, Crawl / Walk / Run progression
- Multi-agent orchestration — researcher → writer → reviewer with durable handoffs
- Deep research agent — recursive AI research powered by OpenAI
- Approval workflow — a function that suspends until a human resolves a promise
- Kubernetes node drain — durable orchestration with operator confirmation
Beyond Featured — the rest of the catalog grouped by what each example demonstrates. Click to expand.
Patterns (13 more)
- batch-processor — durable progress checkpointing across batches
- durable-chatbot — multi-turn LLM chat with crash-recoverable conversation state
- durable-entity — long-lived entity with durable idle timeout
- event-sourcing — projection from durable event stream, no event store needed
- encryption — AES-256-GCM payload encryption via Encryptor interface
- food-delivery — order → kitchen → driver → pickup → delivery as a durable workflow
- infinite-workflow — while-loop + ctx.sleep; no continueAsNew needed
- priority-queue — 4-tier priority with per-tier concurrency limits
- rate-limiter — sleep-based spacing for N requests per second
- recursive-factorial (TS) · (Py) — distributed recursive computation
- state-machine — order lifecycle with the generator as the state
- webhook-handler — exactly-once webhook processing with deduplication
Integrations (15 more)
- browser-worker — a Resonate worker running in a browser tab
- countdown-gcp · -supabase · -web — durable sleep across surfaces
- databricks-in-the-loop — integrating Databricks notebooks with a backend service
- express-integration — POST triggers durable workflow, GET polls status
- function-as-a-service (Py) — on-prem FaaS demo with GPU worker routing
- kafka-worker (Py) — concurrent message processing without head-of-line blocking
- load-balancing (TS) · (Py) — distribute work across worker pools
- mcp-tools — Resonate behind an MCP server
- nextjs-ecommerce — one-click buy with 5-second cancellation window, every step durable
- supabase-edge — onboarding workflow triggered by Supabase Edge Function
- tigerbeetle-account-creation — durable financial transactions with TigerBeetle
- webservers (Py) — popular Python webserver framework integrations
Agents & AI (11 more)
- ai-image-pipeline — parallel AI image generation with crash recovery
- ai-travel-assistant (Py) — multi-step AI agent with tool use
- async-tools-mcp-server (Py) — background weather collection for Claude Desktop
- bluesky-scraper — durable social media ingestion
- hackernews-research-agent (Py) — durable HN research agent
- agent-tool-background-job — async timer tool via MCP
- openai-deep-research-agent — Cloudflare · GCP · Supabase · Python — recursive AI research across deployment shapes
- schedule-reminder-agent (Py) — autonomous long-running reminder assistant
RPC, HTTP & foundations (15 more)
- async-http-api (TS) · (Py) — submit job, poll for results
- async-rpc (Py) — Remote Function Invocation across processes
- dao-proposal-scorer — off-chain DAO scoring with cryptographic verification
- distributed-calculator (Py) — arithmetic sub-expression distribution
- durable-sleep (TS) · (Py) — sleep for hours, days, or years
- hello-world (TS) · (Py) · (Rust) — first durable function across SDKs
- fan-out-fan-in (Rust) — Rust fan-out/fan-in
- schedule (TS) · (Py) — periodic function scheduling
- token-auth — authentication patterns
- resonate-connect-temporal — connector
Or browse on GitHub directly: TypeScript · Python · Rust
- 75 example repos across TypeScript, Python, and Rust
- 23 Journal posts at journal.resonatehq.io — patterns, walkthroughs, design rationale
- 3 published specifications — Distributed Async Await (served), Async RPC, Durable Promise
- Discord: https://resonatehq.io/discord
- X: https://x.com/resonatehqio
- LinkedIn: https://linkedin.com/company/resonatehq
- YouTube: https://youtube.com/@resonatehq
- Journal: https://journal.resonatehq.io
All examples in this organization are licensed under Apache-2.0. Each example repo carries its own LICENSE file.
Want to add an example? See CONTRIBUTING.md for the quality bar and submission flow. To propose a new example or report a broken one, open an issue using the templates at .github issues. Security issues: see SECURITY.md.