Currently, when using the HTTP Request Tool
for an AI Agent
there seems to be a hardcoded max timeout of 5 minutes, which sometimes is not enough time for the HTTP request to complete (especially when chaining to other LLM calls).
Similar to the HTTP Request
node, it would be wonderful if there were an option that allows you to specify a timeout override on a per tool basis.
Thanks!
It looks like this fix is a matter of exposing the same timeout
param as defined in the top-level HTTP Request
node that’s mentioned here:
}
if (proxy) {
requestOptions.proxy = proxy;
}
if (timeout) {
requestOptions.timeout = timeout;
} else {
// set default timeout to 5 minutes
requestOptions.timeout = 300_000;
}
if (sendQuery && queryParameterArrays) {
Object.assign(requestOptions, {
qsStringifyOptions: { arrayFormat: queryParameterArrays },
});
}
const parametersToKeyValue = async (
accumulator: { [key: string]: any },
cur: { name: string; value: string; parameterType?: string; inputDataFieldName?: string },
Into the same requestOptions
object within the HTTP Request Tool
definition, as listed here:
"Only alphanumeric characters and underscores are allowed in the tool's name, and the name cannot start with a number",
},
);
}
const toolDescription = this.getNodeParameter('toolDescription', itemIndex) as string;
const sendQuery = this.getNodeParameter('sendQuery', itemIndex, false) as boolean;
const sendHeaders = this.getNodeParameter('sendHeaders', itemIndex, false) as boolean;
const sendBody = this.getNodeParameter('sendBody', itemIndex, false) as boolean;
const requestOptions: IHttpRequestOptions = {
method: this.getNodeParameter('method', itemIndex, 'GET') as IHttpRequestMethods,
url: this.getNodeParameter('url', itemIndex) as string,
qs: {},
headers: {
// FIXME: This is a workaround to prevent the node from sending a default User-Agent (`n8n`) when the header is not set.
// Needs to be replaced with a proper fix after NODE-1777 is resolved
'User-Agent': undefined,
},
body: {},
// We will need a full response object later to extract the headers and check the response's content type.