From efa87784cc9ecc070a5f48caa55ff33ce292c6e9 Mon Sep 17 00:00:00 2001 From: Andreas Volkmann Date: Mon, 5 Aug 2024 11:07:19 -0700 Subject: [PATCH] Validate agent description, DRY metadata (#321) * Validate desc, DRY * Update python/src/agnext/core/_base_agent.py --------- Co-authored-by: Eric Zhu --- python/src/agnext/core/_base_agent.py | 2 ++ python/teams/team-one/readme.md | 2 +- python/teams/team-one/src/team_one/agents/orchestrator.py | 5 +++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/python/src/agnext/core/_base_agent.py b/python/src/agnext/core/_base_agent.py index 813a198cd..3b72e2dea 100644 --- a/python/src/agnext/core/_base_agent.py +++ b/python/src/agnext/core/_base_agent.py @@ -32,6 +32,8 @@ class BaseAgent(ABC, Agent): self._runtime: AgentRuntime = runtime self._id: AgentId = id + if not isinstance(description, str): + raise ValueError("Agent description must be a string") self._description = description self._subscriptions = subscriptions diff --git a/python/teams/team-one/readme.md b/python/teams/team-one/readme.md index ca3359c48..679d16826 100644 --- a/python/teams/team-one/readme.md +++ b/python/teams/team-one/readme.md @@ -9,7 +9,7 @@ Team-One is a generalist multi-agent softbot that utilizes a combination of five
drawing -
diff --git a/python/teams/team-one/src/team_one/agents/orchestrator.py b/python/teams/team-one/src/team_one/agents/orchestrator.py index 7ca1d25e6..02e8e11ec 100644 --- a/python/teams/team-one/src/team_one/agents/orchestrator.py +++ b/python/teams/team-one/src/team_one/agents/orchestrator.py @@ -82,8 +82,9 @@ class LedgerOrchestrator(BaseOrchestrator): async def _get_team_description(self) -> str: team_description = "" for agent in self._agents: - name = (await agent.metadata)["name"] - description = (await agent.metadata)["description"] + metadata = await agent.metadata + name = metadata["name"] + description = metadata["description"] team_description += f"{name}: {description}\n" return team_description