Working memory and conversation history that persists between messages. Simple provider interface with built-in support for development and production environments. No more "what did we just discuss?"
npm install @ai-sdk-tools/memory
import { Agent } from '@ai-sdk-tools/agents' import { DrizzleProvider } from '@ai-sdk-tools/memory' const agent = new Agent({ name: 'Assistant', model: openai('gpt-4'), instructions: 'You are a helpful assistant.', memory: { provider: new DrizzleProvider(db), workingMemory: { enabled: true, scope: 'user' }, history: { enabled: true, limit: 10 }, chats: { enabled: true, generateTitle: true } } })
Agents maintain a scratchpad that they can read and update. Store user preferences, learned facts, and context between conversations.
Automatically load past messages for context. Agents access the full conversation without manual management.
Track chat sessions with auto-generated titles, message counts, and timestamps. No more "New Chat 1, 2, 3..."
Built-in support for InMemory (dev), Drizzle ORM (SQL), and Upstash (Redis). Swap providers in one line of code.
Works with PostgreSQL, MySQL, SQLite, and Redis. Use your existing database infrastructure.
Full type safety with a simple 4-method provider interface. Implement your own backend in minutes.
import { InMemoryProvider } from '@ai-sdk-tools/memory' const memory = new InMemoryProvider() // Zero configuration // Perfect for local dev
Works instantly with no setup. Data resets on restart.
import { DrizzleProvider } from '@ai-sdk-tools/memory' const memory = new DrizzleProvider(db, { workingMemoryTable, messagesTable }) // PostgreSQL, MySQL, SQLite
Production-ready persistence with any SQL database.
import { UpstashProvider } from '@ai-sdk-tools/memory' import { Redis } from '@upstash/redis' const memory = new UpstashProvider( Redis.fromEnv() ) // Edge-ready Redis
Perfect for edge and serverless environments.
Remember user preferences, currency settings, favorite reports
"Show me last month's expenses like before" - agents remember your preferred format, currency, and categories without asking again.
Track customer context across multiple support sessions
Agents recall past issues, product configurations, and customer preferences to provide personalized support continuity.
Learn user habits, communication style, and priorities
Agents adapt to your preferences over time, remembering how you like information presented and what matters most to you.
Remember project context, coding patterns, and team conventions
Agents maintain awareness of your codebase structure, preferences, and team standards across coding sessions.
Persistent memory for AI agents. Simple provider interface.