Skip to main content
The Sazabi TypeScript SDK (@sazabi/sdk) is a typed client for the Sazabi API. It wraps every operation — threads, logs, issues, projects, and more — and adds streaming transports and device-authorization helpers. It is an ES-module package for server-side JavaScript and TypeScript. For browser telemetry, use the browser SDK instead — it sends data with a public key, whereas this SDK reads and writes the API with a secret key.

Install

Create a client

Construct a client with createClient. Provide a credentialProvider whose getToken() returns your secret key (the SDK adds the Bearer prefix itself), and optionally the active organization and project:
client.ts
Options: Create the secret key in the dashboard under Settings > Secret keys (or with sazabi secret-keys create <name>), and read it from an environment variable — never hard-code it.

Core usage

The client groups operations into namespaces. A few common ones:

Threads

threads.create and messages.append start long-running agent work and return a deferred handle; call waitForCompletion() (or poll()) to get the run.

Logs

Issues

Streaming transports

The SDK streams live data over async iterables. Each returns an object you can iterate with for await, and close when you are done.
The agent-event streams expose a cursor; pass it back on reconnect to resume where you left off.

Device authorization

For interactive tools that sign a user in without a pre-provisioned key, the SDK exposes the device-authorization flow:
pollDeviceAuthorization reports pending, authorized, denied, or expired. Poll on the interval the start response returns until the status is terminal.

Further reading

API reference

Every operation the SDK wraps.