diff --git a/src/crewai/agents/agent_builder/base_agent.py b/src/crewai/agents/agent_builder/base_agent.py index 559812387..a82cd12d7 100644 --- a/src/crewai/agents/agent_builder/base_agent.py +++ b/src/crewai/agents/agent_builder/base_agent.py @@ -171,15 +171,15 @@ class BaseAgent(ABC, BaseModel): tool meets these criteria, it is processed and added to the list of tools. Otherwise, a ValueError is raised. """ + if not tools: + return [] + processed_tools = [] + required_attrs = ["name", "func", "description"] for tool in tools: if isinstance(tool, BaseTool): processed_tools.append(tool) - elif ( - hasattr(tool, "name") - and hasattr(tool, "func") - and hasattr(tool, "description") - ): + elif all(hasattr(tool, attr) for attr in required_attrs): # Tool has the required attributes, create a Tool instance processed_tools.append(Tool.from_langchain(tool)) else: @@ -261,13 +261,6 @@ class BaseAgent(ABC, BaseModel): """Set the task tools that init BaseAgenTools class.""" pass - # @abstractmethod - # def get_output_converter( - # self, llm: Any, text: str, model: type[BaseModel] | None, instructions: str - # ) -> Converter: - # """Get the converter class for the agent to create json/pydantic outputs.""" - # pass - def copy(self: T) -> T: # type: ignore # Signature of "copy" incompatible with supertype "BaseModel" """Create a deep copy of the Agent.""" exclude = {