mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-05-02 07:42:40 +00:00
Fix tool propagation bug in hierarchical crews (#3679)
- Remove check_tools validator from task.py that was extending task.tools with agent.tools at creation time - This caused manager agents in hierarchical crews to incorrectly inherit tools from task agents - The crew.py execution logic already handles tool resolution correctly at execution time via fallback: task.tools or agent_to_use.tools or [] - Add reproduction test test_hierarchical_crew_does_not_propagate_agent_tools_to_manager - Update test_task_tool_reflect_agent_tools to verify execution-time behavior Fixes #3679 Co-Authored-By: João <joao@crewai.com>
This commit is contained in:
@@ -336,12 +336,6 @@ class Task(BaseModel):
|
||||
setattr(self, key, value)
|
||||
return self
|
||||
|
||||
@model_validator(mode="after")
|
||||
def check_tools(self):
|
||||
"""Check if the tools are set."""
|
||||
if not self.tools and self.agent and self.agent.tools:
|
||||
self.tools.extend(self.agent.tools)
|
||||
return self
|
||||
|
||||
@model_validator(mode="after")
|
||||
def check_output(self):
|
||||
|
||||
Reference in New Issue
Block a user