> ## Documentation Index
> Fetch the complete documentation index at: https://docs.memanto.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# VoltAgent

> Give VoltAgent agents persistent, cross-session memory with Memanto tools.

# VoltAgent + Memanto

<img src="https://mintcdn.com/memanto/quztxulHuDxgL5_H/logo/integrations/voltagent.png?fit=max&auto=format&n=quztxulHuDxgL5_H&q=85&s=7600b08e08b21bacdf87e7c21f509366" alt="VoltAgent" width="64" style={{marginBottom: "1.5rem"}} data-path="logo/integrations/voltagent.png" />

Add persistent memory to any [VoltAgent](https://voltagent.dev/) agent with three ready-made tools, shipped as part of the `@moorcheh-ai/memanto` TypeScript SDK.

## Prerequisites

* Node.js 20+
* [`uv`](https://docs.astral.sh/uv/) (ships `uvx`) -the `Memanto` client spawns a local Memanto server via `uvx` on first use unless you pass `baseUrl`
* **Memanto / Moorcheh credentials** -[Moorcheh API key](https://console.moorcheh.ai/api-keys) (cloud) or an [on-prem](/on-prem/overview) backend (no Moorcheh API key). Set `MOORCHEH_API_KEY` or pass `apiKey` to `new Memanto({ ... })`
* **Agent model credentials** -the quick start uses OpenAI `gpt-4o` for tool orchestration. Set `OPENAI_API_KEY` (or swap `openai("gpt-4o")` for any provider VoltAgent supports). Memanto memory tools do **not** use this key -they talk to Memanto/Moorcheh only
* `@voltagent/core` and `zod` installed in your app (optional peer dependencies of `@moorcheh-ai/memanto`)

## Install

```bash theme={null}
npm install @moorcheh-ai/memanto @voltagent/core zod @ai-sdk/openai
```

`@voltagent/core` and `zod` are optional peer dependencies of `@moorcheh-ai/memanto` -install them yourself in the host app. Importing `@moorcheh-ai/memanto/voltagent` without them installed will fail at module load with a standard Node resolution error.

## Quick Start

```ts theme={null}
import { Agent } from "@voltagent/core";
import { openai } from "@ai-sdk/openai";
import { Memanto } from "@moorcheh-ai/memanto";
import { createMemantoVoltAgentTools } from "@moorcheh-ai/memanto/voltagent";

const memanto = new Memanto({
  agentId: "my-agent",
  apiKey: process.env.MOORCHEH_API_KEY, // omit when using on-prem; see On-Prem below
});

const agent = new Agent({
  name: "Assistant",
  instructions:
    "You have long-term memory. Persist durable facts with rememberMemory " +
    "and look them up with recallMemory / answerMemory before answering.",
  model: openai("gpt-4o"), // requires OPENAI_API_KEY -swap for your provider if needed
  tools: createMemantoVoltAgentTools(memanto),
});

const response = await agent.generateText(
  "What milk does Alex like? Also note he switched to soy today.",
);
console.log(response.text);
```

`createMemantoVoltAgentTools` returns an array of three [VoltAgent tools](https://voltagent.dev/docs/agents/tools/) -pass it straight into an agent's `tools` array.

Each tool's description is written for the model to decide *when* to call it (e.g. `recallMemory`: "Call this before answering whenever the user refers to information from earlier or from a previous session").

## Available Tools

| Tool             | Backed by                                                  | Description                                                                                                                                          |
| ---------------- | ---------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| `recallMemory`   | [Recall](/api-reference/search/recall)                     | Semantic search over stored memories. `query` (required), `limit` (1-50), `type` (optional array of memory types to filter by).                      |
| `rememberMemory` | [Remember](/api-reference/data/remember)                   | Persist a durable fact/preference/decision/instruction. `content` (required), `type` (optional -server auto-classifies if omitted), `title`, `tags`. |
| `answerMemory`   | [Generate AI Answer](/api-reference/ai/generate-ai-answer) | RAG-synthesized answer over stored memories. `question` (required), `limit` (1-100).                                                                 |

`answerMemory` calls Memanto's **Generate AI Answer** API (`memanto.answer()` → Moorcheh `answer.generate`). Memanto retrieves relevant memories and synthesizes a grounded response using **Memanto's configured LLM** -not the model you pass to your VoltAgent `Agent`. Your agent model only decides *when* to call the tool and how to use the result. `recallMemory` and `rememberMemory` do not invoke an LLM.

## Options

```ts theme={null}
createMemantoVoltAgentTools(memanto, {
  include: ["recallMemory", "answerMemory"], // expose a subset -omit for all three
  defaultLimit: 10,                           // default limit for recall/answer when the model doesn't specify one
});
```

## Memory Types

`type` fields are constrained to Memanto's 13 supported types via a shared `MEMORY_TYPES` export:

```ts theme={null}
import { MEMORY_TYPES } from "@moorcheh-ai/memanto/voltagent";
// ["fact", "preference", "goal", "decision", "artifact", "learning", "event",
//  "instruction", "relationship", "context", "observation", "commitment", "error"]
```

See the [Memory Types Reference](/reference/memory-types) for what each type means.

## On-Prem

The integration talks to Memanto through the `Memanto` client, so it works identically against an on-prem backend -no code changes, just configure the backend once with the CLI. See [On-Prem Overview](/on-prem/overview) and the [TypeScript SDK Reference](/sdk/typescript#on-prem-no-api-key).

## Next Steps

* [TypeScript SDK Reference](/sdk/typescript) for the full `Memanto` client API
* [Vercel AI SDK Integration](/integrations/vercel-ai-sdk) for the equivalent AI SDK tools
* [Mastra Integration](/integrations/mastra) for the equivalent Mastra tools
* [OpenAI Integration](/integrations/openai) for the equivalent OpenAI `runTools()` tools
* [Memory Types Reference](/reference/memory-types)
