Quick Takeaway
To build an AI agent in n8n, start a workflow with the Chat Trigger node, add the AI Agent node, and attach three kinds of sub-nodes: a chat model (such as OpenAI Chat Model), Simple Memory so it remembers the conversation, and at least one tool it can use. Add human review to any tool that changes real data.
Key takeaways
- An n8n AI agent is a cluster of nodes: the AI Agent root node plus sub-nodes for the chat model, memory and tools.
- n8n requires at least one tool on an AI Agent node; the agent decides which tool to call to finish a task.
- The System Message is where you set the agent’s job, limits and tone; Max Iterations (default 10) caps how many attempts it makes.
- n8n’s human review step makes the agent wait for your approval in chat, Slack, Gmail and other channels before a chosen tool runs.
- Every chat message runs the workflow once, so a 10-message conversation uses 10 executions on n8n Cloud.
“AI agent” sounds complicated, but in n8n it is a small set of nodes you connect on the canvas. This tutorial builds a practical one for a small business: a chat assistant that answers questions about your services and can book a call, but has to ask a person before it sends anything to a customer. Every node name and setting below comes from n8n’s documentation, checked in November 2026.
New to n8n? Start with n8n for beginners, then come back. Not sure whether you need an agent at all? Read AI chatbot vs AI agent first: many jobs only need a simple workflow.
- AI agent (in n8n)
- In n8n, an AI agent is the AI Agent node connected to a chat model and one or more tools. In n8n’s words, “the agent decides which tools to call to complete a task”, instead of following a fixed path you designed.
How is an n8n AI agent put together?
n8n builds agents from cluster nodes: “a root node and one or more sub-nodes that extend the functionality of the node.” The AI Agent node is the root; everything it needs plugs into it as a sub-node.
| Part | n8n node | What it does | Required? |
|---|---|---|---|
| Trigger | Chat Trigger | Starts the workflow when someone sends a chat message | For a chat agent, yes |
| Brain | AI Agent | Reads the message, decides what to do, calls tools | Yes |
| Model | OpenAI Chat Model (or Anthropic, Groq, Mistral and others) | The language model the agent thinks with | Yes |
| Memory | Simple Memory | Keeps recent messages so the conversation makes sense | Optional |
| Tools | HTTP Request, Call n8n Workflow, Google Calendar, Gmail and more | Actions the agent can take | At least one |
No more “agent type” choice
Older tutorials ask you to pick an agent type. n8n deprecated that setting in version 1.82.0: every AI Agent node now works as a Tools Agent. If you see an old v1 node, n8n advises updating to the latest version.
How do you build the agent, step by step?
Step 1: Add a Chat Trigger
Create a new workflow and add the Chat Trigger node. Leave “Make Chat Publicly Available” turned off while you build; n8n’s docs recommend exactly that. You can test the chat right from the editor.
Step 2: Add the AI Agent node
Connect the AI Agent node after the trigger. With the default prompt setting, it takes the user’s message from the trigger automatically.
Step 3: Attach a chat model
Plug a chat model sub-node into the agent, for example OpenAI Chat Model, and add your OpenAI credentials. On n8n Cloud, the docs say you can choose “Use Gateway credits” to run it without your own OpenAI account.
Step 4: Attach Simple Memory
Add the Simple Memory sub-node so the agent remembers earlier messages. Its “Context Window Length” sets how many previous interactions it considers. Memory does not persist between sessions.
Step 5: Give it tools
Attach at least one tool. For our example: Google Calendar to check free slots, Gmail to send a confirmation, and Call n8n Workflow to reuse a workflow you already have (such as “add lead to CRM”).
Step 6: Write the System Message
In the AI Agent node options, write the System Message: who the agent is, what it may and may not do, and what to do when unsure. This is the single biggest factor in how well it behaves.
Step 7: Add human review to risky tools
Require approval for any tool that changes real data or contacts a customer, such as Gmail. The steps are in the next section.
Step 8: Test, then publish
Chat with it in the editor, try awkward questions, check what each tool call did, then publish the workflow and decide whether to make the chat public or embed it on your site.
You are the booking assistant for Acme Plumbing.
Answer questions using only the services and prices listed below.
If you are not sure, say so and offer to pass the question to a person.
You may check the calendar and suggest times.
Before sending any email, wait for a team member to approve it.
Never promise prices, dates or results that are not listed here.
Services: ...How do you make the agent ask before it acts?
This is the step most tutorials skip, and the one that makes an agent safe for a real business. n8n’s docs: “You can require human approval before an AI Agent executes a specific tool.” When the agent wants to use that tool, the workflow pauses and a reviewer chooses Approve (the tool runs with the AI’s input) or Deny (the action is canceled).
- Open the AI Agent node’s Tools connector and find the “Human review” section.
- Choose the approval channel: Chat, Slack, Discord, Telegram, Microsoft Teams, Gmail, WhatsApp Business Cloud, Google Chat or Microsoft Outlook.
- Connect only the risky tools to the review step (for example Gmail), or all tools if you prefer.
- Show the reviewer what will happen: the $tool.name and $tool.parameters variables put the tool and its inputs into the approval message.
- Tell the agent in its System Message that some actions wait for approval, so it explains the pause to the customer.
A good default
Let the agent read freely (check a calendar, look up a price) and require approval for anything that writes or sends (emails, CRM changes, refunds). You keep the speed of automation and the judgment of a person.
Which settings matter most?
| Option | What it does | Our advice |
|---|---|---|
| System Message | Guides the agent’s decision-making | Spell out the job, limits and when to hand over to a person |
| Max Iterations | How many times the model may run to reach an answer (default 10) | Keep the default unless runs fail on complex tasks |
| Return Intermediate Steps | Includes the steps the agent took in the output | Turn on while testing to see why it chose each tool |
| Require Specific Output Format | Connects an output parser for structured results | Use when another node needs fixed fields, such as name and email |
| Enable Streaming | Sends the reply word by word (on by default) | Needs a Chat Trigger set to a streaming response mode |
What does an n8n AI agent cost to run?
Two things: n8n executions and the AI model. n8n’s Chat Trigger docs warn that every message runs the workflow, so “one conversation where a user sends 10 messages uses 10 executions.” The model is billed separately by its provider, or through n8n’s Gateway credits on Cloud. Our n8n pricing guide shows how executions map to plans, and you can self-host n8n to avoid execution limits.
What should you watch out for?
- Give each tool only the access it needs, using credentials made for the agent, not your admin account.
- Keep the chat private until you have tested it with real questions, including attempts to make it break its rules.
- If you run n8n in queue mode, note that Simple Memory “doesn’t work in an active production workflow”; use a database-backed memory instead.
- A Call n8n Workflow tool fails in production if the workflow it calls is not published.
- Review conversations weekly at first and tighten the System Message where the agent guessed.
n8n AI agents: common questions
Do I need to code to build an AI agent in n8n?
No. You connect nodes on the canvas and write the System Message in plain English. Code is only needed for unusual integrations, and n8n’s HTTP Request tool covers most apps with an API.
Which AI models can an n8n agent use?
n8n’s Tools Agent docs list chat models including OpenAI, Anthropic, Groq, Mistral Cloud and Microsoft Foundry. You connect one as a sub-node of the AI Agent node.
Does an n8n AI agent need memory?
Not always. Memory lets users have an ongoing conversation; without it, each message is answered on its own. For a chat assistant, attach Simple Memory.
Can an n8n agent take actions without asking?
Yes, by default it calls tools on its own. Use n8n’s human review step to require approval for chosen tools, so actions such as sending email wait for a person.
What is the difference between an AI agent and a normal n8n workflow?
A normal workflow follows the exact path you designed. An agent decides which tools to call based on the message. Use a workflow when the steps are always the same, and an agent when the request varies. Our guide on agentic AI vs AI automation covers the trade-off.
Can WikiAI build an n8n AI agent for us?
Yes. We build AI agents on n8n with limited tool access and human approval for important actions, connected to your calendar, CRM and email.