agno 2.2.2__py3-none-any.whl → 2.2.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- agno/agent/agent.py +26 -5
- agno/db/dynamo/utils.py +1 -1
- agno/db/firestore/utils.py +1 -1
- agno/db/gcs_json/utils.py +1 -1
- agno/db/in_memory/utils.py +1 -1
- agno/db/json/utils.py +1 -1
- agno/db/mongo/__init__.py +15 -1
- agno/db/mongo/async_mongo.py +1999 -0
- agno/db/mongo/utils.py +1 -1
- agno/db/mysql/utils.py +1 -1
- agno/db/postgres/async_postgres.py +8 -3
- agno/db/postgres/utils.py +1 -1
- agno/db/redis/utils.py +1 -1
- agno/db/singlestore/utils.py +1 -1
- agno/db/sqlite/utils.py +1 -1
- agno/knowledge/embedder/ollama.py +8 -0
- agno/memory/manager.py +5 -5
- agno/os/app.py +105 -42
- agno/os/schema.py +0 -1
- agno/run/agent.py +27 -0
- agno/run/team.py +27 -0
- agno/session/agent.py +57 -17
- agno/session/team.py +57 -18
- agno/team/team.py +37 -11
- {agno-2.2.2.dist-info → agno-2.2.4.dist-info}/METADATA +1 -1
- {agno-2.2.2.dist-info → agno-2.2.4.dist-info}/RECORD +29 -28
- {agno-2.2.2.dist-info → agno-2.2.4.dist-info}/WHEEL +0 -0
- {agno-2.2.2.dist-info → agno-2.2.4.dist-info}/licenses/LICENSE +0 -0
- {agno-2.2.2.dist-info → agno-2.2.4.dist-info}/top_level.txt +0 -0
agno/agent/agent.py
CHANGED
|
@@ -220,7 +220,9 @@ class Agent:
|
|
|
220
220
|
# add_history_to_context=true adds messages from the chat history to the messages list sent to the Model.
|
|
221
221
|
add_history_to_context: bool = False
|
|
222
222
|
# Number of historical runs to include in the messages
|
|
223
|
-
num_history_runs: int =
|
|
223
|
+
num_history_runs: Optional[int] = None
|
|
224
|
+
# Number of historical messages to include in the messages list sent to the Model.
|
|
225
|
+
num_history_messages: Optional[int] = None
|
|
224
226
|
# Maximum number of tool calls to include from history (None = no limit)
|
|
225
227
|
max_tool_calls_from_history: Optional[int] = None
|
|
226
228
|
|
|
@@ -438,7 +440,8 @@ class Agent:
|
|
|
438
440
|
add_session_summary_to_context: Optional[bool] = None,
|
|
439
441
|
session_summary_manager: Optional[SessionSummaryManager] = None,
|
|
440
442
|
add_history_to_context: bool = False,
|
|
441
|
-
num_history_runs: int =
|
|
443
|
+
num_history_runs: Optional[int] = None,
|
|
444
|
+
num_history_messages: Optional[int] = None,
|
|
442
445
|
max_tool_calls_from_history: Optional[int] = None,
|
|
443
446
|
store_media: bool = True,
|
|
444
447
|
store_tool_messages: bool = True,
|
|
@@ -541,6 +544,15 @@ class Agent:
|
|
|
541
544
|
|
|
542
545
|
self.add_history_to_context = add_history_to_context
|
|
543
546
|
self.num_history_runs = num_history_runs
|
|
547
|
+
self.num_history_messages = num_history_messages
|
|
548
|
+
if self.num_history_messages is not None and self.num_history_runs is not None:
|
|
549
|
+
log_warning(
|
|
550
|
+
"num_history_messages and num_history_runs cannot be set at the same time. Using num_history_runs."
|
|
551
|
+
)
|
|
552
|
+
self.num_history_messages = None
|
|
553
|
+
if self.num_history_messages is None and self.num_history_runs is None:
|
|
554
|
+
self.num_history_runs = 3
|
|
555
|
+
|
|
544
556
|
self.max_tool_calls_from_history = max_tool_calls_from_history
|
|
545
557
|
|
|
546
558
|
self.store_media = store_media
|
|
@@ -5133,7 +5145,7 @@ class Agent:
|
|
|
5133
5145
|
run_messages.user_message.get_content_string() if run_messages.user_message is not None else None
|
|
5134
5146
|
)
|
|
5135
5147
|
if user_message_str is not None and user_message_str.strip() != "" and self.memory_manager is not None:
|
|
5136
|
-
log_debug("
|
|
5148
|
+
log_debug("Managing user memories")
|
|
5137
5149
|
self.memory_manager.create_user_memories( # type: ignore
|
|
5138
5150
|
message=user_message_str,
|
|
5139
5151
|
user_id=user_id,
|
|
@@ -5174,7 +5186,7 @@ class Agent:
|
|
|
5174
5186
|
run_messages.user_message.get_content_string() if run_messages.user_message is not None else None
|
|
5175
5187
|
)
|
|
5176
5188
|
if user_message_str is not None and user_message_str.strip() != "" and self.memory_manager is not None:
|
|
5177
|
-
log_debug("
|
|
5189
|
+
log_debug("Managing user memories")
|
|
5178
5190
|
await self.memory_manager.acreate_user_memories( # type: ignore
|
|
5179
5191
|
message=user_message_str,
|
|
5180
5192
|
user_id=user_id,
|
|
@@ -7461,6 +7473,7 @@ class Agent:
|
|
|
7461
7473
|
|
|
7462
7474
|
history: List[Message] = session.get_messages_from_last_n_runs(
|
|
7463
7475
|
last_n=self.num_history_runs,
|
|
7476
|
+
last_n_messages=self.num_history_messages,
|
|
7464
7477
|
skip_role=skip_role,
|
|
7465
7478
|
agent_id=self.id if self.team_id is not None else None,
|
|
7466
7479
|
)
|
|
@@ -7658,9 +7671,17 @@ class Agent:
|
|
|
7658
7671
|
if add_history_to_context:
|
|
7659
7672
|
from copy import deepcopy
|
|
7660
7673
|
|
|
7674
|
+
# Only skip messages from history when system_message_role is NOT a standard conversation role.
|
|
7675
|
+
# Standard conversation roles ("user", "assistant", "tool") should never be filtered
|
|
7676
|
+
# to preserve conversation continuity.
|
|
7677
|
+
skip_role = (
|
|
7678
|
+
self.system_message_role if self.system_message_role not in ["user", "assistant", "tool"] else None
|
|
7679
|
+
)
|
|
7680
|
+
|
|
7661
7681
|
history: List[Message] = session.get_messages_from_last_n_runs(
|
|
7662
7682
|
last_n=self.num_history_runs,
|
|
7663
|
-
|
|
7683
|
+
last_n_messages=self.num_history_messages,
|
|
7684
|
+
skip_role=skip_role,
|
|
7664
7685
|
agent_id=self.id if self.team_id is not None else None,
|
|
7665
7686
|
)
|
|
7666
7687
|
|
agno/db/dynamo/utils.py
CHANGED
|
@@ -361,7 +361,7 @@ def calculate_date_metrics(date_to_process: date, sessions_data: dict) -> dict:
|
|
|
361
361
|
token_metrics[field] += session_metrics.get(field, 0)
|
|
362
362
|
model_metrics = []
|
|
363
363
|
for model, count in model_counts.items():
|
|
364
|
-
model_id, model_provider = model.
|
|
364
|
+
model_id, model_provider = model.rsplit(":", 1)
|
|
365
365
|
model_metrics.append({"model_id": model_id, "model_provider": model_provider, "count": count})
|
|
366
366
|
metrics["users_count"] = len(all_user_ids)
|
|
367
367
|
current_time = int(time.time())
|
agno/db/firestore/utils.py
CHANGED
|
@@ -224,7 +224,7 @@ def calculate_date_metrics(date_to_process: date, sessions_data: dict) -> dict:
|
|
|
224
224
|
|
|
225
225
|
model_metrics = []
|
|
226
226
|
for model, count in model_counts.items():
|
|
227
|
-
model_id, model_provider = model.
|
|
227
|
+
model_id, model_provider = model.rsplit(":", 1)
|
|
228
228
|
model_metrics.append({"model_id": model_id, "model_provider": model_provider, "count": count})
|
|
229
229
|
|
|
230
230
|
metrics["users_count"] = len(all_user_ids)
|
agno/db/gcs_json/utils.py
CHANGED
|
@@ -99,7 +99,7 @@ def calculate_date_metrics(date_to_process: date, sessions_data: dict) -> dict:
|
|
|
99
99
|
|
|
100
100
|
model_metrics = []
|
|
101
101
|
for model, count in model_counts.items():
|
|
102
|
-
model_id, model_provider = model.
|
|
102
|
+
model_id, model_provider = model.rsplit(":", 1)
|
|
103
103
|
model_metrics.append({"model_id": model_id, "model_provider": model_provider, "count": count})
|
|
104
104
|
|
|
105
105
|
metrics["users_count"] = len(all_user_ids)
|
agno/db/in_memory/utils.py
CHANGED
|
@@ -99,7 +99,7 @@ def calculate_date_metrics(date_to_process: date, sessions_data: dict) -> dict:
|
|
|
99
99
|
|
|
100
100
|
model_metrics = []
|
|
101
101
|
for model, count in model_counts.items():
|
|
102
|
-
model_id, model_provider = model.
|
|
102
|
+
model_id, model_provider = model.rsplit(":", 1)
|
|
103
103
|
model_metrics.append({"model_id": model_id, "model_provider": model_provider, "count": count})
|
|
104
104
|
|
|
105
105
|
metrics["users_count"] = len(all_user_ids)
|
agno/db/json/utils.py
CHANGED
|
@@ -99,7 +99,7 @@ def calculate_date_metrics(date_to_process: date, sessions_data: dict) -> dict:
|
|
|
99
99
|
|
|
100
100
|
model_metrics = []
|
|
101
101
|
for model, count in model_counts.items():
|
|
102
|
-
model_id, model_provider = model.
|
|
102
|
+
model_id, model_provider = model.rsplit(":", 1)
|
|
103
103
|
model_metrics.append({"model_id": model_id, "model_provider": model_provider, "count": count})
|
|
104
104
|
|
|
105
105
|
metrics["users_count"] = len(all_user_ids)
|
agno/db/mongo/__init__.py
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
from typing import TYPE_CHECKING
|
|
2
|
+
|
|
1
3
|
from agno.db.mongo.mongo import MongoDb
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
if TYPE_CHECKING:
|
|
6
|
+
from agno.db.mongo.async_mongo import AsyncMongoDb
|
|
7
|
+
|
|
8
|
+
__all__ = ["AsyncMongoDb", "MongoDb"]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def __getattr__(name: str):
|
|
12
|
+
"""Lazy import AsyncMongoDb only when accessed."""
|
|
13
|
+
if name == "AsyncMongoDb":
|
|
14
|
+
from agno.db.mongo.async_mongo import AsyncMongoDb
|
|
15
|
+
|
|
16
|
+
return AsyncMongoDb
|
|
17
|
+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|