Relay Engine

Runtime Interface

TypeScript SDK

Zero-dependency worker client with strict payload schemas and deterministic replay.

npm install @relay-engine/sdk
src/workflows/dunning.ts

Declare deterministic steps with typed inputs and automatic state checkpointing.

import { workflow } from "@relay-engine/sdk";

export const dunningCycle = workflow({
  id: "billing.dunning",
  retry: { attempts: 5, backoff: "exponential", baseMs: 500 },
  async run(ctx, input: { invoiceId: string }) {
    const attempt = await ctx.step("charge", () =>
      payments.capture(input.invoiceId)
    );

    if (attempt.status === "declined") {
      await ctx.sleep("grace-window", "72h");
      await ctx.step("notify", () => mailer.sendNotice(input.invoiceId));
    }

    return { settled: attempt.status === "paid" };
  },
});
Runs on Node 22, Bun, and edge workers. Compare quotas →