Overview
Write durable agents in TypeScript: @duraton/sdk authors workflows, runs a runner, and calls Duraton from app code, all from one package.
@duraton/sdk is how you author workflows, run them on a runner, and talk to Duraton from app code.
Install it and import from the package root:
npm install @duraton/sdkpnpm add @duraton/sdkyarn add @duraton/sdkbun add @duraton/sdkimport {
defineWorkflow,
connect,
serve,
register,
createClient,
NonRetriableError,
RetryAfterError,
PollTimeoutError,
} from "@duraton/sdk";Entry points
Every export is reachable from the package root. The scoped entries are subsets, for code that should not pull in the rest.
import { createClient } from "@duraton/sdk/client"; // no workflow authoring, no runner
import { createMemoryCache } from "@duraton/sdk/ai"; // the AI ports and their adapters
import { serve } from "@duraton/sdk/hono"; // one framework adapter| Entry | Contains | Use it when |
|---|---|---|
@duraton/sdk | Everything below, plus defineWorkflow, connect, serve, register, hashStepId, and the error types. | Authoring workflows and running a runner. |
@duraton/sdk/client | createClient, DuratonApiError, and the REST DTOs. | App code that only calls Duraton - an admin tool, a frontend, a script. |
@duraton/sdk/ai | The AIProvider and AICache ports, their adapters, and the AI journal types. | Supplying your own model provider or cache store. |
@duraton/sdk/bun /hono /elysia /express /fastify /next /node | One serve adapter each. | Mounting an HTTP runner on that framework. |
The surface
Defining workflows
defineWorkflow: name, triggers, retry, flow control.
Steps
The handler context and the durable step API.
connect
Run a runner over an outbound WebSocket - no inbound URL.
Serving runners
serve, register, the framework adapters, and the error types.
REST client
createClient: trigger events, read and control runs.
AI steps
step.ai: durable model calls, agent loops, providers, cache.
Evals
ctx.score, ctx.assert, deferred scorers, datasets.
Python SDK
uv add duraton: the async runner, steps, step.ai, and the REST client.
Go SDK
go get duraton.dev/sdk-go: the runner, generic steps, step.ai, and the REST client.
Prefer another language? The Python and Go SDKs speak the same
connect protocol and cover the same surface - workflows, durable steps, step.ai, and a REST client.