@reliantlabs/sdk, so you can put a run’s progress in your own tools: an internal dashboard, a status page for your team, a script.
Before you begin
- The
reliantCLI, v1.21 or later, signed in (Sign in and tokens), and an API token inRELIANT_TOKENfor this local script (Credentials). - Node 22.18 or newer, which runs a
.tsfile directly. - A workflow to watch. This guide uses
release-checkfrom Start and follow agent runs from a Go service, which needs no model and waits on a question.
1
Install the SDK
The package is not on the npm registry yet. Build
reliantlabs-sdk-0.1.0.tgz from the Reliant repository as the TypeScript SDK page describes, then install it with its peer dependencies and a Connect transport:terminal
2
Start a run to watch
terminal
Chat/Execution ID it prints: a run lives in a chat, and the stream is per chat.3
Write the watcher
watch.ts
reliant.chat() returns a ChatSession. It opens the chat’s stream, folds every update into one state object, and calls your listener on each change. onCaughtUp reports how each connection synced: a snapshot of the whole chat, or a replay of what was missed since the state’s cursor. Passing a saved state as initialState is what turns the second connection into a replay.4
Run it, answer, and watch it resume
terminal
reliant workflow answer <chat-id> --select Ship (or in the app), then press Enter:5
Move it into a browser
In a frontend, swap
staticTokenProvider for an AuthTokenProvider over the signed-in user’s own session (getToken, hasSession, refresh), and feed chat.subscribe and chat.getState to your framework’s external-store hook, such as React’s useSyncExternalStore. Never ship an API token to a browser (Where the token comes from). To resume across a page reload, save the state yourself: its cursor is a bigint and some fields are Maps and Sets, so write a serializer rather than JSON.stringify.What this does not do
- It shows a signed-in user their own chats. Every stream acts as the Reliant user whose credential it holds, and a chat that is not theirs is refused. It is not a way to give your own customers a chat with your app.
- It doesn’t start runs or answer questions. The TypeScript SDK streams chats and sends messages. Starting runs, answering questions and firing triggers are in the Go SDK, on your server.
- It doesn’t decide approvals. The state lists pending approvals so you can show them; deciding one takes a person in the app.
Troubleshooting
The session sets an error and stops reconnecting
The session sets an error and stops reconnecting
The server refused the chat: it does not exist, or is not the signed-in user’s. The two cases look the same on purpose. Check the chat ID and whose token
getToken returns.Cannot read properties of null (reading 'edgesOut')
Cannot read properties of null (reading 'edgesOut')
npm install in a copy of sdk/ts failed while resolving peer dependencies. Install there with npm install --legacy-peer-deps, or build it inside the repository’s frontends/web workspace with pnpm install.Next steps
Start runs from Go
Start the runs this watcher follows, from your server.
TypeScript SDK reference
Sends with retry, tool bodies, the reducer on its own.
Pause and steer a run
Change what a running agent does from the app or the CLI.
SDK credentials and scopes
Which token goes where, and what each scope allows.