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.
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/provision2. 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 prompt3. Write back what the agent learned
await brain.remember({
dump: { turns: messages.map(m => ({ role: m.role, content: m.content })) },
source: "my-agent",
sourceRef: sessionId,
});That's the whole loop: recall at task start, remember at task end. Curation (dedupe, then note + entity 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.
Team vs personal memory
Personal memory makes one agent remember one user. Team memory makes every agent and human on a project share one accumulating source of truth.
TypeScript SDK
Install @unisonlabs/sdk and use the complete, typed brain surface from TypeScript or Bun: context recall, ingest, documents, the knowledge graph, and actor delegation.