Overview

The @duraton/sdk TypeScript API - how to author workflows and connect a runner to Duraton.

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

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

Everything is exported from the package root:

import {
  defineWorkflow,
  serve,
  register,
  connect,
  NonRetriableError,
  RetryAfterError,
} from "@duraton/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 Duraton from app code - triggering events, reading and controlling runs. Both ship in @duraton/sdk; the client also has a runner-free @duraton/sdk/client entry.

The surface

Two ways to run a workflow

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

  • serve + register - the runner runs an HTTP handler and Duraton calls it. Best for a publicly reachable service.
  • connect - the runner dials Duraton 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