Pro11 min
AI Agents That Use Tools
A classic automation follows a fixed path you designed. An AI agent decides the path itself: given a goal and a set of tools, it chooses which tool to call, reads the result, and decides what to do next, looping until the job is done. n8n's AI Agent node and the major model APIs all support this pattern now.
The agent loop
- The model receives the goal and the list of available tools.
- It decides whether to answer directly or call a tool.
- The tool runs and returns a result into the context.
- The model reads the result and either calls another tool or finishes.
Tools are just functions you expose to the model with a clear name, description, and input schema. A tool might query your database, send an email, or call another API. The agent picks among them based on your descriptions, so write those descriptions like instructions.
n8n - AI Agent with tools
[ Chat Trigger ] --> [ AI Agent (Claude Sonnet 4.6) ]
|- tool: searchOrders
|- tool: getOrderStatus
|- tool: issueRefund
|- tool: escalateToHuman
tool definition
{
"name": "getOrderStatus",
"description": "Look up the current status of one order by its id. Use when the user asks where their order is.",
"input_schema": {
"type": "object",
"properties": {
"orderId": { "type": "string", "description": "Order id like A-4471" }
},
"required": ["orderId"]
}
}Pick the model for the job
Use a strong reasoning model like Claude Opus 4.8 or GPT-5 for tricky multi-tool planning, and a fast cheaper one like Claude Sonnet 4.6 or Gemini 2.5 Pro for high-volume routing. Many production agents use a big model to plan and a small one to execute.
Give dangerous tools a guard
An agent that can issue refunds or delete records needs limits: a max amount, a confirmation step, or a human approval gate. Never expose an irreversible action to an autonomous loop without a brake.