Framework for orchestrating role-playing, autonomous AI agents. By fostering collaborative intelligence, CrewAI empowers agents to work together seamlessly, tackling complex tasks.
small adjustments before cutting version
João Mourad3da73136c59
diff --git a/src/crewai/task.py b/src/crewai/task.pyindex 217e7dbfd..d55373e28 100644--- a/src/crewai/task.py+++ b/src/crewai/task.py@@ -133,7 +133,6 @@ class Task(BaseModel):default=3, description="Maximum number of retries when guardrail fails")retry_count: int = Field(default=0, description="Current number of retries")-start_time: Optional[datetime.datetime] = Field(default=None, description="Start time of the task execution")@@ -391,10 +390,9 @@ class Task(BaseModel):)self.retry_count += 1- context = (- f"### Previous attempt failed validation: {guardrail_result.error}\n\n\n"- f"### Previous result:\n{task_output.raw}\n\n\n"- "Try again, making sure to address the validation error."+ context = self.i18n.errors("validation_error").format(+ guardrail_result_error=guardrail_result.error,+ task_output=task_output.raw)return self._execute_core(agent, context, tools)diff --git a/src/crewai/tools/agent_tools/base_agent_tools.py b/src/crewai/tools/agent_tools/base_agent_tools.pyindex e67dce72a..b00fbb7b5 100644--- a/src/crewai/tools/agent_tools/base_agent_tools.py+++ b/src/crewai/tools/agent_tools/base_agent_tools.py@@ -1,5 +1,5 @@import logging-from typing import Optional, Union+from typing import Optionalfrom pydantic import Field@@ -54,12 +54,12 @@ class BaseAgentTool(BaseTool):) -> str:"""Execute delegation to an agent with case-insensitive and whitespace-tolerant matching.-+Args:agent_name: Name/role of the agent to delegate to (case-insensitive)task: The specific question or task to delegatecontext: Optional additional context for the task execution-+Returns:str: The execution result from the delegated agent or an error messageif the agent cannot be founddiff --git a/src/crewai/translations/en.json b/src/crewai/translations/en.jsonindex a1ea30436..3cee10aa6 100644--- a/src/crewai/translations/en.json+++ b/src/crewai/translations/en.json@@ -34,7 +34,8 @@"tool_arguments_error": "Error: the Action Input is not a valid key, value dictionary.","wrong_tool_name": "You tried to use the tool {tool}, but it doesn't exist. You must use one of the following tools, use one at time: {tools}.","tool_usage_exception": "I encountered an error while trying to use the tool. This was the error: {error}.\n Tool {tool} accepts these inputs: {tool_inputs}",- "agent_tool_execution_error": "Error executing task with agent '{agent_role}'. Error: {error}"+ "agent_tool_execution_error": "Error executing task with agent '{agent_role}'. Error: {error}",+ "validation_error": "### Previous attempt failed validation: {guardrail_result_error}\n\n\n### Previous result:\n{task_output}\n\n\nTry again, making sure to address the validation error."},"tools": {"delegate_work": "Delegate a specific task to one of the following coworkers: {coworkers}\nThe input to this tool should be the coworker, the task you want them to do, and ALL necessary context to execute the task, they know nothing about the task, so share absolute everything you know, don't reference things but instead explain them.",diff --git a/src/crewai/utilities/planning_handler.py b/src/crewai/utilities/planning_handler.pyindex 9092dedda..6ce74f236 100644--- a/src/crewai/utilities/planning_handler.py+++ b/src/crewai/utilities/planning_handler.py@@ -1,4 +1,3 @@-import jsonimport loggingfrom typing import Any, List, Optional@@ -78,10 +77,10 @@ class CrewPlanner:def _get_agent_knowledge(self, task: Task) -> List[str]:"""Safely retrieve knowledge source content from the task's agent.-+Args:task: The task containing an agent with potential knowledge sources-+Returns:List[str]: A list of knowledge source strings"""@@ -108,6 +107,6 @@ class CrewPlanner:f"[{', '.join(str(tool) for tool in task.agent.tools)}]" if task.agent and task.agent.tools else '"agent has no tools"',f',\n "agent_knowledge": "[\\"{knowledge_list[0]}\\"]"' if knowledge_list and str(knowledge_list) != "None" else "")-+tasks_summary.append(task_summary)return " ".join(tasks_summary)