Agentic Memory
Agno Agents natively support Agentic Memory Management and recommends it as the starting point for your memory journey. With Agentic Memory, The Agent itself creates, updates and deletes memories from user conversations. Setenable_agentic_memory=True to give the Agent a tool to manage memories of the user, this tool passes the task to the MemoryManager class.
You may also setenable_user_memories=Truewhich always runs theMemoryManagerafter each user message. See below for an example.
agentic_memory.py
add_history_to_messages=Trueadds the chat history to the messages sent to the Model, thenum_history_runsdetermines how many runs to add.read_chat_history=Trueadds a tool to the Agent that allows it to read chat history, as it may be larger than what’s included in thenum_history_runs.
Creating Memories after each run
Whileenable_agentic_memory=True gives the Agent a tool to manage memories of the user, we can also always “trigger” the MemoryManagement after each user message.
Set enable_user_memories=True which always process memories after each user message.
create_memories_after_each_run.py
Memory Management
TheMemory class in Agno lets you manage all aspects of user memory. Let’s start with some examples of using Memory outside of Agents. We will:
- Add, update and delete memories
- Store memories in a database
- Create memories from conversations
- Search over memories
Adding a new memory
Updating a memory
Deleting a memory
Creating memories from user information
Creating memories from a conversation
Memory Search
Agno provides several retrieval methods to search and retrieve user memories:Basic Retrieval Methods
You can retrieve memories using chronological methods such aslast_n (most recent) or first_n (oldest first):