feat(integrations): add @mem0/eve memory provider
Give Eve agents a first-class Mem0 recall/capture provider so they can use Mem0 in the agent loop instead of MCP. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
dae67f74f5
commit
1d83bb0835
@@ -0,0 +1,68 @@
|
||||
---
|
||||
title: Eve
|
||||
description: "Use Mem0 as a first-class memory provider for Vercel Eve agents."
|
||||
---
|
||||
|
||||
[Eve](https://eve.dev/docs/memory) is Vercel's agent framework. A memory provider sits in the agent loop: Eve recalls context before each turn, captures completed turns, and exposes provider tools. `@mem0/eve` is Mem0's implementation of that contract.
|
||||
|
||||
This is not the Mem0 MCP connection. MCP gives the model tools it may or may not call. The memory provider runs automatically.
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
npm install @mem0/eve
|
||||
```
|
||||
|
||||
`eve` is a peer dependency. Get an API key from the [Mem0 dashboard](https://app.mem0.ai/dashboard/api-keys).
|
||||
|
||||
Create `agent/memory/mem0.ts`:
|
||||
|
||||
```ts
|
||||
import { defineMemory } from "eve/memory";
|
||||
import { byPrincipal } from "eve/memory/scope";
|
||||
import { mem0Provider } from "@mem0/eve";
|
||||
|
||||
export default defineMemory({
|
||||
description: "Recall and manage durable context for the current user.",
|
||||
provider: mem0Provider({
|
||||
apiKey: process.env.MEM0_API_KEY!,
|
||||
}),
|
||||
scope: byPrincipal,
|
||||
});
|
||||
```
|
||||
|
||||
After Eve lists Mem0 in the official registry, the same slot is created by:
|
||||
|
||||
```bash
|
||||
eve add memory/mem0
|
||||
```
|
||||
|
||||
## How it works
|
||||
|
||||
1. **Recall.** Before each turn, Mem0 searches memories for the locked Eve scope and returns them as attributed user-role messages.
|
||||
2. **Capture.** After a successful turn, Mem0 adds the user and assistant messages and extracts durable facts.
|
||||
3. **Tools.** The model can call `search`, `remember`, and `forget`. Eve qualifies them as `mem0__search`, `mem0__remember`, and `mem0__forget` when the slot file is `mem0.ts`.
|
||||
|
||||
Eve owns namespace, scope, and when recall/capture run. Mem0 owns storage, ranking, and extraction. Every read and write is partitioned by `memory.scope.key`.
|
||||
|
||||
## Options
|
||||
|
||||
```ts
|
||||
mem0Provider({
|
||||
apiKey: process.env.MEM0_API_KEY!,
|
||||
topK: 5,
|
||||
threshold: 0.1,
|
||||
rerank: false,
|
||||
infer: true,
|
||||
autoSearch: { enabled: true },
|
||||
capture: { enabled: true },
|
||||
});
|
||||
```
|
||||
|
||||
See the [`@mem0/eve` README](https://github.com/mem0ai/mem0/tree/main/integrations/eve) for the full option list.
|
||||
|
||||
## Related
|
||||
|
||||
- [Eve memory docs](https://eve.dev/docs/memory)
|
||||
- [Build a memory provider](https://eve.dev/docs/memory/custom-provider)
|
||||
- [Vercel AI SDK](/integrations/vercel-ai-sdk) for `generateText` / `streamText` apps that are not Eve agents
|
||||
Reference in New Issue
Block a user