From e00b5455483c0731830fec68fdd4cebf1e617526 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Moura?= Date: Fri, 5 Apr 2024 08:31:25 -0300 Subject: [PATCH] adding max execution time --- docs/core-concepts/Agents.md | 1 + pyproject.toml | 2 +- src/crewai/agent.py | 5 +++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/core-concepts/Agents.md b/docs/core-concepts/Agents.md index 2343d0e49..7bac949e6 100644 --- a/docs/core-concepts/Agents.md +++ b/docs/core-concepts/Agents.md @@ -26,6 +26,7 @@ description: What are crewAI Agents and how to use them. | **Function Calling LLM** *(optional)* | Specifies the language model that will handle the tool calling for this agent, overriding the crew function calling LLM if passed. Default is `None`. | | **Max Iter** *(optional)* | The maximum number of iterations the agent can perform before being forced to give its best answer. Default is `15`. | | **Max RPM** *(optional)* | The maximum number of requests per minute the agent can perform to avoid rate limits. It's optional and can be left unspecified, with a default value of `None`. | +| **max_execution_time** *(optional)* | Maximum execution time for an agent to execute a task It's optional and can be left unspecified, with a default value of `None`, menaning no max execution time | | **Verbose** *(optional)* | Setting this to `True` configures the internal logger to provide detailed execution logs, aiding in debugging and monitoring. Default is `False`. | | **Allow Delegation** *(optional)* | Agents can delegate tasks or questions to one another, ensuring that each task is handled by the most suitable agent. Default is `True`. | | **Step Callback** *(optional)* | A function that is called after each step of the agent. This can be used to log the agent's actions or to perform other operations. It will overwrite the crew `step_callback`. | diff --git a/pyproject.toml b/pyproject.toml index 9097cbb58..02adf777f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "crewai" -version = "0.27.1" +version = "0.27.2" description = "Cutting-edge framework for orchestrating role-playing, autonomous AI agents. By fostering collaborative intelligence, CrewAI empowers agents to work together seamlessly, tackling complex tasks." authors = ["Joao Moura "] readme = "README.md" diff --git a/src/crewai/agent.py b/src/crewai/agent.py index 27b5a9076..ba6a23ac2 100644 --- a/src/crewai/agent.py +++ b/src/crewai/agent.py @@ -90,6 +90,10 @@ class Agent(BaseModel): max_iter: Optional[int] = Field( default=15, description="Maximum iterations for an agent to execute a task" ) + max_execution_time: Optional[int] = Field( + default=None, + description="Maximum execution time for an agent to execute a task", + ) agent_executor: InstanceOf[CrewAgentExecutor] = Field( default=None, description="An instance of the CrewAgentExecutor class." ) @@ -276,6 +280,7 @@ class Agent(BaseModel): "original_tools": tools, "handle_parsing_errors": True, "max_iterations": self.max_iter, + "max_execution_time": self.max_execution_time, "step_callback": self.step_callback, "tools_handler": self.tools_handler, "function_calling_llm": self.function_calling_llm,