@rewind.codes/sdk is the TypeScript SDK of Rewind. It has three parts:
The client
The HTTP API
/v1: toolsets, workflows, runs, signals, forks, traces, end users, webhooks.The host-tool worker
Executes your own tools when scripts call them.
The agent tools
run_script, get_run, retry_run… for your model, with Anthropic and OpenAI adapters.Install
Run, Toolset, Task, WebhookEvent…).
Create a client
Create API keys in the dashboard, under Organization → API keys, or with
rewind.apiKeys.create. A key has a role
(harness for a backend, worker for a host-tool worker only, reader for reading) and may be limited to labels.
Act for an end user
Every run belongs to an end user of your product: its namespace. A client with a key names the end user of its requests withnamespace(), which is cheap: one per request is fine.
NamespaceRequiredError. On a read, a namespace narrows the answer to it; without one, a read covers every
namespace.
An agent acting for one end user can instead hold a token of their namespace:
Conventions
- Durations are numbers of milliseconds or strings:
"30s","10d","1h30m". - Cancellation. Every call takes an
AbortSignalassignal. - Waiting.
runs.start,runs.get,runs.forkandruns.canceltakewait: they answer when the run ends or whenwaitpasses. A long wait is split into requests of at most 50 seconds, so proxies never cut it. - Lists have a
listthat returns a page and alistAllthat iterates over every item. - Errors are thrown as
RewindApiError, with aslugyou test withisProblem. See Errors.
Versions
The package follows Semantic Versioning. Before 1.0, a minor version (0.2 → 0.3) may break the API and a patch version does not. Each version speaks the HTTP API/v1; its changes are in the
changelog.