Skip to content

Commit 9da0186

Browse files
committed
Release 1.7.1
1 parent 75ab8ef commit 9da0186

File tree

2 files changed

+83
-1
lines changed

2 files changed

+83
-1
lines changed

libs/agno/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "agno"
3-
version = "1.7.0"
3+
version = "1.7.1"
44
description = "Agno: a lightweight library for building Multi-Agent Systems"
55
requires-python = ">=3.7,<4"
66
readme = "README.md"

libs/agno/tests/integration/teams/test_team_with_storage_and_memory.py

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from agno.memory.v2.db.sqlite import SqliteMemoryDb
99
from agno.memory.v2.memory import Memory
1010
from agno.models.anthropic.claude import Claude
11+
from agno.models.google.gemini import Gemini
1112
from agno.models.openai.chat import OpenAIChat
1213
from agno.storage.sqlite import SqliteStorage
1314
from agno.team.team import Team
@@ -77,6 +78,36 @@ def route_team(team_storage, memory):
7778
)
7879

7980

81+
@pytest.fixture
82+
def route_team_with_members(team_storage, agent_storage, memory):
83+
"""Create a route team with storage and memory for testing."""
84+
85+
def get_weather(city: str) -> str:
86+
return f"The weather in {city} is sunny."
87+
88+
def get_open_restaurants(city: str) -> str:
89+
return f"The open restaurants in {city} are: {', '.join(['Restaurant 1', 'Restaurant 2', 'Restaurant 3'])}"
90+
91+
travel_agent = Agent(
92+
name="Travel Agent",
93+
model=Gemini(id="gemini-2.0-flash-001"),
94+
storage=agent_storage,
95+
memory=memory,
96+
add_history_to_messages=True,
97+
role="Search the web for travel information. Don't call multiple tools at once. First get weather, then restaurants.",
98+
tools=[get_weather, get_open_restaurants],
99+
)
100+
return Team(
101+
name="Route Team",
102+
mode="route",
103+
model=Gemini(id="gemini-2.0-flash-001"),
104+
members=[travel_agent],
105+
storage=team_storage,
106+
memory=memory,
107+
instructions="Route a single question to the travel agent. Don't make multiple requests.",
108+
enable_user_memories=True,
109+
)
110+
80111
@pytest.mark.asyncio
81112
async def test_run_history_persistence(route_team, team_storage, memory):
82113
"""Test that all runs within a session are persisted in storage."""
@@ -142,6 +173,57 @@ async def test_run_session_summary(route_team, team_storage, memory):
142173
assert len(team_session.memory["summaries"][user_id][session_id]) > 0
143174

144175

176+
@pytest.mark.asyncio
177+
async def test_member_run_history_persistence(route_team_with_members, agent_storage, memory):
178+
"""Test that all runs within a member's session are persisted in storage."""
179+
user_id = "[email protected]"
180+
session_id = "session_123"
181+
182+
# Clear memory for this specific test case
183+
memory.clear()
184+
185+
# First request
186+
await route_team_with_members.arun("I'm traveling to Tokyo, what is the weather and open restaurants?", user_id=user_id, session_id=session_id)
187+
188+
agent_session = agent_storage.read(session_id=session_id)
189+
190+
stored_memory_data = agent_session.memory
191+
assert stored_memory_data is not None, "Memory data not found in stored session."
192+
193+
agent_runs = stored_memory_data["runs"]
194+
195+
assert len(agent_runs[-1]["messages"]) == 7, "Only system message, user message, two tool calls (and results), and response"
196+
197+
first_user_message_content = agent_runs[0]["messages"][1]["content"]
198+
assert "I'm traveling to Tokyo, what is the weather and open restaurants?" in first_user_message_content
199+
200+
# Second request
201+
await route_team_with_members.arun("I'm traveling to Munich, what is the weather and open restaurants?", user_id=user_id, session_id=session_id)
202+
203+
agent_session = agent_storage.read(session_id=session_id)
204+
205+
stored_memory_data = agent_session.memory
206+
assert stored_memory_data is not None, "Memory data not found in stored session."
207+
208+
agent_runs = stored_memory_data["runs"]
209+
210+
assert len(agent_runs[-1]["messages"]) == 13, "Full history of messages"
211+
212+
# Third request (to the member directly)
213+
await route_team_with_members.members[0].arun("Write me a report about all the places I have requested information about", user_id=user_id, session_id=session_id)
214+
215+
agent_session = agent_storage.read(session_id=session_id)
216+
217+
stored_memory_data = agent_session.memory
218+
assert stored_memory_data is not None, "Memory data not found in stored session."
219+
220+
agent_runs = stored_memory_data["runs"]
221+
222+
assert len(agent_runs[-1]["messages"]) == 15, "Full history of messages"
223+
224+
225+
226+
145227
@pytest.mark.asyncio
146228
async def test_multi_user_multi_session_route_team(route_team, team_storage, memory):
147229
"""Test multi-user multi-session route team with storage and memory."""

0 commit comments

Comments
 (0)