mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-04-30 14:52:36 +00:00
implementing sequential process
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from typing import List
|
||||
from typing import List, Any
|
||||
from pydantic.v1 import BaseModel, Field
|
||||
|
||||
from .process import Process
|
||||
@@ -11,9 +11,12 @@ class Crew(BaseModel):
|
||||
their tasks.
|
||||
"""
|
||||
goal: str = Field(description="Objective of the crew being created.")
|
||||
process: Process = Field(description="Process that the crew will follow.")
|
||||
tasks: List[Task] = Field(description="List of tasks")
|
||||
agents: List[Agent] = Field(description="List of agents in this crew.")
|
||||
process: Process = Field(
|
||||
description="Process that the crew will follow.",
|
||||
default=Process.sequential
|
||||
)
|
||||
|
||||
def kickoff(self) -> str:
|
||||
"""
|
||||
@@ -21,19 +24,18 @@ class Crew(BaseModel):
|
||||
Returns:
|
||||
output (List[str]): Output of the crew for each task.
|
||||
"""
|
||||
# if self.process == Process.consensual:
|
||||
|
||||
if self.process == Process.sequential:
|
||||
return self.__sequential_loop()
|
||||
return "Crew is executing task"
|
||||
|
||||
def __consensual_loop(self) -> str:
|
||||
def __sequential_loop(self) -> str:
|
||||
"""
|
||||
Loop that executes the consensual process.
|
||||
Loop that executes the sequential process.
|
||||
Returns:
|
||||
output (str): Output of the crew.
|
||||
"""
|
||||
task_outcome = None
|
||||
for task in self.tasks:
|
||||
task_outcome = task.execute(task_outcome)
|
||||
|
||||
# The group of agents need to decide which agent will execute each task
|
||||
# in the self.task list. This is done by a voting process between all the
|
||||
# agents in self.agents. The agent with the most votes will execute the
|
||||
# task.
|
||||
pass
|
||||
return task_outcome
|
||||
Reference in New Issue
Block a user