Persistent Memory for Vercel AI SDK - Unison Integration
Give Vercel AI SDK agents persistent team memory: contextMd into the system prompt, conversation ingest after each generation.
Learn how to give Vercel AI SDK agents persistent team memory with Unison.
Official adapter
The fastest path is @unisonlabs/ai-sdk — a middleware that recalls brain memory before each call and persists the turn after:
npm i @unisonlabs/ai-sdk aiimport { generateText, wrapLanguageModel } from 'ai';
import { unisonMemory } from '@unisonlabs/ai-sdk';
import { openai } from '@ai-sdk/openai';
const model = wrapLanguageModel({
model: openai('gpt-4o'),
middleware: unisonMemory({ sessionId: 'user-123' }), // reads UNISON_TOKEN
});
await generateText({ model, prompt: 'What did we decide about auth?' });unisonMemory() accepts { sessionId, token?, apiUrl?, k?, recall?, persist? } — recall before the call and persist after both happen automatically, so it works the same with generateText and streamText. For multi-user products, mint a brain:act-as service key and pass an actor per user so each gets an isolated private namespace (details).
Persistent Memory for the OpenAI Agents SDK - Unison Integration
Add persistent team memory to OpenAI Agents SDK agents: recall as instructions context, write back after each run.
Persistent Memory for Mastra - Unison Integration
Give Mastra agents persistent team memory with the Unison TypeScript SDK: recall into instructions, ingest on completion.