Skip to content

armgit / laya

Public Imported from GitHub
0

Non-autoregressive System 1 decision engine. Typed choice, score and yes/no decisions over any text in a single forward pass, in 100+ languages, with a router that picks the right checkpoint per request.

fix(agno): align dependency range, team mode string, and docs semantics

VinayChaudhari1996f91abded6f38
diff --git a/docs/agno.md b/docs/agno.md
index 39c27f67..444231be 100644
--- a/docs/agno.md
+++ b/docs/agno.md
@@ -17,7 +17,7 @@ Supports both **local in-process inference** (`Agent` or `Router`) and **remote
pip install "laya[agno]"
```
-Requires **`agno>=1.0.0`** (the version that introduced `Team(members=..., mode=TeamMode.route)`).
+Requires **`agno>=1.1.14,<2`** (the release where Agno's dedicated `Team` class and `mode="route"` multi-agent routing were introduced).
---
@@ -28,7 +28,6 @@ In Agno multi-agent teams configured with `Team(mode="route")`, a leader LLM eva
```python
from agno.agent import Agent
from agno.team import Team
-from agno.team.mode import TeamMode
from laya.integrations.agno import LayaAgnoRouter
# Define specialized worker agents
@@ -62,13 +61,13 @@ query = "Write a Python function to reverse a linked list and handle edge cases.
decision = router.route(query, agents) # or equivalently: router.run(query, agents)
print(f"Routed to: {decision.name} (Role: {decision.role}, Confidence: {decision.confidence:.3f})")
-# Direct Agno Team helper — note: current Agno uses members=, not agents=:
-team = Team(members=agents, mode=TeamMode.route)
+# Direct Agno Team helper with mode="route":
+team = Team(members=agents, mode="route")
team_decision = router.route_team(query, team)
print(f"Team decision: {team_decision.name}")
```
-Both synchronous `route()` / `route_team()` and non-blocking asynchronous `aroute()` / `aroute_team()` are supported. You can also run the winning agent directly via `router.run(message, agents)` and `await router.arun(message, agents)`.
+Both synchronous `route()` / `route_team()` and non-blocking asynchronous `aroute()` / `aroute_team()` are supported. For API convention consistency with Agno, `router.run(message, agents)` and `await router.arun(message, agents)` are available as routing aliases returning the selected `AgnoRouteDecision` (they do not execute the winning agent directly).
---
diff --git a/laya/integrations/agno.py b/laya/integrations/agno.py
index bef9021e..1d121c6a 100644
--- a/laya/integrations/agno.py
+++ b/laya/integrations/agno.py
@@ -25,7 +25,7 @@ Typical usage::
# → Coder 0.94
# Or pass a Team directly:
- team = Team(agents=[researcher, writer, coder], mode="route")
+ team = Team(members=[researcher, writer, coder], mode="route")
decision = router.route_team("Summarise the latest IPCC report", team)
"""
from __future__ import annotations
@@ -64,8 +64,8 @@ except ImportError:
class AgnoTeam: # type: ignore[no-redef]
"""Lightweight shim when ``agno`` is not installed.
- Uses ``members`` to match the current Agno ``Team`` contract
- (``Team(members=[...], mode=TeamMode.route)``). The legacy field
+ Uses ``members`` to match the Agno ``Team`` contract
+ (``Team(members=[...], mode="route")``). The legacy field
name ``agents`` is accepted in :meth:`route_team` for compatibility
with older hand-crafted dicts or mocked objects.
"""
@@ -591,19 +591,19 @@ class LayaAgnoRouter:
) -> AgnoRouteDecision:
"""Convenience wrapper: route *message* using members from an ``AgnoTeam``.
- Reads ``team.members`` (the current Agno ``Team`` contract, ``agno>=1.0.0``)
+ Reads ``team.members`` (the Agno ``Team`` contract, ``agno>=1.1.14,<2``)
with a compat fallback to ``team.agents`` for hand-crafted mocks or test
objects using the old attribute name. Members may also be a callable factory
(Agno supports dynamic member lists); it is called with no arguments.
Args:
message: The message to route.
- team: An ``AgnoTeam`` instance (``Team(members=[...], mode=TeamMode.route)``).
+ team: An ``AgnoTeam`` instance (``Team(members=[...], mode="route")``).
Returns:
:class:`AgnoRouteDecision` with the selected agent and confidence.
"""
- # Primary: current Agno Team API (>=1.0.0) uses .members
+ # Primary: Agno Team API (>=1.1.14,<2) uses .members
members = getattr(team, "members", None)
if not members:
# Compat fallback for hand-crafted dicts / mocks using the old .agents attribute
@@ -620,8 +620,8 @@ class LayaAgnoRouter:
) -> AgnoRouteDecision:
"""Route *message* and return the selected :class:`AgnoRouteDecision`.
- Alias for :meth:`route`; provided so that ``LayaAgnoRouter`` follows
- the ``agent.run()`` calling convention used throughout Agno.
+ Alias for :meth:`route`; provided for API convention consistency with
+ Agno without executing the selected agent directly.
"""
return self.route(message, agents)
@@ -655,8 +655,8 @@ class LayaAgnoRouter:
) -> AgnoRouteDecision:
"""Asynchronously route *message* without blocking the event loop.
- Alias for :meth:`aroute`; provided to match Agno's ``agent.arun()``
- calling convention.
+ Alias for :meth:`aroute`; returns the selected :class:`AgnoRouteDecision`
+ without executing the selected agent directly.
"""
return await asyncio.to_thread(self.route, message, agents)
diff --git a/pyproject.toml b/pyproject.toml
index e59608a3..b2d58ce6 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -78,7 +78,7 @@ crewai = [
# `pip install laya[agno]` adds the Agno multi-agent team routing and guardrail integration (laya.integrations).
agno = [
- "agno>=1.0.0,<2",
+ "agno>=1.1.14,<2",
]
[project.scripts]
diff --git a/tests/test_agno.py b/tests/test_agno.py
index 87e10b6b..a5509078 100644
--- a/tests/test_agno.py
+++ b/tests/test_agno.py
@@ -192,7 +192,7 @@ check("router/name_2", dec2.name, "Coder")
dec1 = router.route("Draft a blog post about machine learning", agents)
check("router/agent_index_1", dec1.agent_index, 1)
-# route_team convenience method — current Agno API: members= (agno>=1.0.0)
+# route_team convenience method — Agno API: members=, mode="route" (agno>=1.1.14,<2)
team_obj = AgnoTeam(members=agents, mode="route")
dec_team = router.route_team("Find recent research papers on LLMs", team_obj)
check("router/route_team_index", dec_team.agent_index, 0)