Fix: Fixed agent not found in SequentialCrewComponent. (#5449)
* fix: agents not found in SequentialCrewComponent #4959 * translate texts * [autofix.ci] apply automated fixes * Update sequential_crew.py Removed Agent import --------- Co-authored-by: William Bilibio <bilibio@vaidebolsa.com.br> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
f1d14bf4b8
commit
5381ee1d90
1 changed files with 10 additions and 4 deletions
|
|
@ -16,11 +16,17 @@ class SequentialCrewComponent(BaseCrewComponent):
|
|||
HandleInput(name="tasks", display_name="Tasks", input_types=["SequentialTask"], is_list=True),
|
||||
]
|
||||
|
||||
def get_tasks_and_agents(self, agents_list=None) -> tuple[list[Task], list[Agent]]:
|
||||
if not agents_list:
|
||||
agents_list = [task.agent for task in self.tasks] or []
|
||||
@property
|
||||
def agents(self: "SequentialCrewComponent") -> list[Agent]:
|
||||
# Derive agents directly from linked tasks
|
||||
return [task.agent for task in self.tasks if hasattr(task, "agent")]
|
||||
|
||||
def get_tasks_and_agents(self, agents_list=None) -> tuple[list[Task], list[Agent]]:
|
||||
# Use the agents property to derive agents
|
||||
if not agents_list:
|
||||
existing_agents = self.agents
|
||||
agents_list = existing_agents + (agents_list or [])
|
||||
|
||||
# Use the superclass implementation, passing the customized agents_list
|
||||
return super().get_tasks_and_agents(agents_list=agents_list)
|
||||
|
||||
def build_crew(self) -> Message:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue