VoltAgent is an open source TypeScript framework for building and orchestrating AI agents.
Escape the limitations of no-code builders and the complexity of starting from scratch.
Escape the limitations of no-code builders and the complexity of starting from scratch.
This example shows how to enable semantic memory using embeddings and a vector database. Messages are embedded on save, stored in LibSQL via LibSQLVectorAdapter, and retrieved with semantic search when the agent answers.
npm create voltagent-app@latest -- --example with-vector-search- OpenAI embeddings via AI SDK (
text-embedding-3-small) - Vector DB via
LibSQLVectorAdapter - Automatic semantic recall in
Agentwhen vector support exists - Optional raw vector search API (
memory.searchSimilar)
import { Agent, Memory, VoltAgent } from "@voltagent/core";
import { LibSQLMemoryAdapter, LibSQLVectorAdapter } from "@voltagent/libsql";
import { honoServer } from "@voltagent/server-hono";
const memory = new Memory({
storage: new LibSQLMemoryAdapter(),
embedding: "openai/text-embedding-3-small",
vector: new LibSQLVectorAdapter(),
});
const agent = new Agent({ name: "Semantic Memory Agent", model: "openai/gpt-4o-mini", memory });
new VoltAgent({ agents: { agent }, server: honoServer({ port: 3142 }) });- Copy
.env.exampleto.envand setOPENAI_API_KEY. - Install deps and start:
pnpm i
pnpm devTo observe semantic recall, seed a conversation with prior messages (see commented demo in src/index.ts), then ask a related question. The agent will merge relevant past messages using semantic search.