Overview
This guide will show you how to integrate Mem0 with Mastra to add long-term memory capabilities to your agents. We’ll create tools that allow agents to save and retrieve memories using Mem0’s API.Installation
Install the Integration Package To install the Mem0 integration, run:integrations/index.ts
tools/index.ts
agents/index.ts
index.ts
- We import the
@mastra/mem0
integration - We define two tools that use the Mem0 API client to create new memories and recall previously saved memories
- The tool accepts
question
as an input and returns the memory as a string