mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-11 00:58:30 +00:00
adding process and task modules
This commit is contained in:
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