New Tool Radar

AI Agents & Automation

How to Give an n8n AI Agent an HTTP Request Tool for Live Data

Attach an HTTP Request tool to an n8n AI Agent node so the agent fetches live data from an API instead of guessing from its training.

Schematic diagram with three steps: Attach HTTP Request tool, Set the allowed URL, then Ask a live-data question.

A chat model without tools can only answer from what it already knows, so it guesses dates, prices and statuses. An HTTP Request tool lets the n8n agent fetch the live value from an API you control, and the answer can then quote the fetched result.

Before you start

You need a working n8n AI Agent node and one public API you control or are allowed to call, with its base URL and any key it needs. Keep the tool to one base URL: an agent with a wide-open HTTP tool can be talked into calling other addresses.

Attach the tool and describe exactly what it returns

On the AI Agent node, attach an HTTP Request tool sub-node and set its URL to the API endpoint. Write the tool description as a contract: what the endpoint returns, which fields matter, and what it must never be used for. The model only sees the tool name and description when it decides, so a vague description produces wrong calls. Add the tool to the system message too, with one line saying when to call it.

Test with a question whose answer changes

Ask a question whose correct answer comes only from the API, for example the status of a named order or the current value in a named record. Check the execution log to confirm the tool was called with the right address, then check the reply quotes the returned value. If the agent answers without calling the tool, the system message needs a firmer rule, such as never stating a live status without calling the tool first.

Worked example: A fictional parcel tracker on one API endpoint

Maple Parcels is a fictional delivery firm. Its agent checks parcel status through one HTTP endpoint. Three test questions show when the tool should run.

Test question Tool call Expected reply
Where is parcel MP-1042? GET the parcel endpoint for MP-1042 Quotes the status the API returned for MP-1042
What is the weather today? None Says it cannot check the weather, because no weather tool is attached
Where is parcel MP-1042 and MP-1043? Two calls, one per parcel Quotes both statuses, one per parcel

Expected result (UNTESTED): the parcel questions each produce one HTTP call per parcel in the execution log, and the replies quote the API values. We checked the n8n AI Agent documentation, which describes tools as sub-nodes the agent chooses between, but we did not run the calls on a live n8n instance.

Limits

An HTTP tool can only return what the API returns, and it adds latency and a failure point to every answer. Do not give it an API key with write access unless the agent is supposed to change data, and never let it call an address outside the allow-list you set. If the API is down, the agent needs an instruction for what to say instead of inventing a status.

Sources

See all