Code

cookbook/tools/mem0_tools.py
from agno.agent import Agent
from agno.tools.mem0 import Mem0Tools

agent = Agent(
    instructions=[
        "You are a memory-enhanced assistant that can remember information across conversations",
        "Store important information about users and their preferences",
        "Retrieve relevant memories to provide personalized responses",
    ],
    tools=[Mem0Tools(user_id="user_123")],
    markdown=True,
)

agent.print_response("Remember that I prefer vegetarian meals and I'm allergic to nuts")

Usage

1

Create a virtual environment

Open the Terminal and create a python virtual environment.
python3 -m venv .venv
source .venv/bin/activate
2

Set your API keys

export MEM0_API_KEY=your-mem0-api-key
export MEM0_ORG_ID=your-organization-id
export MEM0_PROJECT_ID=your-project-id
export OPENAI_API_KEY=xxx
3

Install libraries

pip install -U mem0ai openai agno
4

Run Agent

python cookbook/tools/mem0_tools.py