Customizing the Memory Manager

The MemoryManager class is responsible for handling the LLM used to create and update memories. You can adjust it to personalize how memories are created and updated:
from agno.agent import Agent
from agno.db.sqlite import SqliteDb
from agno.memory import MemoryManager
from agno.models.openai import OpenAIChat

# Setup your database
db = SqliteDb(db_file="agno.db")

# Setup your Memory Manager, to adjust how memories are created
memory_manager = MemoryManager(
    db=db,
    # Select the model used for memory creation and updates. If unset, the default model of the Agent is used.
    model=OpenAIChat(id="gpt-5-mini"),
    # You can also provide additional instructions
    additional_instructions="Don't store the user's real name",
)

# Now provide the adjusted Memory Manager to your Agent
agent = Agent(
    db=db,
    memory_manager=memory_manager,
    enable_user_memories=True,
)

agent.print_response("My name is John Doe and I like to play basketball on the weekends.")

agent.print_response("What's do I do in weekends?")

Memories and Context

When using Memory with your Agents, memories about the current user will be added to the agent’s context by default. If you want your Agent to create and update memories, but not have them added to the context of each request to the model, you can use the add_memories_to_context flag:
from agno.agent import Agent
from agno.db.sqlite import SqliteDb

# Setup your database
db = SqliteDb(db_file="agno.db")

# Setup your Agent with Memory
agent = Agent(
    db=db,
    enable_user_memories=True, # This enables Memory for the Agent
    add_memories_to_context=False, # This disables adding memories to the context
)

Sharing Memory Between Agents

Often, you will want multiple Agents to share the same memories. To achieve this, you just need to provide the same database to those agents. All Agents will then have access to the same memories for a given user:
from agno.agent import Agent
from agno.db.sqlite import SqliteDb

# Setup your database
db = SqliteDb(db_file="agno.db")

# Setup your Agents with the same database and Memory enabled
agent_1 = Agent(db=db, enable_user_memories=True)
agent_2 = Agent(db=db, enable_user_memories=True)

# The first Agent will create a Memory about the user name here:
agent_1.print_response("Hi! My name is John Doe")

# The second Agent will be able to retrieve the Memory about the user name here:
agent_2.print_response("What is my name?")