Skip to main content

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

ProviderPackagePersistenceUse Case
InMemory@voltagent/coreNone (RAM only)Development, testing
Managed Memory@voltagent/voltagent-memoryVoltOps-hostedProduction-ready, zero-setup
LibSQL@voltagent/libsqlLocal SQLite or remoteSelf-hosted, edge deployments
Postgres@voltagent/postgresSelf-hosted PostgresExisting Postgres infrastructure
Supabase@voltagent/supabaseSupabaseSupabase-based applications

Core Features

  • Conversation Storage - Messages stored per userId and conversationId
  • 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:

Table of Contents