Framework for orchestrating role-playing, autonomous AI agents. By fostering collaborative intelligence, CrewAI empowers agents to work together seamlessly, tackling complex tasks.
Fixed typing issues for new crews (#1358)
Brandon Hancock (bhancock_ai)164e7895bf6e
diff --git a/src/crewai/project/crew_base.py b/src/crewai/project/crew_base.pyindex 4c9bbabed..62390e991 100644--- a/src/crewai/project/crew_base.py+++ b/src/crewai/project/crew_base.py@@ -1,14 +1,19 @@import inspectfrom pathlib import Path-from typing import Any, Callable, Dict+from typing import Any, Callable, Dict, Type, TypeVarimport yamlfrom dotenv import load_dotenv+from crewai.crew import Crew+load_dotenv()-def CrewBase(cls):+T = TypeVar("T", bound=Type[Any])+++def CrewBase(cls: T) -> T:class WrappedClass(cls):is_crew_class: bool = True # type: ignore@@ -32,6 +37,19 @@ def CrewBase(cls):self.map_all_agent_variables()self.map_all_task_variables()+ def crew(self) -> "Crew":+ agents = [+ getattr(self, name)()+ for name, func in self._get_all_functions().items()+ if hasattr(func, "is_agent")+ ]+ tasks = [+ getattr(self, name)()+ for name, func in self._get_all_functions().items()+ if hasattr(func, "is_task")+ ]+ return Crew(agents=agents, tasks=tasks)+@staticmethoddef load_yaml(config_path: Path):try: