resonate-basic-durable-world-usage-typescript

Write durable TypeScript generator workflows with Resonate SDK checkpointing.

6|Updated Jan 8, 2026
One-click install
npx skills add https://github.com/resonatehq/resonate-skills --skill resonate-basic-durable-world-usage-typescript
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: resonate-basic-durable-world-usage-typescript
Source: https://github.com/resonatehq/resonate-skills/tree/main/resonate-basic-durable-world-usage-typescript
Command: npx skills add https://github.com/resonatehq/resonate-skills --skill resonate-basic-durable-world-usage-typescript

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Provides clear, practical guidance for writing durable generator functions with the Resonate TypeScript SDK so developers can build recoverable, deterministic workflows that survive crashes and replays. It eliminates common replay bugs caused by misuse of async/await, non-deterministic APIs, or improper serialization across process boundaries.

Core Features & Use Cases

  • Durable Context API patterns: how to use ctx.run, ctx.beginRun, ctx.rpc, ctx.beginRpc, ctx.detached, ctx.sleep, and ctx.promise correctly to checkpoint execution and coordinate local or remote work.
  • Determinism and serialization rules: guidance on deterministic helpers for time and randomness, serializable RPC arguments, and promise ID strategies for human-in-the-loop and webhook-driven flows.
  • Structured concurrency and error handling: fork-join patterns, implicit awaiting of started work, assert/panic usage, and anti-patterns to avoid unintended side effects on replay.
  • Real-world scenarios: order processing with parallel validation and RPCs, human approval flows with externally resolvable promises, long-duration scheduling with durable sleeps, and safe side-effect wrapping.

Quick Start

Create a generator function that uses yield* ctx.run to call an async helper, yield* ctx.sleep to wait a specific duration, and yield* ctx.promise with a deterministic ID if an external system must resolve it.

Frequently Asked Questions about resonate-basic-durable-world-usage-typescript

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build durable TypeScript workflows that survive process crashes and replays?

Durable TypeScript workflows checkpoint execution and recover after failures by using generator functions with yield* ctx.run, ensuring deterministic execution and automatic state recovery during replays.

How do I implement human-in-the-loop approval flows in a durable workflow?

Human-in-the-loop approvals use yield* ctx.promise with a deterministic ID, allowing external systems or webhooks to resolve the promise and resume the durable workflow execution safely.

Why do my async/await calls cause replay bugs in Resonate TypeScript workflows?

Async/await calls cause replay bugs because they bypass checkpointing and introduce non-deterministic side effects. Use yield* ctx.run for local and remote calls to ensure serializable, recoverable execution.

Can I use structured concurrency for parallel processing in durable generator functions?

Structured concurrency is supported through fork-join patterns with implicit awaiting of started work, ensuring parallel validation and RPCs complete safely without unintended side effects on replay.

How do I handle time and randomness deterministically in durable TypeScript workflows?

Deterministic time and randomness require using specific deterministic helpers instead of native APIs like Date.now or Math.random, preventing state mismatches during workflow execution and replays.