agno 2.0.7__py3-none-any.whl → 2.0.9__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 +83 -51
- agno/db/base.py +14 -0
- agno/db/dynamo/dynamo.py +107 -27
- agno/db/firestore/firestore.py +109 -33
- agno/db/gcs_json/gcs_json_db.py +100 -20
- agno/db/in_memory/in_memory_db.py +95 -20
- agno/db/json/json_db.py +101 -21
- agno/db/migrations/v1_to_v2.py +322 -47
- agno/db/mongo/mongo.py +251 -26
- agno/db/mysql/mysql.py +307 -6
- agno/db/postgres/postgres.py +279 -33
- agno/db/redis/redis.py +99 -22
- agno/db/singlestore/singlestore.py +319 -38
- agno/db/sqlite/sqlite.py +339 -23
- agno/knowledge/embedder/sentence_transformer.py +3 -3
- agno/knowledge/knowledge.py +152 -31
- agno/knowledge/types.py +8 -0
- agno/models/anthropic/claude.py +0 -20
- agno/models/cometapi/__init__.py +5 -0
- agno/models/cometapi/cometapi.py +57 -0
- agno/models/google/gemini.py +4 -8
- agno/models/huggingface/huggingface.py +2 -1
- agno/models/ollama/chat.py +52 -3
- agno/models/openai/chat.py +9 -7
- agno/models/openai/responses.py +21 -17
- agno/os/interfaces/agui/agui.py +2 -2
- agno/os/interfaces/agui/utils.py +81 -18
- agno/os/interfaces/base.py +2 -0
- agno/os/interfaces/slack/router.py +50 -10
- agno/os/interfaces/slack/slack.py +6 -4
- agno/os/interfaces/whatsapp/router.py +7 -4
- agno/os/interfaces/whatsapp/whatsapp.py +2 -2
- agno/os/router.py +18 -0
- agno/os/utils.py +10 -2
- agno/reasoning/azure_ai_foundry.py +2 -2
- agno/reasoning/deepseek.py +2 -2
- agno/reasoning/default.py +3 -1
- agno/reasoning/groq.py +2 -2
- agno/reasoning/ollama.py +2 -2
- agno/reasoning/openai.py +2 -2
- agno/run/base.py +15 -2
- agno/session/agent.py +8 -5
- agno/session/team.py +14 -10
- agno/team/team.py +218 -111
- agno/tools/function.py +43 -4
- agno/tools/mcp.py +60 -37
- agno/tools/mcp_toolbox.py +284 -0
- agno/tools/scrapegraph.py +58 -31
- agno/tools/whatsapp.py +1 -1
- agno/utils/gemini.py +147 -19
- agno/utils/models/claude.py +9 -0
- agno/utils/print_response/agent.py +18 -2
- agno/utils/print_response/team.py +22 -6
- agno/utils/reasoning.py +22 -1
- agno/utils/string.py +9 -0
- agno/vectordb/base.py +2 -2
- agno/vectordb/langchaindb/langchaindb.py +5 -7
- agno/vectordb/llamaindex/llamaindexdb.py +25 -6
- agno/workflow/workflow.py +30 -15
- {agno-2.0.7.dist-info → agno-2.0.9.dist-info}/METADATA +4 -1
- {agno-2.0.7.dist-info → agno-2.0.9.dist-info}/RECORD +64 -61
- {agno-2.0.7.dist-info → agno-2.0.9.dist-info}/WHEEL +0 -0
- {agno-2.0.7.dist-info → agno-2.0.9.dist-info}/licenses/LICENSE +0 -0
- {agno-2.0.7.dist-info → agno-2.0.9.dist-info}/top_level.txt +0 -0
agno/db/json/json_db.py
CHANGED
|
@@ -113,7 +113,7 @@ class JsonDb(BaseDb):
|
|
|
113
113
|
|
|
114
114
|
except Exception as e:
|
|
115
115
|
log_error(f"Error writing to the {file_path} JSON file: {e}")
|
|
116
|
-
|
|
116
|
+
raise e
|
|
117
117
|
|
|
118
118
|
# -- Session methods --
|
|
119
119
|
|
|
@@ -145,7 +145,7 @@ class JsonDb(BaseDb):
|
|
|
145
145
|
|
|
146
146
|
except Exception as e:
|
|
147
147
|
log_error(f"Error deleting session: {e}")
|
|
148
|
-
|
|
148
|
+
raise e
|
|
149
149
|
|
|
150
150
|
def delete_sessions(self, session_ids: List[str]) -> None:
|
|
151
151
|
"""Delete multiple sessions from the JSON file.
|
|
@@ -164,6 +164,7 @@ class JsonDb(BaseDb):
|
|
|
164
164
|
|
|
165
165
|
except Exception as e:
|
|
166
166
|
log_error(f"Error deleting sessions: {e}")
|
|
167
|
+
raise e
|
|
167
168
|
|
|
168
169
|
def get_session(
|
|
169
170
|
self,
|
|
@@ -217,7 +218,7 @@ class JsonDb(BaseDb):
|
|
|
217
218
|
|
|
218
219
|
except Exception as e:
|
|
219
220
|
log_error(f"Exception reading from session file: {e}")
|
|
220
|
-
|
|
221
|
+
raise e
|
|
221
222
|
|
|
222
223
|
def get_sessions(
|
|
223
224
|
self,
|
|
@@ -312,7 +313,7 @@ class JsonDb(BaseDb):
|
|
|
312
313
|
|
|
313
314
|
except Exception as e:
|
|
314
315
|
log_error(f"Exception reading from session file: {e}")
|
|
315
|
-
|
|
316
|
+
raise e
|
|
316
317
|
|
|
317
318
|
def rename_session(
|
|
318
319
|
self, session_id: str, session_type: SessionType, session_name: str, deserialize: Optional[bool] = True
|
|
@@ -349,7 +350,7 @@ class JsonDb(BaseDb):
|
|
|
349
350
|
|
|
350
351
|
except Exception as e:
|
|
351
352
|
log_error(f"Exception renaming session: {e}")
|
|
352
|
-
|
|
353
|
+
raise e
|
|
353
354
|
|
|
354
355
|
def upsert_session(
|
|
355
356
|
self, session: Session, deserialize: Optional[bool] = True
|
|
@@ -394,7 +395,44 @@ class JsonDb(BaseDb):
|
|
|
394
395
|
|
|
395
396
|
except Exception as e:
|
|
396
397
|
log_error(f"Exception upserting session: {e}")
|
|
397
|
-
|
|
398
|
+
raise e
|
|
399
|
+
|
|
400
|
+
def upsert_sessions(
|
|
401
|
+
self, sessions: List[Session], deserialize: Optional[bool] = True
|
|
402
|
+
) -> List[Union[Session, Dict[str, Any]]]:
|
|
403
|
+
"""
|
|
404
|
+
Bulk upsert multiple sessions for improved performance on large datasets.
|
|
405
|
+
|
|
406
|
+
Args:
|
|
407
|
+
sessions (List[Session]): List of sessions to upsert.
|
|
408
|
+
deserialize (Optional[bool]): Whether to deserialize the sessions. Defaults to True.
|
|
409
|
+
|
|
410
|
+
Returns:
|
|
411
|
+
List[Union[Session, Dict[str, Any]]]: List of upserted sessions.
|
|
412
|
+
|
|
413
|
+
Raises:
|
|
414
|
+
Exception: If an error occurs during bulk upsert.
|
|
415
|
+
"""
|
|
416
|
+
if not sessions:
|
|
417
|
+
return []
|
|
418
|
+
|
|
419
|
+
try:
|
|
420
|
+
log_info(
|
|
421
|
+
f"JsonDb doesn't support efficient bulk operations, falling back to individual upserts for {len(sessions)} sessions"
|
|
422
|
+
)
|
|
423
|
+
|
|
424
|
+
# Fall back to individual upserts
|
|
425
|
+
results = []
|
|
426
|
+
for session in sessions:
|
|
427
|
+
if session is not None:
|
|
428
|
+
result = self.upsert_session(session, deserialize=deserialize)
|
|
429
|
+
if result is not None:
|
|
430
|
+
results.append(result)
|
|
431
|
+
return results
|
|
432
|
+
|
|
433
|
+
except Exception as e:
|
|
434
|
+
log_error(f"Exception during bulk session upsert: {e}")
|
|
435
|
+
return []
|
|
398
436
|
|
|
399
437
|
def _matches_session_key(self, existing_session: Dict[str, Any], session: Session) -> bool:
|
|
400
438
|
"""Check if existing session matches the key for the session type."""
|
|
@@ -422,6 +460,7 @@ class JsonDb(BaseDb):
|
|
|
422
460
|
|
|
423
461
|
except Exception as e:
|
|
424
462
|
log_error(f"Error deleting memory: {e}")
|
|
463
|
+
raise e
|
|
425
464
|
|
|
426
465
|
def delete_user_memories(self, memory_ids: List[str]) -> None:
|
|
427
466
|
"""Delete multiple user memories from the JSON file."""
|
|
@@ -434,6 +473,7 @@ class JsonDb(BaseDb):
|
|
|
434
473
|
|
|
435
474
|
except Exception as e:
|
|
436
475
|
log_error(f"Error deleting memories: {e}")
|
|
476
|
+
raise e
|
|
437
477
|
|
|
438
478
|
def get_all_memory_topics(self) -> List[str]:
|
|
439
479
|
"""Get all memory topics from the JSON file."""
|
|
@@ -449,7 +489,7 @@ class JsonDb(BaseDb):
|
|
|
449
489
|
|
|
450
490
|
except Exception as e:
|
|
451
491
|
log_error(f"Exception reading from memory file: {e}")
|
|
452
|
-
|
|
492
|
+
raise e
|
|
453
493
|
|
|
454
494
|
def get_user_memory(
|
|
455
495
|
self, memory_id: str, deserialize: Optional[bool] = True
|
|
@@ -468,7 +508,7 @@ class JsonDb(BaseDb):
|
|
|
468
508
|
|
|
469
509
|
except Exception as e:
|
|
470
510
|
log_error(f"Exception reading from memory file: {e}")
|
|
471
|
-
|
|
511
|
+
raise e
|
|
472
512
|
|
|
473
513
|
def get_user_memories(
|
|
474
514
|
self,
|
|
@@ -526,7 +566,7 @@ class JsonDb(BaseDb):
|
|
|
526
566
|
|
|
527
567
|
except Exception as e:
|
|
528
568
|
log_error(f"Exception reading from memory file: {e}")
|
|
529
|
-
|
|
569
|
+
raise e
|
|
530
570
|
|
|
531
571
|
def get_user_memory_stats(
|
|
532
572
|
self, limit: Optional[int] = None, page: Optional[int] = None
|
|
@@ -562,7 +602,7 @@ class JsonDb(BaseDb):
|
|
|
562
602
|
|
|
563
603
|
except Exception as e:
|
|
564
604
|
log_error(f"Exception getting user memory stats: {e}")
|
|
565
|
-
|
|
605
|
+
raise e
|
|
566
606
|
|
|
567
607
|
def upsert_user_memory(
|
|
568
608
|
self, memory: UserMemory, deserialize: Optional[bool] = True
|
|
@@ -596,7 +636,43 @@ class JsonDb(BaseDb):
|
|
|
596
636
|
|
|
597
637
|
except Exception as e:
|
|
598
638
|
log_warning(f"Exception upserting user memory: {e}")
|
|
599
|
-
|
|
639
|
+
raise e
|
|
640
|
+
|
|
641
|
+
def upsert_memories(
|
|
642
|
+
self, memories: List[UserMemory], deserialize: Optional[bool] = True
|
|
643
|
+
) -> List[Union[UserMemory, Dict[str, Any]]]:
|
|
644
|
+
"""
|
|
645
|
+
Bulk upsert multiple user memories for improved performance on large datasets.
|
|
646
|
+
|
|
647
|
+
Args:
|
|
648
|
+
memories (List[UserMemory]): List of memories to upsert.
|
|
649
|
+
deserialize (Optional[bool]): Whether to deserialize the memories. Defaults to True.
|
|
650
|
+
|
|
651
|
+
Returns:
|
|
652
|
+
List[Union[UserMemory, Dict[str, Any]]]: List of upserted memories.
|
|
653
|
+
|
|
654
|
+
Raises:
|
|
655
|
+
Exception: If an error occurs during bulk upsert.
|
|
656
|
+
"""
|
|
657
|
+
if not memories:
|
|
658
|
+
return []
|
|
659
|
+
|
|
660
|
+
try:
|
|
661
|
+
log_info(
|
|
662
|
+
f"JsonDb doesn't support efficient bulk operations, falling back to individual upserts for {len(memories)} memories"
|
|
663
|
+
)
|
|
664
|
+
# Fall back to individual upserts
|
|
665
|
+
results = []
|
|
666
|
+
for memory in memories:
|
|
667
|
+
if memory is not None:
|
|
668
|
+
result = self.upsert_user_memory(memory, deserialize=deserialize)
|
|
669
|
+
if result is not None:
|
|
670
|
+
results.append(result)
|
|
671
|
+
return results
|
|
672
|
+
|
|
673
|
+
except Exception as e:
|
|
674
|
+
log_error(f"Exception during bulk memory upsert: {e}")
|
|
675
|
+
return []
|
|
600
676
|
|
|
601
677
|
def clear_memories(self) -> None:
|
|
602
678
|
"""Delete all memories from the database.
|
|
@@ -610,6 +686,7 @@ class JsonDb(BaseDb):
|
|
|
610
686
|
|
|
611
687
|
except Exception as e:
|
|
612
688
|
log_warning(f"Exception deleting all memories: {e}")
|
|
689
|
+
raise e
|
|
613
690
|
|
|
614
691
|
# -- Metrics methods --
|
|
615
692
|
def calculate_metrics(self) -> Optional[list[dict]]:
|
|
@@ -678,7 +755,7 @@ class JsonDb(BaseDb):
|
|
|
678
755
|
|
|
679
756
|
except Exception as e:
|
|
680
757
|
log_warning(f"Exception refreshing metrics: {e}")
|
|
681
|
-
|
|
758
|
+
raise e
|
|
682
759
|
|
|
683
760
|
def _get_metrics_calculation_starting_date(self, metrics: List[Dict[str, Any]]) -> Optional[date]:
|
|
684
761
|
"""Get the first date for which metrics calculation is needed."""
|
|
@@ -733,7 +810,7 @@ class JsonDb(BaseDb):
|
|
|
733
810
|
|
|
734
811
|
except Exception as e:
|
|
735
812
|
log_error(f"Exception reading sessions for metrics: {e}")
|
|
736
|
-
|
|
813
|
+
raise e
|
|
737
814
|
|
|
738
815
|
def get_metrics(
|
|
739
816
|
self,
|
|
@@ -765,7 +842,7 @@ class JsonDb(BaseDb):
|
|
|
765
842
|
|
|
766
843
|
except Exception as e:
|
|
767
844
|
log_error(f"Exception getting metrics: {e}")
|
|
768
|
-
|
|
845
|
+
raise e
|
|
769
846
|
|
|
770
847
|
# -- Knowledge methods --
|
|
771
848
|
|
|
@@ -785,6 +862,7 @@ class JsonDb(BaseDb):
|
|
|
785
862
|
|
|
786
863
|
except Exception as e:
|
|
787
864
|
log_error(f"Error deleting knowledge content: {e}")
|
|
865
|
+
raise e
|
|
788
866
|
|
|
789
867
|
def get_knowledge_content(self, id: str) -> Optional[KnowledgeRow]:
|
|
790
868
|
"""Get a knowledge row from the database.
|
|
@@ -809,7 +887,7 @@ class JsonDb(BaseDb):
|
|
|
809
887
|
|
|
810
888
|
except Exception as e:
|
|
811
889
|
log_error(f"Error getting knowledge content: {e}")
|
|
812
|
-
|
|
890
|
+
raise e
|
|
813
891
|
|
|
814
892
|
def get_knowledge_contents(
|
|
815
893
|
self,
|
|
@@ -851,7 +929,7 @@ class JsonDb(BaseDb):
|
|
|
851
929
|
|
|
852
930
|
except Exception as e:
|
|
853
931
|
log_error(f"Error getting knowledge contents: {e}")
|
|
854
|
-
|
|
932
|
+
raise e
|
|
855
933
|
|
|
856
934
|
def upsert_knowledge_content(self, knowledge_row: KnowledgeRow):
|
|
857
935
|
"""Upsert knowledge content in the database.
|
|
@@ -886,7 +964,7 @@ class JsonDb(BaseDb):
|
|
|
886
964
|
|
|
887
965
|
except Exception as e:
|
|
888
966
|
log_error(f"Error upserting knowledge row: {e}")
|
|
889
|
-
|
|
967
|
+
raise e
|
|
890
968
|
|
|
891
969
|
# -- Eval methods --
|
|
892
970
|
|
|
@@ -909,7 +987,7 @@ class JsonDb(BaseDb):
|
|
|
909
987
|
|
|
910
988
|
except Exception as e:
|
|
911
989
|
log_error(f"Error creating eval run: {e}")
|
|
912
|
-
|
|
990
|
+
raise e
|
|
913
991
|
|
|
914
992
|
def delete_eval_run(self, eval_run_id: str) -> None:
|
|
915
993
|
"""Delete an eval run from the JSON file."""
|
|
@@ -926,6 +1004,7 @@ class JsonDb(BaseDb):
|
|
|
926
1004
|
|
|
927
1005
|
except Exception as e:
|
|
928
1006
|
log_error(f"Error deleting eval run {eval_run_id}: {e}")
|
|
1007
|
+
raise e
|
|
929
1008
|
|
|
930
1009
|
def delete_eval_runs(self, eval_run_ids: List[str]) -> None:
|
|
931
1010
|
"""Delete multiple eval runs from the JSON file."""
|
|
@@ -943,6 +1022,7 @@ class JsonDb(BaseDb):
|
|
|
943
1022
|
|
|
944
1023
|
except Exception as e:
|
|
945
1024
|
log_error(f"Error deleting eval runs {eval_run_ids}: {e}")
|
|
1025
|
+
raise e
|
|
946
1026
|
|
|
947
1027
|
def get_eval_run(
|
|
948
1028
|
self, eval_run_id: str, deserialize: Optional[bool] = True
|
|
@@ -961,7 +1041,7 @@ class JsonDb(BaseDb):
|
|
|
961
1041
|
|
|
962
1042
|
except Exception as e:
|
|
963
1043
|
log_error(f"Exception getting eval run {eval_run_id}: {e}")
|
|
964
|
-
|
|
1044
|
+
raise e
|
|
965
1045
|
|
|
966
1046
|
def get_eval_runs(
|
|
967
1047
|
self,
|
|
@@ -1027,7 +1107,7 @@ class JsonDb(BaseDb):
|
|
|
1027
1107
|
|
|
1028
1108
|
except Exception as e:
|
|
1029
1109
|
log_error(f"Exception getting eval runs: {e}")
|
|
1030
|
-
|
|
1110
|
+
raise e
|
|
1031
1111
|
|
|
1032
1112
|
def rename_eval_run(
|
|
1033
1113
|
self, eval_run_id: str, name: str, deserialize: Optional[bool] = True
|
|
@@ -1054,4 +1134,4 @@ class JsonDb(BaseDb):
|
|
|
1054
1134
|
|
|
1055
1135
|
except Exception as e:
|
|
1056
1136
|
log_error(f"Error renaming eval run {eval_run_id}: {e}")
|
|
1057
|
-
|
|
1137
|
+
raise e
|