Overview

The @durablex/sdk TypeScript API - how to author workflows and connect a runner to the engine.

The TypeScript SDK is how you author workflows and connect a runner to the engine. Add it to your project:

bun add @durablex/sdk      # or: npm install @durablex/sdk

Everything is exported from the package root:

import {
  defineWorkflow,
  serve,
  register,
  connect,
  NonRetriableError,
  RetryAfterError,
} from "@durablex/sdk";

The type tables in this reference are generated from the SDK source, so they always match the installed version.

The SDK has two halves: the authoring + runner half below (define workflows and run them), and a typed REST client for talking to the engine from app code - triggering events, reading and controlling runs. Both ship in @durablex/sdk; the client also has a runner-free @durablex/sdk/client entry.

The surface

Two ways to run a workflow

A workflow is authored once with defineWorkflow, then exposed to the engine by a runner. The runner picks the transport:

  • serve + register - the runner runs an HTTP handler and the engine calls it. Best for a publicly reachable service.
  • connect - the runner dials the engine over a WebSocket and needs no inbound URL. Best for an agent behind NAT.

Both are covered in serving runners; see runners for when to pick which.

On this page