Create an AI Agent with n8n: The Step-by-Step Guide
You build an AI agent in n8n from four building blocks: trigger, chat model, memory and tools. The guide with practical tips and common mistakes.
You build an AI agent in n8n from four building blocks: a trigger that starts the agent, a chat model as the brain, a memory for conversation context, and tools with which the agent can actually do something. The AI Agent Node connects these parts, entirely without programming. This guide walks through building a first productive agent and shows the points where beginners typically get stuck. As of: July 2026.
What you need beforehand
- An n8n instance: Cloud account or self-hosted, both work. For company data we recommend self-hosting on German servers.
- An API key for a chat model: for example OpenAI or Anthropic. Anyone who does not want to give data to US providers can connect local models with Ollama, more on that below.
- A clearly defined use case: an agent that is supposed to do everything ends up able to do nothing. Good first cases: pre-sorting requests, answering questions from a knowledge base, preparing appointments.
Step 1: Set up the trigger and the AI Agent Node
Create a new workflow and choose the Chat Trigger as the starting point if you want to chat with the agent, or a webhook if other systems are meant to address it. Behind it, place the AI Agent Node. It is the control center: everything else is not chained in sequence but docked below the Agent Node, and this is what visually and logically distinguishes agents from normal n8n workflows.
Step 2: Connect the chat model
Dock a model onto the agent's chat model connector, for example OpenAI or Anthropic, and store the credentials. Practical rule for choosing a model: a cheap model is enough for tool calls and routine answers, and the expensive class is only worthwhile for complex trade-offs. The model choice can be changed at any time later, so start cheap and measure.
Step 3: Add memory
Without memory, the agent forgets what was discussed after every message. Simple Memory is enough for initial tests, while Postgres Memory is recommended for production so the context survives a restart. The most common beginner mistake lies exactly here: the memory needs a session key that is unique per conversation partner. If the agent is used via a webhook, you must set this key yourself from the incoming data, otherwise conversations get mixed up or the history stays empty.
Step 4: Connect tools so the agent can act
Only with tools does the chatbot become a digital employee. Almost anything n8n can do works as a tool: a database query, a search of your documents via a vector store, sending an email, a dedicated sub-workflow. Describe each tool in one sentence precisely enough that the model understands what it is for, because the agent decides whether to use it based on this description. For critical actions such as sending or deleting, build in human approval: n8n comes with human-in-the-loop patterns for this, and this is exactly what takes decision-makers' fear of autonomous AI away.
Step 5: Write and test the system prompt
In the Agent Node, you store the system instruction: who the agent is, what it may do, what it should never do, and in which language and tone it responds. Write it like a work instruction for a new temporary staff member, concrete and with examples. Then test it in the chat window with real cases from your everyday work, not with made-up questions, and check the execution view: there you see every tool decision the agent makes and immediately recognize if a tool description was ambiguous.
Common mistakes from practice
- Agent instead of chain: if the process is always the same, for example summarizing text and filing it, you do not need an agent, a simple LLM chain is faster and cheaper. Agents only pay off once the model itself has to decide which tool to use.
- Too many tools: more than five to seven tools dilute the hit rate. Better to have several specialized agents than one jack-of-all-trades.
- No eye on the costs: every agent run means several model calls. Set a limit from the start and monitor consumption.
Where AI agents really save time in operations and what a productive use case looks like is shown in our overview AI Agents. If you would rather have the agent built for you while keeping control: that is exactly what our Have an AI Agent Built at a fixed price is for.
Frequently asked questions about creating AI agents
Can I create an AI agent without programming knowledge?
Yes, in n8n an AI agent is created entirely visually: trigger, chat model, memory and tools are connected by drag-and-drop, and the logic sits in the system instruction in everyday language. Programming knowledge only helps with special cases, such as custom data formats or special interfaces.
What does running an AI agent cost?
The ongoing costs consist of the model calls and hosting. An internal agent with moderate use is often in the low double-digit euro range per month in model costs, while self-hosted n8n on a German server costs only a few euros in server costs. It only gets expensive with uncontrolled loops, which is why limits belong in from the start.
Can the agent run with local AI models, without the cloud?
Yes, n8n connects local models via Ollama, so no text leaves your premises. Expect two limitations: local models need decent hardware, and they are noticeably more error-prone at tool calling than the large API models. For sensitive data, the compromise is often a European API model plus clear data rules in the system prompt.
How do I recognize that my use case is suitable for an agent?
A use case is suitable for an agent if the task requires real decisions between several tools, for example looking something up first and then answering or forwarding depending on the result. If the process always runs the same way, a classic automation with a single AI step is enough, which is faster, cheaper and easier to control.
NordFlux UG (haftungsbeschränkt)
NordFlux builds digital employees for organisations: automations and AI agents that take over repetitive work. You stay in control.
Concrete questions about automation or AI?
In a free initial analysis we discuss your case directly. No strings attached.