The MemoryTools toolkit enables Agents to manage user memories through create, update, and delete operations. This toolkit integrates with a provided database where memories are stored. The toolkit implements a “Think → Operate → Analyze” cycle that allows an Agent to:
  1. Think through memory management requirements and plan operations
  2. Execute memory operations (add, update, delete) on the database
  3. Analyze the results to ensure operations completed successfully and meet requirements
This approach gives Agents the ability to persistently store, retrieve, and manage user information, preferences, and context across conversations. The toolkit includes the following tools:
  • think: A scratchpad for planning memory operations, brainstorming content, and refining approaches. These thoughts remain internal to the Agent and are not shown to users.
  • get_memories: Gets a list of memories for the current user from the database.
  • add_memory: Creates new memories in the database with specified content and optional topics.
  • update_memory: Modifies existing memories by memory ID, allowing updates to content and topics.
  • delete_memory: Removes memories from the database by memory ID.
  • analyze: Evaluates whether memory operations completed successfully and produced the expected results.

Example

Here’s an example of how to use the MemoryTools toolkit:
from agno.agent import Agent
from agno.db.sqlite import SqliteDb
from agno.models.openai import OpenAIChat
from agno.tools.memory import MemoryTools

# Create a database connection
db = SqliteDb(
    db_file="tmp/memory.db"
)

memory_tools = MemoryTools(
    db=db,
)

agent = Agent(
    model=OpenAIChat(id="gpt-5-mini"),
    tools=[memory_tools],
    markdown=True,
)

agent.print_response(
    "My name is John Doe and I like to hike in the mountains on weekends. "
    "I like to travel to new places and experience different cultures. "
    "I am planning to travel to Africa in December. ",
    user_id="john_doe@example.com",
    stream=True
)

# This won't use the session history, but instead will use the memory tools to get the memories
agent.print_response("What have you remembered about me?", stream=True, user_id="john_doe@example.com")
Here is how you can configure the toolkit:
from agno.tools.memory import MemoryTools

memory_tools = MemoryTools(
    db=my_database,
    enable_think=True,            # Enable the think tool (true by default)
    enable_get_memories=True,     # Enable the get_memories tool (true by default)
    enable_add_memory=True,       # Enable the add_memory tool (true by default)
    enable_update_memory=True,    # Enable the update_memory tool (true by default)
    enable_delete_memory=True,    # Enable the delete_memory tool (true by default)
    enable_analyze=True,          # Enable the analyze tool (true by default)
    add_instructions=True,        # Add default instructions
    instructions=None,            # Optional custom instructions
    add_few_shot=True,           # Add few-shot examples
    few_shot_examples=None,      # Optional custom few-shot examples
)