Skip to content

[BUG] a task list of tools overrides agent list of tools #2791

Closed
@mikhail

Description

@mikhail

Description

My expectation is that if an Agent has 3 tools and I assign it a task that has 1 tool then the final execution will be able to leverage 4 tools. This is not true. Final execution will only leverage 1 tool from the task.

Steps to Reproduce

myagent = Agent(..., tools=[generic_tool1, generic_tool2, generic_tool3])
mytask = Task(..., tools=[task_specific_tool], agent=myagent)

Expected behavior

Final prompt is invoked with 4 tools: generic_tool1, generic_tool2, generic_tool3, task_specific_tool

Screenshots/Code snippets

n/a

Operating System

Ubuntu 20.04

Python Version

3.10

crewAI Version

0.118.0

crewAI Tools Version

n/a

Virtual Environment

Venv

Evidence

final prompt sent by wire doesn't list agent tools if task tools are specified

Possible Solution

This block calls "extend" but incorrectly has "not self.tools and" check

# task.py
  @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

Additional context

n/a

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions