Vercel AI SDK + MemorySync
Long-term memory for generateText and streamText with one wrapLanguageModel call, on AI SDK v6 and v7.
Overview
Install memorysync-ai-sdk and wrap any model once: recalled context is injected before each generation and the exchange persists verbatim after it, streaming included. Standalone helpers cover hand-wired setups, five structured tools give agents explicit memory, and one build supports AI SDK v6 and v7 — the current major no other memory vendor supports.
Setup status and requirements
- Supported version
- memorysync-ai-sdk 1.0.0 (npm)
- Last setup review
- 2026-08-23
- Permissions
- A MemorySync API key with read and write scopes.
- Limits
- Requires the ai package v6 or v7 (Node 18+; ai v7 itself requires Node 22+). JavaScript/TypeScript only — Python agents use the LangChain, LangGraph or CrewAI integrations.
Capabilities
- wrapLanguageModel middleware: recall before generation, persistence after it
- Streaming-safe: persists once on finish, aborted streams store nothing
- AI SDK v6 AND v7 from one build
- Provider-agnostic — zero bundled LLM dependencies
- Recalled memories exposed on providerMetadata
- Five never-throw agent tools with a read-only mode
- Edge-safe: no Node-only imports
Quick Start
import { generateText, wrapLanguageModel } from "ai";import { openai } from "@ai-sdk/openai";import { createMemorySyncMiddleware } from "memorysync-ai-sdk";const model = wrapLanguageModel({model: openai("gpt-4o-mini"),middleware: createMemorySyncMiddleware({ userId: "customer-7" }),});const { text } = await generateText({ model, prompt: "Book my usual trip." });
Use Cases
Next.js chatbots that remember users
AI SDK agents with explicit memory tools
Adding memory to an existing app without changing call sites
Explore More
Built for production AI systems
Build AI systems that remember
MemorySync provides the infrastructure layer for persistent memory, adaptive retrieval, and enterprise AI intelligence.
Start free. No credit card required.