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
Two clients
One for your backend that holds the API key, one for the browser that holds a session token. The type says which routes each reaches.
A session connection
Streams the log and reconnects by itself. Hand its snapshot to a renderer and you are done.
Client tools
Your code answering the agent’s calls. Describe the arguments with zod, or any other Standard Schema.
React bindings
Hooks that scope a tool to a component, so it is offered exactly while that component is mounted.
Agents
Create one, publish the version a session binds to, and say what it is allowed to reach.
Skills and vaults
Upload the bundles an agent reads, and store the credentials the broker uses on its behalf.
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.