Agent.context
.enable_agentic_memory=True
gives the Agent a tool to manage memories of the user, this tool passes the task to the MemoryManager
class. You may also set enable_user_memories=True
which always runs the MemoryManager
after each user message.add_history_to_messages=True
adds the chat history to the messages sent to the Model, the num_history_runs
determines how many runs to add.read_chat_history=True
adds a tool to the Agent that allows it to read chat history, as it may be larger than what’s included in the num_history_runs
.agent.get_messages_for_session()
.
We can give the Agent access to the chat history in the following ways:
add_history_to_messages=True
and num_history_runs=5
to add the messages from the last 5 runs automatically to every message sent to the agent.read_chat_history=True
to provide a get_chat_history()
tool to your agent allowing it to read any message in the entire chat history.add_history_to_messages=True
, num_history_runs=3
and read_chat_history=True
for the best experience.read_tool_call_history=True
to provide a get_tool_call_history()
tool to your agent allowing it to read tool calls in reverse chronological order.storage
driver to the Agent.Built-in memory example
Run the example
storage
driver and Agno handles the rest. You can use Sqlite, Postgres, Mongo or any other database you want.
Here’s a simple example that demonstrates persistence across execution cycles:
Memory
object and set enable_agentic_memory=True
.
User memory example
Run the example
Memory
object and persisted in the SqliteMemoryDb
to be used across multiple users and multiple sessions.
enable_session_summaries=True
on the Agent
.
Session summary example
Run the example
Parameter | Type | Default | Description |
---|---|---|---|
memory | Memory | Memory() | Agent’s memory object used for storing and retrieving information. |
add_history_to_messages | bool | False | If true, adds the chat history to the messages sent to the Model. Also known as add_chat_history_to_messages . |
num_history_runs | int | 3 | Number of historical responses to add to the messages. |
enable_user_memories | bool | False | If true, create and store personalized memories for the user. |
enable_session_summaries | bool | False | If true, create and store session summaries. |
enable_agentic_memory | bool | False | If true, enables the agent to manage the user’s memory. |