Skip to content
Subako TypeScript SDK
Esc
navigateopen⌘Jpreview
On this page

Overview

What the Subako TypeScript SDK does, which package you need, and where to start.

A session with an agent runs for a while. It outlives the request that started it, events arrive as they happen, and at some point the agent will ask your code to do something only your code can do: look up a record, call an internal service, fill in the form the person is looking at.

This SDK is how you hold that conversation in TypeScript without writing a socket and a switch statement. It works the same in a backend job with nobody watching as it does in a browser.

pnpm add @subako-ai/sdk

Node 22 or newer. The package is ESM only and ships no runtime dependencies.

What is in it

The packages

@subako-ai/sdk covers the whole API on its own. Reach for the others when you are building a page the agent drives.

Package What it is
@subako-ai/sdk The client. Sessions, streaming, tools, errors, pagination.
@subako-ai/react A provider and four hooks over a session connection.
@subako-ai/tools Ready-made tools that drive a page: fill a form, submit it, navigate.
@subako-ai/assistant-ui A working chat over a session, or a runtime for your own thread.
@subako-ai/react-hook-form react-hook-form as a form-tool spec.
@subako-ai/react-router React Router as a navigate-tool spec.
@subako-ai/tanstack-router TanStack Router as a navigate-tool spec.

Every package is Apache-2.0 and versioned together.

How the pieces fit

Your backend creates the session

It holds the API key, names the agent, and gets back a session token — scoped to that one session and safe to hand to a browser.

The browser opens a connection

connect(sessionId) reads the log, opens the stream, and keeps both. A dropped connection comes back on its own, resuming from the last sequence number it saw.

Your page declares its tools

A tool client registers what this page can do. The agent calls them by name; your handler answers. Tools that reach an external service go through Subako’s broker instead, which holds the credential.

The UI renders a snapshot

The connection keeps one immutable state object — the events, the transcript, the approvals waiting on someone. A render draws what it returns.

Where to go next

Was this page helpful?