diff --git a/crewai/process.py b/crewai/process.py new file mode 100644 index 000000000..f585b6f8c --- /dev/null +++ b/crewai/process.py @@ -0,0 +1,9 @@ +from enum import Enum + +class Process(str, Enum): + """ + Class representing the different processes that can be used to tackle tasks + """ + sequential = 'sequential' + consensual = 'consensual' + hierarchical = 'hierarchical' diff --git a/crewai/task.py b/crewai/task.py new file mode 100644 index 000000000..7dc40a7bf --- /dev/null +++ b/crewai/task.py @@ -0,0 +1,26 @@ +from typing import List, Optional +from pydantic import BaseModel, Field, model_validator + +from langchain.tools import Tool + +from .agent import Agent + +class Task(BaseModel): + """ + Class that represent a task to be executed. + """ + + description: str = Field(description="Description of the actual task.") + agent: Optional[Agent] = Field( + description="Agent responsible for the task.", + default=None + ) + tools: Optional[List[Tool]] = Field( + description="Tools the agent are limited to use for this task.", + default=[] + ) + + @model_validator(mode="after") + def _set_tools(self) -> None: + if self.agent: + self.tools = self.agent.tools \ No newline at end of file