Repository: phidatahq/phidata
File: libs/agno/agno/os/app.py (Python)

Code before:
            self._add_router(app, get_home_router(self))

        self._add_router(app, get_health_router(health_endpoint="/health"))
        self._add_router(app, get_base_router(self, settings=self.settings))
        self._add_router(app, get_agent_router(self, settings=self.settings))
        self._add_router(app, get_team_router(self, settings=self.settings))
        self._add_router(app, get_workflow_router(self, settings=self.settings))
        self._add_router(app, get_websocket_router(self, settings=self.settings))

        # Add A2A interface if relevant
        has_a2a_interface = False
        for interface in self.interfaces:
            if not has_a2a_interface and interface.__class__.__name__ == "A2A":
                has_a2a_interface = True
            interface_router = interface.get_router()
            self._add_router(app, interface_router)
        if self.a2a_interface and not has_a2a_interface:
            from agno.os.interfaces.a2a import A2A

            a2a_interface = A2A(agents=self.agents, teams=self.teams, workflows=self.workflows)
            self.interfaces.append(a2a_interface)
            self._add_router(app, a2a_interface.get_router())

    def _check_duplicate_ids(
        self,
        items: Optional[List[Any]],
        item_type: str,
    ) -> None:
        """Check for duplicate IDs in a list of items.

        Args:
            items: List of agents, teams, or workflows
            item_type: Type name for error messages (e.g., "Agent", "Team", "Workflow")

        Raises:
            ValueError: If duplicate IDs are found
        """
        if not items:
            return

        seen_ids: Dict[str, List[str]] = {}  # id -> list of names with that id

        for item in items:
            item_id = item.id
            # If id is None, generate it the same way initialization does
            if item_id is None:
                if hasattr(item, "name") and item.name:
                    item_id = generate_id_from_name(item.name)
                else:
                    continue  # Will get unique UUID during initialization


Review comment (suggestion):
This is a weird interface... you only need the `item_type` for a log? 

also `items` should be `entities`

Code after:
        # Add the updated routes
        for router in updated_routers:
            self._add_router(app, router)

        # Mount MCP if needed
        if self.enable_mcp_server and self._mcp_app:
            app.mount("/", self._mcp_app)

    def _add_built_in_routes(self, app: FastAPI) -> None:
        """Add all AgentOSbuilt-in routes to the given app."""
        # Add the home router if MCP server is not enabled
        if not self.enable_mcp_server:
            self._add_router(app, get_home_router(self))

        self._add_router(app, get_health_router(health_endpoint="/health"))
        self._add_router(app, get_base_router(self, settings=self.settings))
        self._add_router(app, get_agent_router(self, settings=self.settings))
        self._add_router(app, get_team_router(self, settings=self.settings))
        self._add_router(app, get_workflow_router(self, settings=self.settings))
        self._add_router(app, get_websocket_router(self, settings=self.settings))

        # Add A2A interface if relevant
        has_a2a_interface = False
        for interface in self.interfaces:
            if not has_a2a_interface and interface.__class__.__name__ == "A2A":
                has_a2a_interface = True
            interface_router = interface.get_router()
            self._add_router(app, interface_router)
        if self.a2a_interface and not has_a2a_interface:
            from agno.os.interfaces.a2a import A2A

            a2a_interface = A2A(agents=self.agents, teams=self.teams, workflows=self.workflows)
            self.interfaces.append(a2a_interface)
            self._add_router(app, a2a_interface.get_router())

    def _raise_if_duplicate_ids(self) -> None:
        """Check for duplicate IDs within each entity type.

        Raises:
            ValueError: If duplicate IDs are found within the same entity type
        """
        duplicate_ids: List[str] = []

        for entities in [self.agents, self.teams, self.workflows]:
            if not entities:
                continue
            seen_ids: set[str] = set()
            for entity in entities:
                entity_id = entity.id
                if entity_id is None:
                    continue