A practical, beginner-friendly walk-through: from an empty canvas to an AI agent that remembers the conversation and uses real tools.
Everyone is talking about AI agents, but most explanations stay abstract. In practice, an AI agent is simply a language model that can decide which actions to take: look something up, call an API, write to a spreadsheet, then answer. n8n lets you build one visually, without writing a backend.
This tutorial is for small-business owners, operations people and freelancers who know the basics of n8n (or are willing to learn them) and want a first agent that does something useful. No machine-learning knowledge is needed.
By the end, you will have an agent that chats with you, remembers the conversation, uses a tool to look up real data, and follows clear rules about what it may and may not do.
A normal n8n workflow follows a fixed path: trigger, step 1, step 2, done. An AI agent is different. You give it a goal, a set of tools and some rules, and the model decides at runtime which tools to use, in what order, and when it has enough information to answer.
That flexibility is useful when the input is unpredictable. Good first use cases:
When the steps are always the same (for example "every new form submission goes to the CRM"), you do not need an agent. A classic workflow is cheaper, faster and more predictable. Use an agent when the decision of what to do next depends on what the user says.
The AI nodes in n8n are documented in the official advanced AI docs. Node names change slightly between versions, so if something looks a little different in your editor, check there.
The finished workflow is small: a trigger, the AI Agent node, and three sub-nodes plugged into the agent (a chat model, memory and a tool). Here is how to build it.
Create a new workflow and add the Chat Trigger node. It gives you a chat window inside the editor so you can talk to your agent while you build it. Later, you can make the chat public (n8n gives you a hosted chat page or an embeddable widget) or replace the trigger with WhatsApp, Telegram, Slack or a Webhook.
Leave the defaults for now. Each message you type becomes an item with a chatInput field (the text) and a sessionId (which conversation it belongs to).
Add an AI Agent node after the trigger. This is the "brain" that coordinates everything. Key settings:
{{ $json.message }}.The AI Agent node has connectors at the bottom for Chat Model, Memory and Tool. A chat model is required; the others are optional but make the agent far more useful.
Click the Chat Model connector and add OpenAI Chat Model (or Anthropic, Google Gemini, Mistral, etc.). Create a credential with your API key, then pick a model from the list.
For a first agent, a smaller, cheaper model is usually enough for simple lookups. Move to a larger model if you see it choosing the wrong tool or misunderstanding instructions. Keep the temperature low (for example 0.2 to 0.4) if you want consistent, factual answers.
Without memory, every message is a fresh start: ask "What about Saturday?" and the agent has no idea what you were talking about. Click the Memory connector and add Simple Memory (called Window Buffer Memory in older versions).
Simple Memory lives inside the n8n instance and is fine for testing. For production, especially if you run n8n in queue mode with several workers, use a persistent store such as Postgres Chat Memory or Redis Chat Memory.
Click the Tool connector and add the Calculator tool. It needs no configuration. Language models are notoriously unreliable at arithmetic, so a calculator is a simple way to see tool use in action. Ask "What is 17.5% of 2,340?" and open the execution log: you will see the agent decide to call the calculator, receive the result, then answer.
Now give the agent access to real data. Add a Google Sheets tool on the Tool connector, connect your Google credential, choose the operation Get Row(s), and select a spreadsheet, for example a price list with columns Service, Price and Duration.
Give the tool a clear description. The agent reads this description to decide when to use the tool, so be specific: "Use this to look up the current price and duration of a service. Returns all services." Vague descriptions are the most common reason an agent ignores a tool.
If you want the model to fill in a filter value itself (such as a service name), n8n lets you mark a parameter as defined by the model, which inserts a $fromAI() expression. For a small sheet, returning all rows is simpler and works well.
The system message is the agent's job description. A clear one prevents most problems. Here is a template for a small hair salon that you can adapt:
You are the booking assistant for Studio Lina, a hair salon. Your job: - Answer questions about services, prices and opening hours. - Always use the "price list" tool to check prices. Never guess a price. - Use the calculator for any arithmetic. Rules: - Keep answers short: 2-3 sentences. - If you do not know something or the tool returns nothing, say so and suggest calling the salon at the number on our website. - Do not give medical advice about scalp or skin conditions. - Reply in the language the customer writes in. Opening hours: Tuesday-Saturday, 9:00-19:00. Closed Sunday and Monday.
Notice the pattern: who it is, what it should do, which tools to use for what, what to do when it does not know, and the fixed facts it can rely on. Static facts that rarely change can live in the system message; anything that changes often should come from a tool.
Run this on your own n8n, without the DevOps
AutomateSpot deploys a ready-to-use n8n server for you in minutes: SSL, backups and updates handled, so you can focus on building workflows.
Deploy n8n in minutesOpen the chat panel and try questions in three groups:
After each test, open the execution and look at the agent's steps. n8n shows which tool was called, with which input, and what came back. This is how you debug an agent: not by guessing, but by reading what it actually did.
Once it behaves well in the test chat, decide where people will use it:
Remember to activate the workflow. An inactive workflow only runs while you test it in the editor.
There are two cost components:
Practical limits to keep in mind: models can still make mistakes, so do not let an agent take irreversible actions (refunds, deletions, sending money) without a human check. Large tool outputs, such as a whole spreadsheet with thousands of rows, can exceed the model's context or get expensive; filter data before handing it to the agent. For more ways to keep AI usage affordable, see cost-effective AI automation with n8n.
Once your first agent works, the natural next steps are giving it more tools (an HTTP Request tool to call your own APIs, a database tool, or a sub-workflow as a tool), switching to persistent memory, and connecting it to the channel your customers or team already use. If you want ideas for other AI workflows, our overview of AI automation workflows in n8n is a good starting point.
An n8n AI agent is a trigger, an AI Agent node, a chat model, memory and a few well-described tools. The hard part is not the wiring; it is a clear system message, good tool descriptions and honest testing.
Start small with one useful tool, read the executions, and expand only when the basics are reliable.