Tavily plugin not working as a tool in Agent block. #12188

Closed
opened 2026-02-21 19:06:14 -05:00 by yindo · 4 comments
Owner

Originally created by @sergedoub on GitHub (Mar 26, 2025).

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.1.2

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

When asking the Agent block with FunctionCalling to invoke Tavily Search as a tool, it gives an error during runtime.

  1. Add Agent block
  2. Select Function Calling
  3. Add Tavily Search to tools
  4. Instruct the Agent block to use Tavily search

Failed to transform agent message: PluginInvokeError: {"args":{},"error_type":"Exception","message":"read llm model failed: request failed: [models] Bad Request Error, Error code: 400 - {'error': {'message': \"Invalid schema for function 'tavily_search': 'select' is not valid under any of the given schemas.\", 'type': 'invalid_request_error', 'param': 'functions[0].parameters', 'code': 'invalid_function_parameters'}}"}

Error
Image

Settings
Image

✔️ Expected Behavior

Tavily Search payload should be well formed and return search results.

Actual Behavior

Schema error prevents Tavily from performing the search.

Originally created by @sergedoub on GitHub (Mar 26, 2025). ### Self Checks - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.1.2 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce When asking the Agent block with FunctionCalling to invoke Tavily Search as a tool, it gives an error during runtime. 1. Add Agent block 2. Select Function Calling 3. Add Tavily Search to tools 4. Instruct the Agent block to use Tavily search `Failed to transform agent message: PluginInvokeError: {"args":{},"error_type":"Exception","message":"read llm model failed: request failed: [models] Bad Request Error, Error code: 400 - {'error': {'message': \"Invalid schema for function 'tavily_search': 'select' is not valid under any of the given schemas.\", 'type': 'invalid_request_error', 'param': 'functions[0].parameters', 'code': 'invalid_function_parameters'}}"}` _Error_ <img width="423" alt="Image" src="https://github.com/user-attachments/assets/46bf347b-1240-4835-b11b-779284b9feb8" /> _Settings_ <img width="409" alt="Image" src="https://github.com/user-attachments/assets/ff2bd4cc-a460-4a85-9e0c-43ec5c91df7d" /> ### ✔️ Expected Behavior Tavily Search payload should be well formed and return search results. ### ❌ Actual Behavior Schema error prevents Tavily from performing the search.
yindo added the 🐞 bug🔨 feat:tools labels 2026-02-21 19:06:14 -05:00
yindo closed this issue 2026-02-21 19:06:14 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Mar 26, 2025):

Hey there, @sergedoub! 👋 I'm here to help you with bugs, questions, and becoming a contributor. Let's squash those bugs together!

The error you're encountering with the Tavily plugin in the Agent block is due to an invalid schema for the tavily_search function. The error message indicates that the schema for the function parameters is not being recognized correctly, leading to a 400 Bad Request Error.

To resolve this issue, ensure that the parameters for the tavily_search function are correctly defined according to the expected schema. The correct schema for the tavily_search function parameters is:

{
    "query": str,
    "search_depth": str,  # e.g., "basic"
    "include_answer": bool,
    "include_images": bool,
    "include_raw_content": bool,
    "max_results": int,
    "include_domains": str,
    "exclude_domains": str,
}

Make sure that the parameters you are passing to the tavily_search function match this schema. Check for any discrepancies, such as incorrect data types or missing required fields, which could be causing the schema validation to fail [1].

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

@dosubot[bot] commented on GitHub (Mar 26, 2025): <!-- Greeting --> Hey there, @sergedoub! 👋 I'm here to help you with bugs, questions, and becoming a contributor. Let's squash those bugs together! <!-- Answer --> The error you're encountering with the Tavily plugin in the Agent block is due to an invalid schema for the `tavily_search` function. The error message indicates that the schema for the function parameters is not being recognized correctly, leading to a 400 Bad Request Error. To resolve this issue, ensure that the parameters for the `tavily_search` function are correctly defined according to the expected schema. The correct schema for the `tavily_search` function parameters is: ```python { "query": str, "search_depth": str, # e.g., "basic" "include_answer": bool, "include_images": bool, "include_raw_content": bool, "max_results": int, "include_domains": str, "exclude_domains": str, } ``` Make sure that the parameters you are passing to the `tavily_search` function match this schema. Check for any discrepancies, such as incorrect data types or missing required fields, which could be causing the schema validation to fail <sup>[[1]](https://github.com/langgenius/dify/blob/main/api/core/tools/provider/builtin/tavily/tavily.py)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/1de8c33a-043a-4568-aa9b-a72c29ceb911?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/1de8c33a-043a-4568-aa9b-a72c29ceb911?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/1de8c33a-043a-4568-aa9b-a72c29ceb911?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/1de8c33a-043a-4568-aa9b-a72c29ceb911?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/1de8c33a-043a-4568-aa9b-a72c29ceb911?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/1de8c33a-043a-4568-aa9b-a72c29ceb911?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/1de8c33a-043a-4568-aa9b-a72c29ceb911?feedback_type=other)</sup>
Author
Owner

@fdb02983rhy commented on GitHub (Mar 26, 2025):

Claude had a similar issue previously. I fixed it by reconstructing the tool config.

@fdb02983rhy commented on GitHub (Mar 26, 2025): Claude had a similar issue previously. I fixed it by reconstructing the tool config. - https://github.com/langgenius/dify/issues/16103 - https://github.com/langgenius/dify-official-plugins/pull/484 <img width="947" alt="Image" src="https://github.com/user-attachments/assets/057a3fe6-77d7-4e5a-92e0-ff4c373aed8b" />
Author
Owner

@sergedoub commented on GitHub (Mar 26, 2025):

Thanks for answering, I was hoping I'd hear from you since you helped build it. But can you please explain what you mean by:

reconstructing the tool config

is that something I can resolve on my own?

@sergedoub commented on GitHub (Mar 26, 2025): Thanks for answering, I was hoping I'd hear from you since you helped build it. But can you please explain what you mean by: > reconstructing the tool config is that something I can resolve on my own?
Author
Owner

@fdb02983rhy commented on GitHub (Mar 26, 2025):

You can see my PR

@fdb02983rhy commented on GitHub (Mar 26, 2025): You can see my PR - https://github.com/langgenius/dify-official-plugins/pull/484 I think Dify change the way that how it transform the parameters in the tool yaml file, which cause this issue. You may fix it by modifying openai's llm.py file in the plugin package.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#12188