Skip to content

Commit

Permalink
implementing sequential process
Browse files Browse the repository at this point in the history
  • Loading branch information
joaomdmoura committed Nov 6, 2023
1 parent 48aa2a8 commit 6329d72
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions crewai/crew.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import List
from typing import List, Any
from pydantic.v1 import BaseModel, Field

from .process import Process
Expand All @@ -11,29 +11,31 @@ 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:
"""
Kickoff the crew to work on it's tasks.
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

0 comments on commit 6329d72

Please sign in to comment.