Sdk typescript

Add Unison to a TypeScript Agent - SDK Quickstart

Give your TypeScript agent persistent team memory with @unisonlabs/sdk: install, first recall, and the write-back loop in under five minutes.

unison-brain

Learn how to give your TypeScript agent persistent team memory using the Unison SDK.

1. Install and authenticate

bun add @unisonlabs/sdk        # or npm install @unisonlabs/sdk
export UNISON_TOKEN=usk_live_...   # from `unison auth login` or POST /v1/auth/provision

2. Recall before the task

import { BrainClient } from "@unisonlabs/sdk";

const brain = new BrainClient({ token: process.env.UNISON_TOKEN });

const ctx = await brain.context({ q: "payment service architecture" });
const memory = ctx.weakEvidence ? "" : ctx.contextMd;
// inject `memory` into your model's system prompt

3. Write back what the agent learned

await brain.ingest({
  items: [{
    type: "conversation",
    sourceRef: sessionId,
    turns: messages.map(m => ({ role: m.role, content: m.content })),
  }],
});

That's the whole loop: recall at task start, ingest at task end. Entity and fact extraction runs async server-side - the next session's recall already knows what this one learned.

Next: actor delegation for per-end-user isolation, the full SDK surface, or error handling.

On this page