mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-22 14:48:13 +00:00
Fix issue #2791: Task tools now combine with agent tools instead of overriding them
Co-Authored-By: Joe Moura <joao@crewai.com>
This commit is contained in:
@@ -43,7 +43,7 @@ def test_task_tool_reflect_agent_tools():
|
||||
assert task.tools == [fake_tool]
|
||||
|
||||
|
||||
def test_task_tool_takes_precedence_over_agent_tools():
|
||||
def test_task_tools_combined_with_agent_tools():
|
||||
from crewai.tools import tool
|
||||
|
||||
@tool
|
||||
@@ -52,7 +52,7 @@ def test_task_tool_takes_precedence_over_agent_tools():
|
||||
|
||||
@tool
|
||||
def fake_task_tool() -> None:
|
||||
"Fake tool"
|
||||
"Fake task tool"
|
||||
|
||||
researcher = Agent(
|
||||
role="Researcher",
|
||||
@@ -69,7 +69,9 @@ def test_task_tool_takes_precedence_over_agent_tools():
|
||||
tools=[fake_task_tool],
|
||||
)
|
||||
|
||||
assert task.tools == [fake_task_tool]
|
||||
assert len(task.tools) == 2
|
||||
assert any(tool.name == fake_task_tool.name for tool in task.tools)
|
||||
assert any(tool.name == fake_tool.name for tool in task.tools)
|
||||
|
||||
|
||||
def test_task_prompt_includes_expected_output():
|
||||
@@ -1455,4 +1457,4 @@ def test_task_with_max_execution_time_exceeded():
|
||||
)
|
||||
|
||||
with pytest.raises(TimeoutError):
|
||||
task.execute_sync(agent=researcher)
|
||||
task.execute_sync(agent=researcher)
|
||||
|
||||
Reference in New Issue
Block a user