From d72ebb9bb8f4e5c976866e268247b905548a0e34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Moura?= Date: Fri, 18 Oct 2024 07:46:30 -0300 Subject: [PATCH] fixing annotations --- src/crewai/project/annotations.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/crewai/project/annotations.py b/src/crewai/project/annotations.py index 5bbf8dd1c9..a2a0549237 100644 --- a/src/crewai/project/annotations.py +++ b/src/crewai/project/annotations.py @@ -76,22 +76,24 @@ def wrapper(self, *args, **kwargs) -> Crew: instantiated_agents = [] agent_roles = set() - # Collect methods from crew in order + # Collect methods from crew instance (not class) all_functions = [ (name, getattr(self, name)) - for name, attr in self.__class__.__dict__.items() - if callable(attr) + for name in dir(self) + if callable(getattr(self, name)) and not name.startswith("__") ] + + # Filter tasks and agents tasks = [ (name, method) for name, method in all_functions - if hasattr(method, "is_task") + if hasattr(method, "is_task") and method.is_task ] agents = [ (name, method) for name, method in all_functions - if hasattr(method, "is_agent") + if hasattr(method, "is_agent") and method.is_agent ] # Instantiate tasks in order