Agent Memory
VoltAgent's Memory
class stores conversation history and enables agents to maintain context across interactions. Supports persistent storage, semantic search, and working memory.
Storage Providers
Provider | Package | Persistence | Use Case |
---|---|---|---|
InMemory | @voltagent/core | None (RAM only) | Development, testing |
Managed Memory | @voltagent/voltagent-memory | VoltOps-hosted | Production-ready, zero-setup |
LibSQL | @voltagent/libsql | Local SQLite or remote | Self-hosted, edge deployments |
Postgres | @voltagent/postgres | Self-hosted Postgres | Existing Postgres infrastructure |
Supabase | @voltagent/supabase | Supabase | Supabase-based applications |
Core Features
- Conversation Storage - Messages stored per
userId
andconversationId
- Semantic Search - Retrieve past messages by similarity (requires embedding + vector adapters)
- Working Memory - Compact context storage (Markdown template, JSON schema, or free-form)
- Workflow State - Suspendable workflow checkpoint storage
Quick Start
import { Agent, Memory } from "@voltagent/core";
import { ManagedMemoryAdapter } from "@voltagent/voltagent-memory";
import { openai } from "@ai-sdk/openai";
const memory = new Memory({
storage: new ManagedMemoryAdapter({
databaseName: "my-app-memory",
}),
});
const agent = new Agent({
name: "Assistant",
model: openai("gpt-4o-mini"),
memory,
});
// First message
await agent.generateText("My name is Sarah", {
userId: "user-123",
conversationId: "chat-001",
});
// Agent remembers context
await agent.generateText("What's my name?", {
userId: "user-123",
conversationId: "chat-001",
});
Complete Documentation
For detailed configuration, provider setup, and advanced features:
- Memory Overview - Full memory system documentation
- Managed Memory - Production-ready hosted storage
- Semantic Search - Vector-based message retrieval
- Working Memory - Compact context management
- Storage Adapters - Provider-specific guides