diff --git a/aixplain/factories/agent_factory/__init__.py b/aixplain/factories/agent_factory/__init__.py index a23eb529..44251338 100644 --- a/aixplain/factories/agent_factory/__init__.py +++ b/aixplain/factories/agent_factory/__init__.py @@ -503,7 +503,11 @@ def list(cls) -> Dict: total = len(results) logging.info(f"Response for GET List Agents - Page Total: {page_total} / Total: {total}") for agent in results: - agents.append(build_agent(agent)) + try: + agents.append(build_agent(agent)) + except Exception: + logging.warning(f"There was an error building the agent {agent['name']}. Skipping...") + continue return { "results": agents, "page_total": page_total, diff --git a/aixplain/factories/team_agent_factory/__init__.py b/aixplain/factories/team_agent_factory/__init__.py index da1ea6f5..b14542d6 100644 --- a/aixplain/factories/team_agent_factory/__init__.py +++ b/aixplain/factories/team_agent_factory/__init__.py @@ -323,7 +323,12 @@ def list(cls) -> Dict: total = len(results) logging.info(f"Response for GET List Agents - Page Total: {page_total} / Total: {total}") for agent in results: - agents.append(build_team_agent(agent)) + try: + team_agent_ = build_team_agent(agent) + agents.append(team_agent_) + except Exception: + logging.warning(f"There was an error building the team agent {agent['name']}. Skipping...") + continue return {"results": agents, "page_total": page_total, "page_number": 0, "total": total} else: error_msg = "Agent Listing Error: Please contact the administrators."