# The best way to give an AI agent memory

_By Apoorv Khanna, November 16, 2026_

For most agents, the best way to add memory is Mem0 and two calls: `mem0/add` stores what was said and `mem0/search` recalls it in a later session, at 1¢ each through Vaaya. Pick Zep when the facts change over time, and Letta when you want a separate stateful agent that edits its own memory.

## What "best" means for agent memory

Mem0, Zep and Letta have different shapes, so the choice depends on what your agent needs handed back when a session starts. Three things decide it:

- **What comes back.** A ranked list of facts, a ready-made block of context, or a reply from an agent that remembers.
- **Calls per session.** Every memory action is 1¢, so the number of calls is the whole cost.
- **Facts that change.** A status or preference stored last month may be wrong today.

## The options in the Vaaya catalog

Prices are as listed on 16 November 2026. The [catalog](/catalog) has current prices.

| Tool | What it returns | Price per call | When to pick it |
| --- | --- | --- | --- |
| `mem0/add` | A queued event id. Mem0 extracts facts from your messages | 1¢ | Store what a user said or decided |
| `mem0/search` | Ranked memories with scores for one `user_id` | 1¢ | Recall facts before the agent answers |
| `zep/user-add` | Creates the user that threads attach to | 1¢ | Once per end user |
| `zep/thread-create` | Opens a thread for one conversation | 1¢ | Once per conversation |
| `zep/add` | Adds messages to the user's knowledge graph | 1¢ | Store turns when facts change over time |
| `zep/get-context` | A summarised context block for a thread | 1¢ | Put what is true now into a prompt |
| `zep/search` | Specific facts from the user's graph | 1¢ | Look up one fact |
| `letta/agent-create` | The `id` of a stateful agent | 1¢ | Once per persona or user |
| `letta/message` | The agent's reply. It edits its own memory | 1¢ | When the agent should decide what to keep |

## The default path

Start with Mem0. It has no setup step: `mem0/add` and `mem0/search` are the whole interface, both scoped by a `user_id` you choose.

Step up when that shape does not fit:

- **Zep, when what is true changes.** Zep keeps a temporal knowledge graph for each user. Add an update to a thread and `zep/get-context` returns what is true now, with the old fact superseded. The order is fixed: create the user, then a thread, then add messages. Nothing is created for you.
- **Letta, when the agent should manage its own memory.** You create a stateful agent once with `letta/agent-create` and talk to it with `letta/message`. It decides what to keep and rewrites its own memory blocks, so you never call add or search.

## A worked example: store today, recall tomorrow

This is arithmetic at listed prices on 16 November 2026.

In the first session you give a coding agent two rules for a repository. Before the session ends, the agent stores them:

```json
{
  "service": "mem0",
  "action": "add",
  "params": {
    "messages": [
      { "role": "user", "content": "This repo uses pnpm. Never run npm install here." },
      { "role": "assistant", "content": "Understood. pnpm only." },
      { "role": "user", "content": "Deploys go out through pull requests. Do not push to main." }
    ],
    "user_id": "storefront-7f3a91c2"
  },
  "max_cost_cents": 1
}
```

That is 1¢. Mem0 extracts the facts in the background.

The next day a new session starts with an empty context, and the agent recalls:

```json
{
  "service": "mem0",
  "action": "search",
  "params": {
    "query": "package manager and deploy rules",
    "user_id": "storefront-7f3a91c2",
    "top_k": 5
  },
  "max_cost_cents": 1
}
```

Another 1¢. The call returns ranked memories with scores, and the agent puts the relevant ones at the top of its prompt.

Total: 1¢ + 1¢ = 2¢. Recall at the start of every session and store at the end, and the agent spends 2¢ a session, or 40¢ over 20 sessions.

The same job in the other two shapes:

- **Zep:** `zep/user-add`, `zep/thread-create` and `zep/add` to store (3¢), then `zep/get-context` to recall (1¢), so 4¢ the first time. Later conversations need only a thread and an add (2¢), and `return_context: true` on the add returns the context block in the same call.
- **Letta:** `letta/agent-create` once (1¢), then one `letta/message` per turn. Two turns to state the rules and one question the next day come to 1¢ + 2¢ + 1¢ = 4¢.

## How to run it

Connect your agent to Vaaya with the [install guide](/install), over MCP, the API or the SDK. Then give it a standing instruction. An agent that forgets between sessions also forgets that it has a memory, so put the instruction somewhere that loads every time: a project file such as `CLAUDE.md` or `AGENTS.md`, a system prompt, or your own agent loop.

> Use Vaaya memory for this repository with `user_id` "storefront-7f3a91c2". At the start of each session, search memory for rules and decisions that apply to the task, and read them before you act. When I state a new rule or we make a decision, store it. Never store keys, passwords or personal details. Set `max_cost_cents` to 1 on every memory call.

The agent can ask Vaaya's `consult` tool to plan the calls. It returns each call with its params and price. Each call carries `max_cost_cents`: if the price is higher than that number, the call is refused and nothing is charged.

In your own loop, the pattern is read before write: search before the model answers, and add after a turn that produced a durable fact.

## What to check, and where this falls short

- **Read what was stored.** `mem0/add` returns an event id, and Mem0 decides which parts of the messages are durable facts. A search sent straight after an add may not find them yet, so wait a moment, then search and compare the result with what was said. Pass `infer: false` to keep text exactly as written.
- **Keep one `user_id`.** Mismatched ids hide memories or return them to the wrong user. The id is all that separates one set of memories from another, so make it unique and hard to guess, such as a UUID. Avoid first names and email addresses.
- **Store the facts and leave the transcript out.** Documents, datasets and scraped pages belong in file storage (`files/upload`, 1¢).
- **Do not search in a loop.** Each search is 1¢. A limit on the agent's key caps a runaway loop, and [long-running vs short-lived agents](/blog/budget-long-running-short-lived-agents) covers how to set one.
- **Reuse the Letta agent.** Save the `id` from `letta/agent-create` and send every turn to it.

What not to store: API keys, passwords, tokens and card numbers, and personal data about other people unless they have agreed to it. Everything you store is sent to the vendor and held there, and recalled memories go into prompts, which can be logged and passed to other tools. As listed, the catalog has store and recall actions for these services and no delete or edit action, so plan on anything you store staying stored.

## Why memory suits a pay-per-call wallet

Memory spend is small and tied to sessions: a cent to recall and a cent to store. A wallet charges those cents as they happen, with no subscription and no separate account or API key for each of the three services. You can try all three shapes on one conversation for 2¢ + 4¢ + 4¢ = 10¢. A daily, weekly or monthly limit on the agent's key ([spending controls](/spending-controls)) keeps a looping agent inside a budget.

## Questions

**Which memory service should an AI agent use: Mem0, Zep or Letta?**

Start with Mem0. It stores facts with mem0/add and returns ranked matches with mem0/search, with no setup call. Use Zep when facts change over time and you need what is true now. Use Letta when you want a stateful agent that manages its own memory.

**How much does it cost to give an AI agent memory?**

Every Mem0, Zep and Letta action in the Vaaya catalog is listed at 1¢ per call on 16 November 2026. Storing a conversation with Mem0 and recalling it in a later session is two calls, so 2¢.

**Why can my agent not find a memory it just stored?**

mem0/add returns a queued event and the facts are extracted in the background, so a search sent straight afterwards may not find them yet. Also check that the add and the search use exactly the same user_id.

**What should an agent never store in memory?**

API keys, passwords, tokens and card numbers, and personal data about other people unless they have agreed to it. The Vaaya catalog lists store and recall actions for these services and no delete action, so treat anything stored as hard to remove.
