Skip to content

Commit 6b86d30

Browse files
authored
Fix list broken agents functionality in agent and team agent factories (#665)
1 parent 60b010c commit 6b86d30

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

aixplain/factories/agent_factory/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,11 @@ def list(cls) -> Dict:
503503
total = len(results)
504504
logging.info(f"Response for GET List Agents - Page Total: {page_total} / Total: {total}")
505505
for agent in results:
506-
agents.append(build_agent(agent))
506+
try:
507+
agents.append(build_agent(agent))
508+
except Exception:
509+
logging.warning(f"There was an error building the agent {agent['name']}. Skipping...")
510+
continue
507511
return {
508512
"results": agents,
509513
"page_total": page_total,

aixplain/factories/team_agent_factory/__init__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,12 @@ def list(cls) -> Dict:
323323
total = len(results)
324324
logging.info(f"Response for GET List Agents - Page Total: {page_total} / Total: {total}")
325325
for agent in results:
326-
agents.append(build_team_agent(agent))
326+
try:
327+
team_agent_ = build_team_agent(agent)
328+
agents.append(team_agent_)
329+
except Exception:
330+
logging.warning(f"There was an error building the team agent {agent['name']}. Skipping...")
331+
continue
327332
return {"results": agents, "page_total": page_total, "page_number": 0, "total": total}
328333
else:
329334
error_msg = "Agent Listing Error: Please contact the administrators."

0 commit comments

Comments
 (0)