An AI agent in n8n is four nodes on a canvas: a trigger, the AI Agent node, a chat model, and at least one tool. That is the whole skeleton. The model decides which tools to call, n8n runs them, and a setting called Max Iterations caps that loop. Unlike a simple LLM node that takes input and returns output once, the AI Agent node gives the model a list of tools and lets it decide which ones to call, in what order, looping until the task is complete. This post builds that skeleton step by step, explains the settings that matter, and covers the two traps that catch almost everyone: a model too small to call tools, and an agent with the keys to everything.
If n8n itself is new to you, it is a workflow automation platform with a visual editor: triggers start a run, nodes do the work, and credentials are stored encrypted. Our Web3 DevOps explainer covers the same automation thinking for infrastructure work. This post assumes you can open n8n and want the agent specifics.
The skeleton: trigger, agent, model, tool
The AI Agent node is a root node: it does nothing on its own. You plug sub-nodes into the connectors along its bottom edge, and each one gives it a different ability. Start with a trigger: a Chat Trigger if you want to test in the chat panel, or a Webhook if a website or another system will call it. Add the AI Agent node after the trigger and write the system message: the agent's role, what it may do, and what it must never do. Then attach a chat model sub-node, such as the OpenAI Chat Model or the Anthropic Chat Model, with a credential holding the API key. Finally, attach at least one tool sub-node: the docs are plain that the agent must have at least one tool connected. Useful first tools are the HTTP Request Tool for calling an API, the Calculator, a web search tool, and the Call n8n Workflow Tool, which lets one workflow become a tool another agent can call. For a chat agent, add a memory sub-node too: Simple Memory for testing, or Postgres or Redis chat memory for anything that has to survive a restart. Every message to the Chat Trigger executes the workflow, so a conversation of ten messages uses ten executions: that is how n8n counts the work, and it is the number to watch on the Cloud plans.
The one setting that matters: Max Iterations
Inside the node, the agent runs a Reasoning and Acting loop: the model produces a thought, selects an action, observes the result, and repeats until it has enough information to produce a final answer. The loop runs inside the AI Agent node, so you do not wire it up yourself. Max Iterations caps that loop at 10 runs by default. Set it too low and a multi-step job stops half done. Set it too high and a confused agent can burn through tool calls and executions before it gives up. Ten is a sane default for a first agent: raise it only when you have seen the agent stop at the cap on a job it should have finished. One more version fact to know before you copy an old tutorial: the AI Agent node arrived in n8n 1.19.0 in August 2024, the agent-type dropdown was deprecated in version 1.82.0, and every AI Agent node now works as a Tools Agent. If a template shows a Conversational Agent or ReAct Agent setting, it is from an older version of the node, and the docs say that version will be removed in n8n 3.0.
The model trap: small models cannot call tools
The most common reason a first agent fails has nothing to do with n8n: the model cannot produce valid tool-call JSON. For agent workflows backed by Ollama, use a model with strong tool-calling support, such as llama3.3:8b or qwen2.5:14b. Smaller models under 7 billion parameters often fail to produce valid tool-call JSON, which breaks the agent loop entirely. The same rule holds for hosted models: a small, cheap model that is fine for summarization may be unable to drive tools at all. If your agent returns empty replies, calls the wrong tool, or loops without progress, change the model before you rebuild the workflow. And if you want the agent to run on your own hardware, our Ollama guide covers running those models locally, including the memory each size needs.
Security: an agent is a credential with opinions
An agent that can call tools is a credential that decides for itself, so give it the smallest set of tools and permissions that does the job. A support agent that only reads order status should not also have a tool that refunds orders. A triage agent that reads logs should not have a tool that restarts services unless a human approves first: n8n has a human-approval pattern where the workflow pauses and waits for a response in Slack before it acts, and any destructive step deserves that pause. Keep n8n itself patched, too. The latest n8n security batch is from 28 October 2026, 12 advisories with 3 rated High, and the fixes are in 1.123.89 and 2.45.5 stable. Check your version string against the advisory page before you put an agent in front of real users, because an agent on an unpatched instance is two problems at once. Start with one read-only agent, watch its first hundred runs, and only then give it a tool that changes anything. If you want an agent wired into your own systems, with the credentials scoped and the approvals in place, book a free infra audit with DevOpsBY. We build n8n automation for startups and creators, and the difference between a demo agent and a production one is the guardrails around it.
Disclaimer: This post is educational only, not financial advice. Figures are as reported by the sources on 2026-11-12 and may change - always confirm version numbers, requirements, and dates in the official docs before acting on them.
