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]: Sub-Agent (FunctionAgent) not utilizing Tools in Multi-Agent System #18264

Open
RakeshReddyKondeti opened this issue Mar 25, 2025 · 5 comments
Labels
bug Something isn't working triage Issue needs to be triaged/prioritized

Comments

@RakeshReddyKondeti
Copy link

Bug Description

I am building a multi-agent system using AgentWorkflow by defining individual FunctionAgents. After passing the user query to the workflow, the top-level agent (root agent) routes this query to the relevant sub-agent using the tool handoff. However, the sub-agent is not able to call any of the tools provided. Instead of utilizing the tools, the sub-agent is directly giving some random response.

Version

0.12.16

Steps to Reproduce

  1. Define individual FunctionAgents with multiple tools. (I have a dedicated FunctionAgent which acts a router by only taking in handoff tool).
  2. Define AgentWorkflow by passing all the defined FunctionAgents. (Define the above mentioned dedicated FunctionAgent as the root agent.)
  3. Start the workflow with a user query.
  4. The root agent routes the query to the relevant sub-agent using the tool handoff.
  5. Observe the sub-agent's response.

Relevant Logs/Tracbacks

@RakeshReddyKondeti RakeshReddyKondeti added bug Something isn't working triage Issue needs to be triaged/prioritized labels Mar 25, 2025
Copy link

dosubot bot commented Mar 25, 2025

A sub-agent might bypass tool usage and provide a direct response if the return_direct option is set to True in the tool class constructor. Additionally, if the agent determines that it can answer the question without any tools, it will directly provide a response. This behavior is indicated by a "Thought" followed by an "Answer" in the output, rather than an "Action" [1][2].

To address this issue, ensure that the return_direct option is not set to True unless intended, and verify that the sub-agent is correctly configured to use its tools. Additionally, check if there are any specific conditions or configurations that might prevent the sub-agent from utilizing its tools, such as incorrect tool definitions or associations [3].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

@RakeshReddyKondeti
Copy link
Author

@dosu I did not turn on return_redirect. Also, I have tried with multiple prompts and different LLMs, so the issue does not seem to be related to the prompts or the LLMs used.

Copy link

dosubot bot commented Mar 25, 2025

If return_direct is not enabled and the issue persists across different prompts and LLMs, consider the following potential causes and solutions:

  1. Tool Availability: Ensure that the tools are correctly defined and associated with the sub-agent. Verify that the tool names and descriptions are accurate, as these are crucial for the LLM to correctly call the tools [1].

  2. Agent Configuration: Check the configuration of the sub-agent to ensure it is set up to use the tools. Make sure that the tools are properly initialized and that the sub-agent has access to them [2].

  3. Handoff Logic: Review the handoff logic to ensure that the query is being correctly routed to the sub-agent and that the sub-agent is expected to use the tools. Verify that the handoff prompts and configurations are correctly set up [2].

  4. Debugging Logs: Utilize the available debugging logs to trace the decision-making process of the sub-agent. This can help identify where the process might be failing or why the tools are not being utilized [1].

By checking these areas, you may be able to identify the root cause of the issue and ensure that the sub-agent utilizes its tools as expected.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

@logan-markewich
Copy link
Collaborator

@RakeshReddyKondeti a lot of this depends on

  1. The LLM you are using -- not every LLM is equal. And especially open-source LLMs are terrible at being agents
  2. Your tool names/descriptions have HUGE impacts on performance
  3. Your system prompt has HUGE impacts on performance

It would probably help if you shared a google colab notebook or some code, but the above points will help you finetune your system

@RakeshReddyKondeti
Copy link
Author

RakeshReddyKondeti commented Mar 26, 2025

@logan-markewich Thank you for your feedback. Attached you will find the notebook demonstrating the issue in detail.

Notebook

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

No branches or pull requests

2 participants