Skip to content

Commit 494b620

Browse files
ysolankydirkbrnd
andauthored
memory-v2-faq-ag-3010 (#226)
Changes: - Faq for memory v2 changes --------- Co-authored-by: Dirk Brand <[email protected]>
1 parent 96bf8a0 commit 494b620

File tree

2 files changed

+86
-4
lines changed

2 files changed

+86
-4
lines changed

faq/memoryv2.mdx

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
---
2+
title: Memory V2
3+
sidebarTitle: Memory V2
4+
---
5+
6+
## Memory V2
7+
8+
Starting with Agno version 1.4.0, **Memory V2** is now the default memory for the Agno Agent. This replaces the previous `AgentMemory` and `TeamMemory` classes which is now deprecated but still available to use.
9+
10+
Memory V2 is a more powerful and flexible memory system that allows you to manage message history, session summaries, and long-term user memories.
11+
12+
## How to Continue Using AgentMemory (Memory V1)
13+
14+
If you want to continue using `AgentMemory` and avoid breaking changes, you can do so by updating your imports. By default, the Agent now uses the `Memory` class:
15+
16+
```python
17+
from agno.memory.v2 import Memory
18+
```
19+
20+
To use the legacy AgentMemory class instead, import it like this:
21+
22+
```python
23+
from agno.memory import AgentMemory
24+
25+
agent = Agent(
26+
memory=AgentMemory()
27+
)
28+
```
29+
30+
## Key Memory V2 Changes
31+
32+
- **Accessing Messages:**
33+
34+
- **Before:**
35+
```python
36+
agent.memory.messages
37+
```
38+
- **Now:**
39+
```python
40+
[run.messages for run in agent.memory.runs]
41+
# or
42+
agent.get_messages_for_session()
43+
```
44+
45+
- **User Memories:**
46+
47+
- **Before:**
48+
49+
```python
50+
from agno.memory import AgentMemory
51+
52+
memory = AgentMemory(create_user_memories=True)
53+
agent = Agent(memory=memory)
54+
```
55+
56+
- **Now:**
57+
58+
```python
59+
from agno.memory.v2 import Memory
60+
61+
memory = Memory()
62+
agent = Agent(create_user_memories=True, memory=memory) or team = Team(create_user_memories=True, memory=memory)
63+
```
64+
65+
- **Session Summaries:**
66+
67+
- **Before:**
68+
69+
```python
70+
from agno.memory import AgentMemory
71+
72+
memory = AgentMemory(create_session_summary=True)
73+
agent = Agent(memory=memory)
74+
```
75+
76+
- **Now:**
77+
78+
```python
79+
from agno.memory.v2 import Memory
80+
81+
memory = Memory()
82+
agent = Agent(enable_session_summaries=True, memory=memory) or team = Team(enable_session_summaries=True, memory=memory)
83+
```

mint.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -380,9 +380,7 @@
380380
},
381381
{
382382
"group": "Evals",
383-
"pages": [
384-
"evals/introduction"
385-
]
383+
"pages": ["evals/introduction"]
386384
}
387385
]
388386
},
@@ -1250,7 +1248,8 @@
12501248
"faq/could-not-connect-to-docker",
12511249
"faq/openai_key_request_for_other_models",
12521250
"faq/structured-outputs",
1253-
"faq/When-to-use-a-Workflow-vs-a-Team-in-Agno"
1251+
"faq/When-to-use-a-Workflow-vs-a-Team-in-Agno",
1252+
"faq/memoryv2"
12541253
]
12551254
},
12561255
{

0 commit comments

Comments
 (0)