Skip to content
@resonatehq-examples

Resonate example applications

Examples of Resonate in action.
Resonate Examples — production-shaped patterns. Pick one and run it.

Resonate Examples

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-sdk

Documentation · Distributed async/await

What it looks like

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
Loading

No checkpoint table to maintain. No replay logic to write. The generator's position is the state.

Start here

New to Resonate? Begin with one of these.

Featured examples

A curated set, organized by what each one demonstrates.

Patterns

Integrations

Agents

Human-in-the-loop

Browse all examples

Beyond Featured — the rest of the catalog grouped by what each example demonstrates. Click to expand.

Patterns (13 more)
Integrations (15 more)
Agents & AI (11 more)
RPC, HTTP & foundations (15 more)

Or browse on GitHub directly: TypeScript · Python · Rust

Momentum

Community

License

All examples in this organization are licensed under Apache-2.0. Each example repo carries its own LICENSE file.

Contributing

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.

Popular repositories Loading

  1. example-tigerbeetle-account-creation-ts example-tigerbeetle-account-creation-ts Public

    An example demonstrating how to maintain consistency in the absence of transactions, using the Write Last, Read First principle featuring TigerBeetle

    TypeScript 6

  2. example-openai-deep-research-agent-ts example-openai-deep-research-agent-ts Public

    A recursive Deep Research Assistant powered by OpenAI and Resonate's Distributed Async Await.

    TypeScript 4

  3. example-kafka-worker-py example-kafka-worker-py Public

    Forked from flossypurse/batch-record-deletion

    Example app showcasing Redpanda + Resonate

    Python 3

  4. example-saga-booking-ts example-saga-booking-ts Public

    Saga pattern with automatic compensation. Books flight + hotel + car rental — failure triggers compensation chain. No saga framework needed.

    TypeScript 3

  5. example-schedule-reminder-agent-py example-schedule-reminder-agent-py Public

    An autonomous, long-running Reminder Assistant powered by OpenAI and Resonate's Distributed Async Await.

    Python 2

  6. example-openai-deep-research-agent-py example-openai-deep-research-agent-py Public

    A recursive Deep Research Assistant powered by OpenAI and Resonate's Distributed Async Await.

    Python 1

Repositories

Showing 10 of 94 repositories

Top languages

Loading…

Most used topics

Loading…