agno 2.1.7__py3-none-any.whl → 2.1.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/workflow/step.py CHANGED
@@ -5,6 +5,7 @@ from typing import Any, AsyncIterator, Awaitable, Callable, Dict, Iterator, List
5
5
  from uuid import uuid4
6
6
 
7
7
  from pydantic import BaseModel
8
+ from typing_extensions import TypeGuard
8
9
 
9
10
  from agno.agent import Agent
10
11
  from agno.media import Audio, Image, Video
@@ -191,9 +192,8 @@ class Step:
191
192
  session_state: Optional[Dict[str, Any]] = None,
192
193
  ) -> Any:
193
194
  """Call custom async function with session_state support if the function accepts it"""
194
- import inspect
195
195
 
196
- if inspect.isasyncgenfunction(func):
196
+ if _is_async_generator_function(func):
197
197
  if session_state is not None and self._function_has_session_state_param():
198
198
  return func(step_input, session_state)
199
199
  else:
@@ -231,16 +231,16 @@ class Step:
231
231
  try:
232
232
  response: Union[RunOutput, TeamRunOutput, StepOutput]
233
233
  if self._executor_type == "function":
234
- if inspect.iscoroutinefunction(self.active_executor) or inspect.isasyncgenfunction(
235
- self.active_executor
236
- ):
234
+ if _is_async_callable(self.active_executor) or _is_async_generator_function(self.active_executor):
237
235
  raise ValueError("Cannot use async function with synchronous execution")
238
- if inspect.isgeneratorfunction(self.active_executor):
236
+ if _is_generator_function(self.active_executor):
239
237
  content = ""
240
238
  final_response = None
241
239
  try:
242
240
  for chunk in self._call_custom_function(
243
- self.active_executor, step_input, session_state_copy
241
+ self.active_executor,
242
+ step_input,
243
+ session_state_copy, # type: ignore[arg-type]
244
244
  ): # type: ignore
245
245
  if (
246
246
  hasattr(chunk, "content")
@@ -368,9 +368,7 @@ class Step:
368
368
  return False
369
369
 
370
370
  try:
371
- from inspect import signature
372
-
373
- sig = signature(self.active_executor) # type: ignore
371
+ sig = inspect.signature(self.active_executor) # type: ignore
374
372
  return "session_state" in sig.parameters
375
373
  except Exception:
376
374
  return False
@@ -449,12 +447,10 @@ class Step:
449
447
  if self._executor_type == "function":
450
448
  log_debug(f"Executing function executor for step: {self.name}")
451
449
 
452
- if inspect.iscoroutinefunction(self.active_executor) or inspect.isasyncgenfunction(
453
- self.active_executor
454
- ):
450
+ if _is_async_callable(self.active_executor) or _is_async_generator_function(self.active_executor):
455
451
  raise ValueError("Cannot use async function with synchronous execution")
456
452
 
457
- if inspect.isgeneratorfunction(self.active_executor):
453
+ if _is_generator_function(self.active_executor):
458
454
  log_debug("Function returned iterable, streaming events")
459
455
  content = ""
460
456
  try:
@@ -652,17 +648,17 @@ class Step:
652
648
  for attempt in range(self.max_retries + 1):
653
649
  try:
654
650
  if self._executor_type == "function":
655
- import inspect
656
-
657
- if inspect.isgeneratorfunction(self.active_executor) or inspect.isasyncgenfunction(
651
+ if _is_generator_function(self.active_executor) or _is_async_generator_function(
658
652
  self.active_executor
659
653
  ):
660
654
  content = ""
661
655
  final_response = None
662
656
  try:
663
- if inspect.isgeneratorfunction(self.active_executor):
657
+ if _is_generator_function(self.active_executor):
664
658
  iterator = self._call_custom_function(
665
- self.active_executor, step_input, session_state_copy
659
+ self.active_executor,
660
+ step_input,
661
+ session_state_copy, # type: ignore[arg-type]
666
662
  ) # type: ignore
667
663
  for chunk in iterator: # type: ignore
668
664
  if (
@@ -676,9 +672,11 @@ class Step:
676
672
  if isinstance(chunk, StepOutput):
677
673
  final_response = chunk
678
674
  else:
679
- if inspect.isasyncgenfunction(self.active_executor):
675
+ if _is_async_generator_function(self.active_executor):
680
676
  iterator = await self._acall_custom_function(
681
- self.active_executor, step_input, session_state_copy
677
+ self.active_executor,
678
+ step_input,
679
+ session_state_copy, # type: ignore[arg-type]
682
680
  ) # type: ignore
683
681
  async for chunk in iterator: # type: ignore
684
682
  if (
@@ -705,7 +703,7 @@ class Step:
705
703
  else:
706
704
  response = StepOutput(content=content)
707
705
  else:
708
- if inspect.iscoroutinefunction(self.active_executor):
706
+ if _is_async_callable(self.active_executor):
709
707
  result = await self._acall_custom_function(
710
708
  self.active_executor, step_input, session_state_copy
711
709
  ) # type: ignore
@@ -854,14 +852,15 @@ class Step:
854
852
 
855
853
  if self._executor_type == "function":
856
854
  log_debug(f"Executing async function executor for step: {self.name}")
857
- import inspect
858
855
 
859
856
  # Check if the function is an async generator
860
- if inspect.isasyncgenfunction(self.active_executor):
857
+ if _is_async_generator_function(self.active_executor):
861
858
  content = ""
862
859
  # It's an async generator - iterate over it
863
860
  iterator = await self._acall_custom_function(
864
- self.active_executor, step_input, session_state_copy
861
+ self.active_executor,
862
+ step_input,
863
+ session_state_copy, # type: ignore[arg-type]
865
864
  ) # type: ignore
866
865
  async for event in iterator: # type: ignore
867
866
  if (
@@ -885,14 +884,14 @@ class Step:
885
884
  yield enriched_event # type: ignore[misc]
886
885
  if not final_response:
887
886
  final_response = StepOutput(content=content)
888
- elif inspect.iscoroutinefunction(self.active_executor):
887
+ elif _is_async_callable(self.active_executor):
889
888
  # It's a regular async function - await it
890
889
  result = await self._acall_custom_function(self.active_executor, step_input, session_state_copy) # type: ignore
891
890
  if isinstance(result, StepOutput):
892
891
  final_response = result
893
892
  else:
894
893
  final_response = StepOutput(content=str(result))
895
- elif inspect.isgeneratorfunction(self.active_executor):
894
+ elif _is_generator_function(self.active_executor):
896
895
  content = ""
897
896
  # It's a regular generator function - iterate over it
898
897
  iterator = self._call_custom_function(self.active_executor, step_input, session_state_copy) # type: ignore
@@ -1252,3 +1251,28 @@ class Step:
1252
1251
  continue
1253
1252
 
1254
1253
  return videos
1254
+
1255
+
1256
+ def _is_async_callable(obj: Any) -> TypeGuard[Callable[..., Any]]:
1257
+ """Checks if obj is an async callable (coroutine function or callable with async __call__)"""
1258
+ return inspect.iscoroutinefunction(obj) or (callable(obj) and inspect.iscoroutinefunction(obj.__call__))
1259
+
1260
+
1261
+ def _is_generator_function(obj: Any) -> TypeGuard[Callable[..., Any]]:
1262
+ """Checks if obj is a generator function, including callable class instances with generator __call__ methods"""
1263
+ if inspect.isgeneratorfunction(obj):
1264
+ return True
1265
+ # Check if it's a callable class instance with a generator __call__ method
1266
+ if callable(obj) and hasattr(obj, "__call__"):
1267
+ return inspect.isgeneratorfunction(obj.__call__)
1268
+ return False
1269
+
1270
+
1271
+ def _is_async_generator_function(obj: Any) -> TypeGuard[Callable[..., Any]]:
1272
+ """Checks if obj is an async generator function, including callable class instances"""
1273
+ if inspect.isasyncgenfunction(obj):
1274
+ return True
1275
+ # Check if it's a callable class instance with an async generator __call__ method
1276
+ if callable(obj) and hasattr(obj, "__call__"):
1277
+ return inspect.isasyncgenfunction(obj.__call__)
1278
+ return False
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: agno
3
- Version: 2.1.7
3
+ Version: 2.1.9
4
4
  Summary: Agno: a lightweight library for building Multi-Agent Systems
5
5
  Author-email: Ashpreet Bedi <ashpreet@agno.com>
6
6
  Project-URL: homepage, https://agno.com
@@ -4,7 +4,7 @@ agno/exceptions.py,sha256=7xqLur8sWHugnViIJz4PvPKSHljSiVKNAqaKQOJgZiU,4982
4
4
  agno/media.py,sha256=eTfYb_pwhX_PCIVPSrW4VYRqmoxKABEF1aZClrVvQ30,16500
5
5
  agno/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  agno/agent/__init__.py,sha256=s7S3FgsjZxuaabzi8L5n4aSH8IZAiZ7XaNNcySGR-EQ,1051
7
- agno/agent/agent.py,sha256=SWsIFkDNdNEHynJu5MepO2gqlJnh_yFDN1tn7DT-TgI,403708
7
+ agno/agent/agent.py,sha256=njNPl3_M1_prsIiByfq5IYh_h9jYDTl1AZF76h0fDkc,409672
8
8
  agno/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  agno/api/agent.py,sha256=fKlQ62E_C9Rjd7Zus3Gs3R1RG-IhzFV-ICpkb6SLqYc,932
10
10
  agno/api/api.py,sha256=Z7iWbrjheJcGLeeDYrtTCWiKTVqjH0uJI35UNWOtAXw,973
@@ -103,7 +103,7 @@ agno/integrations/discord/__init__.py,sha256=MS08QSnegGgpDZd9LyLjK4pWIk9dXlbzgD7
103
103
  agno/integrations/discord/client.py,sha256=2IWkA-kCDsDXByKOGq2QJG6MtFsbouzNN105rsXn95A,8375
104
104
  agno/knowledge/__init__.py,sha256=PJCt-AGKGFztzR--Ok2TNKW5QEqllZzqiI_7f8-1u80,79
105
105
  agno/knowledge/content.py,sha256=q2bjcjDhfge_UrQAcygrv5R9ZTk7vozzKnQpatDQWRo,2295
106
- agno/knowledge/knowledge.py,sha256=LnBQ-feIaaHwusgBMGWvXzj4_hiZBCg-ZglfkBYE6nA,77963
106
+ agno/knowledge/knowledge.py,sha256=P3-aEys4nYbLWs-vCoMQ1vf5A3s6wiKNp4yqscH-wGg,78103
107
107
  agno/knowledge/types.py,sha256=ciwDLK9MXwi_W_g4nUChEmK6meDQyqTqGK2Ad-wM1os,754
108
108
  agno/knowledge/utils.py,sha256=_uhEFtz4p7-cIKffdj5UZ__c-u96rs2UWP6dv5HpOMk,6490
109
109
  agno/knowledge/chunking/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -164,7 +164,7 @@ agno/memory/manager.py,sha256=qQYnrCWCA2P_z_sKR1_sJ5kGgtCL2WnpLRSyAL5unfU,51717
164
164
  agno/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
165
165
  agno/models/base.py,sha256=bjP0Xt5-Jlk1I_7wHmuv8lhUPE75WzZ_iF3U-d81TUI,85214
166
166
  agno/models/defaults.py,sha256=1_fe4-ZbNriE8BgqxVRVi4KGzEYxYKYsz4hn6CZNEEM,40
167
- agno/models/message.py,sha256=yHiNMsgadNEjAYAvtSJgktwsXqlRYC8N_DRShCzjYtc,18914
167
+ agno/models/message.py,sha256=iA9JSlm0KVEX6mCLOfsspoOIdbxREL3qlnN2RycaqZM,19024
168
168
  agno/models/metrics.py,sha256=81IILXZwGmOTiWK003bi5mg4bM1f4LCWbwyamjFzp18,4500
169
169
  agno/models/response.py,sha256=UIuqTBVfXOpxlpf8wOzc6wIrb0vR0FFO6JIkASaPfOQ,4213
170
170
  agno/models/utils.py,sha256=PprNlVI8d8loHayjRsrc4TL38sfkFMS3EVZcF5cLXoA,669
@@ -257,7 +257,7 @@ agno/os/auth.py,sha256=FyBtAKWtg-qSunCas5m5pK1dVEmikOSZvcCp5r25tTA,1844
257
257
  agno/os/config.py,sha256=u4R9yazQXIcKjR3QzEIZw_XAe_OHp3xn0ff7SVkj2jA,2893
258
258
  agno/os/mcp.py,sha256=vJhjjSm1KC61HLoxPj24lSrjkjo7plkoFfcQX2BmTp0,10253
259
259
  agno/os/router.py,sha256=eRxyRX9FjgxtaYwrtNCJLiWH2m6gx6L5zYCff1Gv1ew,71106
260
- agno/os/schema.py,sha256=Jlm-vM79iyj-cytWkyKFC4BN4kQV-IaiDqTujvdRzEk,39895
260
+ agno/os/schema.py,sha256=3krwIyU8dZhKKuf-oe4a-Zub4MBQqwnxeFCzJzKHDxU,39883
261
261
  agno/os/settings.py,sha256=Cn5_8lZI8Vx1UaUYqs9h6Qp4IMDFn4f3c35uppiaMy4,1343
262
262
  agno/os/utils.py,sha256=V6PqoPaUbj1O6O2_vvLZAmKalInh5_Nn3twdYxF5XB0,19996
263
263
  agno/os/interfaces/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
@@ -288,7 +288,7 @@ agno/os/routers/evals/evals.py,sha256=oA6KpeIjlclMAXn1XkpJ147SvJZxr3AhsX__5fl9dX
288
288
  agno/os/routers/evals/schemas.py,sha256=3Ebm3IrpX22Hg3ZatMRkozgS4TfnMki4_UbqCNtQvJ4,4800
289
289
  agno/os/routers/evals/utils.py,sha256=Zi5f2hWqcDrcZ3f3MfC1Sx9_NUYz7rzIt8D-FrluwhM,5538
290
290
  agno/os/routers/knowledge/__init__.py,sha256=ZSqMQ8X7C_oYn8xt7NaYlriarWUpHgaWDyHXOWooMaU,105
291
- agno/os/routers/knowledge/knowledge.py,sha256=9MaMzPjSlsRioms9_J_Nso1hkAMMfx0h6Yql4cPUMZY,43841
291
+ agno/os/routers/knowledge/knowledge.py,sha256=Hq6nIjmzygAZ6uT340ttot7Rilkfnedt7PbpuVjiDrg,43849
292
292
  agno/os/routers/knowledge/schemas.py,sha256=T8bbzi6dbUxNUT8_oStSfOua6I7c9AGh4qy6TTP4oPI,6694
293
293
  agno/os/routers/memory/__init__.py,sha256=9hrYFc1dkbsLBqKfqyfioQeLX9TTbLrJx6lWDKNNWbc,93
294
294
  agno/os/routers/memory/memory.py,sha256=1by03MSaE0ysd4DaUVHxAs3lslL4gql9_HSFfMoJmiQ,20432
@@ -323,7 +323,7 @@ agno/session/summary.py,sha256=THBbzE48V81p4dKUX2W8OvbpsNO5dI6BdtqDyjfcVqw,8433
323
323
  agno/session/team.py,sha256=0lS-9ljtG17iyC0n8sq_7aEy9MZsdfMf8VgObqJ_3tg,10384
324
324
  agno/session/workflow.py,sha256=tluE_3ERMBYJtffpwlrhdETWlzJk6Xw2x06FZ1Y3fXg,7397
325
325
  agno/team/__init__.py,sha256=toHidBOo5M3n_TIVtIKHgcDbLL9HR-_U-YQYuIt_XtE,847
326
- agno/team/team.py,sha256=FmfhlU_lxVUX4nvqg_tleColZwxTgHuf3DcLc044dTY,374460
326
+ agno/team/team.py,sha256=rKDA0R5EfIk1BSe8BX9mkxJ4ck4RDT7gfju2DQQeVzU,377672
327
327
  agno/tools/__init__.py,sha256=jNll2sELhPPbqm5nPeT4_uyzRO2_KRTW-8Or60kioS0,210
328
328
  agno/tools/agentql.py,sha256=S82Z9aTNr-E5wnA4fbFs76COljJtiQIjf2grjz3CkHU,4104
329
329
  agno/tools/airflow.py,sha256=uf2rOzZpSU64l_qRJ5Raku-R3Gky-uewmYkh6W0-oxg,2610
@@ -370,12 +370,12 @@ agno/tools/gmail.py,sha256=MlLlEvxHly_2oKAZaKxXDmoHLTbWDSXcjOASGt7RpY8,28067
370
370
  agno/tools/google_bigquery.py,sha256=j0c14CgGK8KvD7eEirsdAx7RSwcfMheugn84ySq6miU,4483
371
371
  agno/tools/google_drive.py,sha256=dxGr_NhMsqFsr_tR3w4MgLXm7_nlCTI43sCmKw60N_4,11159
372
372
  agno/tools/google_maps.py,sha256=AqPEIt4u6B2kQtzOnL5PH3RXoefCfjT_Uvm3coAqzaY,9513
373
- agno/tools/googlecalendar.py,sha256=s8BPKvDZGeLD2idlQG-vqDqVpza6PupF5AzAElnAK_M,27457
373
+ agno/tools/googlecalendar.py,sha256=4WxmPIaxxsxAYP56XT7ehnmKEwicn9w_KOe8LMy5KB0,28670
374
374
  agno/tools/googlesearch.py,sha256=xRuaEqn7N6JIQC6z9jFuA0Kdtoe5MafGqRMtZ8jW2AQ,3566
375
375
  agno/tools/googlesheets.py,sha256=m8K0A8I5d68HG19OajDLCgGJzXnsnh33OQQOc6K5Qbg,15704
376
376
  agno/tools/hackernews.py,sha256=h5w-L5FkGGMAHr6Jjez6164-UYZ_2r2qFAzwMrKLdRM,2776
377
377
  agno/tools/jina.py,sha256=xa0yxcxsSZ1-BzxO3PJKNWnWrv64DxbpvRHTPFXWhC4,4036
378
- agno/tools/jira.py,sha256=O8oBtAXGTzlLSjNHNs290B8Bo0nrJ45NRYzsR1KupNk,5907
378
+ agno/tools/jira.py,sha256=d7ey4gk4Fd1QH9FH5QOtkvLqoulcyIeaR83KQPhGELc,7006
379
379
  agno/tools/knowledge.py,sha256=N-dxHNWTGn0o30chuDYFK9BAPLFeMsQYLLSEWEuu40I,10876
380
380
  agno/tools/linear.py,sha256=yA3Yci-Dnid0rZPeXds4aZY8hL7KjloZkES9thKEPe8,13775
381
381
  agno/tools/linkup.py,sha256=EzX4_ARW96DkFe1IXAFlPQI5rdhhdhmNTX1tB5IVFWs,2123
@@ -544,16 +544,16 @@ agno/vectordb/weaviate/__init__.py,sha256=FIoFJgqSmGuFgpvmsg8EjAn8FDAhuqAXed7fja
544
544
  agno/vectordb/weaviate/index.py,sha256=y4XYPRZFksMfrrF85B4hn5AtmXM4SH--4CyLo27EHgM,253
545
545
  agno/vectordb/weaviate/weaviate.py,sha256=8KNa5a-RuksE6w9poD4vi_ixUBeoB96PkzCL9DHSs5o,39406
546
546
  agno/workflow/__init__.py,sha256=lwavZXIkgqajbSf1jMqzE7kbXBIFmk5niI_NgpVI-gA,542
547
- agno/workflow/condition.py,sha256=MgJnHRPEJ2qCjUkcHKyZfOuAn-C38ZTgVcYjY8iTgrI,30122
547
+ agno/workflow/condition.py,sha256=9nnwzaf4SiaMKgSIbZ_mekP6ndx3daAas3vNyyUyclE,31327
548
548
  agno/workflow/loop.py,sha256=q2XssC179htRC7KPiebUcvr0lKexfZUB9aUO4D3tOrk,32305
549
549
  agno/workflow/parallel.py,sha256=Gb6XZbwDJgmBBbuiZTFHvphQqrsMVgM-HTOMoiIHweg,34843
550
- agno/workflow/router.py,sha256=-gPT43a1mP0tnE6wQa4tEAuGWNppel8DbmCg0ajo-L0,28295
551
- agno/workflow/step.py,sha256=phA5pfhDR_0rie-85WUoM8toGO7tVfP4nzfqOjGBrxI,58931
550
+ agno/workflow/router.py,sha256=Z1hzzbLL7ZgJD2UuIP7p2Ubt0QWYMF2rX6pOapVIw7c,29461
551
+ agno/workflow/step.py,sha256=2vBv97QoDLtFJnWAueDLLbzWvB3dxPd5Cl_dwqdl5Ew,60251
552
552
  agno/workflow/steps.py,sha256=1qOcH0SuPTPE0Ac3sRyRLjFoMcKyTo44hlJXdbOBNnM,25389
553
553
  agno/workflow/types.py,sha256=DutB4UkEppJoWRiNaGEnPk6xFNpg0oCBwOb7VJ8T_xE,18646
554
554
  agno/workflow/workflow.py,sha256=AD2mKXap840IwPb2WMnVJM30lQLAFUfWxd7nqQJ52hU,137906
555
- agno-2.1.7.dist-info/licenses/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
556
- agno-2.1.7.dist-info/METADATA,sha256=OonkoslVUtmU9tnHO97TR5XKm56MVKH9jO9C-BSSmJc,24504
557
- agno-2.1.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
558
- agno-2.1.7.dist-info/top_level.txt,sha256=MKyeuVesTyOKIXUhc-d_tPa2Hrh0oTA4LM0izowpx70,5
559
- agno-2.1.7.dist-info/RECORD,,
555
+ agno-2.1.9.dist-info/licenses/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
556
+ agno-2.1.9.dist-info/METADATA,sha256=wLm7Y7A7d_h_hzSZJPY0qPFjvjelASmRCwl7moipnb0,24504
557
+ agno-2.1.9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
558
+ agno-2.1.9.dist-info/top_level.txt,sha256=MKyeuVesTyOKIXUhc-d_tPa2Hrh0oTA4LM0izowpx70,5
559
+ agno-2.1.9.dist-info/RECORD,,
File without changes