mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-29 18:18:13 +00:00
adding process and task modules
This commit is contained in:
9
crewai/process.py
Normal file
9
crewai/process.py
Normal file
@@ -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'
|
||||||
26
crewai/task.py
Normal file
26
crewai/task.py
Normal file
@@ -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
|
||||||
Reference in New Issue
Block a user