Tavily as tool for AI Agent via HTTP Request node

Hi. In my workflow for simple company research, I want to give the agent access to Tavily. The http request node is triggered when the workflow runs but I get the error “Bad request - please check your parameters”.

Under query parameters I’ve set name and value to " Defined automatically by the model" but not sure what to do with the variable in the body (see screenshot). None of the inputs on the left seem suitable.

How do I give the agent the ability to make use of Tavily as and when needed?

Thanks for your help!


Hi @lebato3216, welcome to community!
Anyway, would you like to embed your workflow here?
You can add the workflow by following this example

Now added - thanks @cutecatcode!

It’s because you’re trying explicitly defining the query from $parameters.
I think you can try to change the {{ $parameters.query }} to {{ $fromAI("parameters0_Value", ``, 'string')}}

Aha, thanks! Looks better and tried a few variations but now get “Your request is invalid or could not be processed by the service”. Any ideas?

**
{

“errorMessage”: “Your request is invalid or could not be processed by the service”,

“errorDetails”: {},

“n8nDetails”: {

“time”: “18/07/2025, 18:20:07”,

“n8nVersion”: “1.97.1 (Self Hosted)”,

“binaryDataMode”: “default”,

“cause”: {

“message”: “Your request is invalid or could not be processed by the service”,

“timestamp”: 1752859207444,

“name”: “NodeApiError”,

“description”: “Input should be a valid dictionary or object to extract fields from”,

“context”: {

“request”: {

“body”: “{\n "query": Uptempo company run by Scott Ernst official website and background,\n "search_depth": "basic",\n "include_answer": true,\n "include_images": false,\n "include_raw_content": false\n}”,

“headers”: {

“content-type”: “application/json”,

“authorization”: “hidden”,

“accept”: “application/json,text/html,application/xhtml+xml,application/xml,text/;q=0.9, image/;q=0.8, /;q=0.7”

},

“method”: “POST”,

“uri”: https://api.tavily.com/search,

“gzip”: true,

“rejectUnauthorized”: true,

“followRedirect”: true,

“resolveWithFullResponse”: true,

“followAllRedirects”: true,

“timeout”: 300000,

“qs”: {

“query”: “Uptempo company run by Scott Ernst official website and background”

},

“encoding”: null,

“json”: false,

“useStream”: true

}

},

“cause”: {

“message”: “422 - "{\"detail\":[{\"type\":\"model_attributes_type\",\"loc\":[\"body\"],\"msg\":\"Input should be a valid dictionary or object to extract fields from\",\"input\":\"{\\n \\\"query\\\": Uptempo company run by Scott Ernst official website and background,\\n \\\"search_depth\\\": \\\"basic\\\",\\n \\\"include_answer\\\": true,\\n \\\"include_images\\\": false,\\n \\\"include_raw_content\\\": false\\n}\"}]}"”,

“name”: “AxiosError”,

“stack”: “AxiosError: Request failed with status code 422\n at settle ([/usr/local/lib/node_modules/n8n/node_modules/.pnpm/[email protected]/node_modules/axios/lib/core/settle.js:19:12)\n](mailto:/usr/local/lib/node_modules/n8n/node_modules/.pnpm/[email protected]/node_modules/ax[…LINKS…]”,

“code”: “ERR_BAD_REQUEST”,

“status”: 422

}

}

}

}

I don’t get the error, try to update the n8n (Mine use latest version)

Sorry, only picking up now. I’m on the latest version now and it helped- got a step further. With the replacement code you proposed, I now see this (see screenshot) when I try to run the research agent node. What did you put there? :folded_hands:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.