Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]Hierarchical Manager assigned wrong tools #2054

Open
andrewn3 opened this issue Feb 7, 2025 · 1 comment
Open

[BUG]Hierarchical Manager assigned wrong tools #2054

andrewn3 opened this issue Feb 7, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@andrewn3
Copy link

andrewn3 commented Feb 7, 2025

Description

When you have a hierarchical process and the first agent has tools assigned, it seems that the task fot this agent is assigned these tools, so when assigning tools to the manager these task tools are also included in the list of tools a manager can use (I assume it would be the same if the tools are also defined at a task level). This means that the manager will use these tools, in addition to the delegate and ask question tools. This means the manager can carry out the work with these tools rather than just delegating/asking. also if the agent has a different LLM defined then not good as lots of work is carried out by the manager.

Steps to Reproduce

  1. Create a hierarchical process and use manager_llm
  2. Create the first agent with tools assigned, create other agents with no tools.
  3. Create a tasks with no tools.

Expected behavior

Unlike the planner agent which has it's own task, the manager agent picks up the first task and the tools associated with that. I would expect under all scenarios that just delegate and ask tools are assigned to the manager.

so it seems to happen is in crew.py it assigns the tools from task 1

tools_for_task = task.tools or agent_to_use.tools or []

which means this line adds the delegate and ask tools tools = self._inject_delegation_tools(tools, task.agent, [task.agent])

and then the manager does work with the tools from the first agent e.g. searching the internet etc rather than just delegating/asking questions.

Screenshots/Code snippets

Image

Operating System

Windows 11

Python Version

3.10

crewAI Version

0.100.0

crewAI Tools Version

0.33.0

Virtual Environment

Venv

Evidence

You are Crew Manager. You are a seasoned manager with a knack for getting the best out of your team.
You are also known for your ability to delegate work to the right people, and to ask the right questions to get the best out of your team.
Even though you don't perform tasks by yourself, you have a lot of experience in the field, which allows you to properly evaluate the work of your team members.
Your personal goal is: Manage the team to complete the task in the best way possible.
You ONLY have access to the following tools, and should NEVER make up tools that are not listed here:

Tool Name: Search in a specific website
Tool Arguments: {'search_query': {'description': 'Mandatory search query you want to use to search a specific website', 'type': 'str'}, 'website': {'description': 'Mandatory valid website URL you want to search on', 'type': 'str'}}
Tool Description: A tool that can be used to semantic search a query from a specific URL content.
Tool Name: Read website content
Tool Arguments: {'website_url': {'description': 'Mandatory website url to read the file', 'type': 'str'}}
Tool Description: A tool that can be used to read a website content.
Tool Name: Read a website content
Tool Arguments: {'website_url': {'description': 'Mandatory website url to read the file. Must start with http:// or https://', 'type': 'str'}, 'css_element': {'description': 'Mandatory css reference for element to scrape from the website', 'type': 'str'}}
Tool Description: Tool Name: Read a website content
Tool Arguments: {'website_url': {'description': 'Mandatory website url to read the file. Must start with http:// or https://', 'type': 'str'}, 'css_element': {'description': 'Mandatory css reference for element to scrape from the website', 'type': 'str'}}
Tool Description: A tool that can be used to read a website content.
Tool Name: Search the internet with Serper
Tool Arguments: {'search_query': {'description': 'Mandatory search query you want to use to search the internet', 'type': 'str'}}
Tool Description: A tool that can be used to search the internet with a search_query. Supports different search types: 'search' (default), 'news'
Tool Name: Delegate work to coworker
Tool Arguments: {'task': {'description': 'The task to delegate', 'type': 'str'}, 'context': {'description': 'The context for the task', 'type': 'str'}, 'coworker': {'description': 'The role/name of the coworker to delegate to', 'type': 'str'}}
Tool Description: Delegate a specific task to one of the following coworkers: Model Designer Agent
The 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.
Tool Name: Ask question to coworker
Tool Arguments: {'question': {'description': 'The question to ask', 'type': 'str'}, 'context': {'description': 'The context for the question', 'type': 'str'}, 'coworker': {'description': 'The role/name of the coworker to ask', 'type': 'str'}}
Tool Description: Ask a specific question to one of the following coworkers: Model Designer Agent
The input to this tool should be the coworker, the question you have for them, and ALL necessary context to ask the question properly, they know nothing about the question, so share absolute everything you know, don't reference things but instead explain them.

IMPORTANT: Use the following format in your response:

Possible Solution

in crew.py this line tools_for_task = task.tools or agent_to_use.tools or [] should be changed to check if it's the manager and assign the agent tools only otherwise assign the task/agent or no tools

Additional context

no

@andrewn3 andrewn3 added the bug Something isn't working label Feb 7, 2025
@Vidit-Ostwal
Copy link
Contributor

Can you share the complete code here once?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants