mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-05-02 07:42:40 +00:00
ensure hierarchical works
This commit is contained in:
@@ -593,6 +593,7 @@ class Crew(BaseModel):
|
|||||||
Returns:
|
Returns:
|
||||||
CrewOutput: Final output of the crew
|
CrewOutput: Final output of the crew
|
||||||
"""
|
"""
|
||||||
|
|
||||||
task_outputs: List[TaskOutput] = []
|
task_outputs: List[TaskOutput] = []
|
||||||
futures: List[Tuple[Task, Future[TaskOutput], int]] = []
|
futures: List[Tuple[Task, Future[TaskOutput], int]] = []
|
||||||
last_sync_output: Optional[TaskOutput] = None
|
last_sync_output: Optional[TaskOutput] = None
|
||||||
@@ -608,12 +609,16 @@ class Crew(BaseModel):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
self._prepare_task(task, manager)
|
self._prepare_task(task, manager)
|
||||||
agent_to_use = task.agent if task.agent else manager
|
if self.process == Process.hierarchical:
|
||||||
|
agent_to_use = manager
|
||||||
|
else:
|
||||||
|
agent_to_use = task.agent
|
||||||
if agent_to_use is None:
|
if agent_to_use is None:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
f"No agent available for task: {task.description}. Ensure that either the task has an assigned agent or a manager agent is provided."
|
f"No agent available for task: {task.description}. Ensure that either the task has an assigned agent or a manager agent is provided."
|
||||||
)
|
)
|
||||||
self._log_task_start(task, agent_to_use)
|
self._log_task_start(task, agent_to_use)
|
||||||
|
|
||||||
if task.async_execution:
|
if task.async_execution:
|
||||||
context = self._set_context(
|
context = self._set_context(
|
||||||
task, [last_sync_output] if last_sync_output else []
|
task, [last_sync_output] if last_sync_output else []
|
||||||
|
|||||||
Reference in New Issue
Block a user