Your first n8n workflow with an AI Agent node: chat, model, memory and tools
This guide walks through the parts of a first AI chat workflow in n8n, using only n8n's own docs as read on October 16, 2026. Nothing here is a hands-on test, and we haven't built this exact workflow ourselves.
Not affiliated with or endorsed by n8n GmbH. Check n8n's current docs before relying on these details.
Our tool page: n8n. Comparing n8n with code-first frameworks? See n8n, CrewAI or LangGraph.
Before you start: the basics of a workflow
If you've never built any n8n workflow, start with n8n's Build your first workflow guide. It says n8n gives you two ways to start a workflow: "Manually, by selecting Execute Workflow" (checked Oct 2026), or "Automatically, using a trigger node as the first node" (checked Oct 2026).
You'll also need credentials for your AI model. n8n describes credentials as "securely stored authentication information used to connect n8n workflows to external services such as APIs, or databases" (checked Oct 2026). The first-workflow guide adds: "You should be careful about sharing or revealing the credentials outside of n8n." (checked Oct 2026)
Our advice, not a vendor quote: never paste an API key into a prompt, a Code node or a workflow you share. Keep it in n8n's credentials. More in keep secrets safe with AI coding tools.
The pieces of an AI chat workflow
1. Chat Trigger: where messages come in
n8n's Chat Trigger docs say: "Use the Chat Trigger node when building AI workflows for chatbots and other chat interfaces." (checked Oct 2026) And: "You must connect either an agent or chain root node." (checked Oct 2026)
Two settings matter for safety:
- Make Chat Publicly Available. n8n says: "Leave this turned off while you're building the workflow. Turn it on when you're ready to publish the workflow and allow users to access the chat." (checked Oct 2026)
- Authentication. With None, "The chat doesn't use authentication. Anyone can use the chat." (checked Oct 2026) The other options are Basic Auth and n8n User Auth.
n8n also warns: "Every message to the Chat Trigger executes your workflow." (checked Oct 2026)
Our advice, not a vendor quote: keep the chat private until you've tested it, and add authentication before you share the link with anyone.
2. AI Agent node: the decision-maker
The AI Agent node docs say: "Connect a chat model and one or more tools, and the agent decides which tools to call to complete a task." (checked Oct 2026) There's one hard rule: "You must connect at least one tool sub-node to an AI Agent node." (checked Oct 2026)
n8n's page on what agents do explains the difference from a chain: "Where a chain follows a predetermined sequence of calls to different AI components, an agent uses a language model to determine which actions to take." (checked Oct 2026) It also notes: "When you execute a workflow containing an agent, the agent runs multiple times." (checked Oct 2026)
If you follow an older tutorial, note this from the AI Agent docs: "The AI Agent node's agent type setting is deprecated from n8n 1.82.0. All AI Agent nodes now work as a Tools Agent" (checked Oct 2026).
3. A chat model
The chat model is the AI model the agent uses, connected as a sub-node. n8n's AI overview says you can "connect different LLM providers such as OpenAI, Anthropic, and Google" (checked Oct 2026). Each provider needs its own credential.
4. Memory: so it remembers the conversation
From n8n's memory page: "The memory keeps a history of previous messages, allowing for an ongoing conversation with the AI, rather than every interaction starting fresh." (checked Oct 2026) For a first workflow, Simple Memory "stores a customizable length of chat history for the current session. This is the easiest to get started with." (checked Oct 2026)
5. Tools: what the agent can do
n8n's tools page says: "Tools act like addons that your AI can use to access extra context or resources." (checked Oct 2026) Among them are the "Custom Code Tool: write code that your agent can run" (checked Oct 2026) and the "HTTP Request Tool: make calls to fetch a website or data from an API" (checked Oct 2026).
Our advice, not a vendor quote: start with one read-only tool. Every tool you add is something the model can decide to use, and text from users or websites can try to steer it. See prompt injection safety.
Make risky tools wait for you
n8n supports human review for tools: "You can require human approval before an AI Agent executes a specific tool." (checked Oct 2026) The reviewer can approve, so "The tool executes with the input specified by the AI" (checked Oct 2026), or deny, so "The action is canceled and doesn't run." (checked Oct 2026)
n8n lists when it helps, including "Tools perform irreversible actions: Deleting data, sending external communications, or making purchases." (checked Oct 2026) It also says: "Make sure you include the tool setup and human review steps in your system prompt." (checked Oct 2026)
Our advice, not a vendor quote: put every tool that sends, changes or deletes something behind human review on your first build.
Test it before anyone else uses it
n8n's pin and mock data page says data pinning means "saving the output data of a node and using the saved data instead of fetching fresh data in future workflow executions" (checked Oct 2026). It adds: "Data pinning isn't available for production workflow executions." (checked Oct 2026)
For AI steps, n8n's evaluation docs say: "AI models are fundamentally different than code. Code is deterministic and you can reason about it. This is difficult to do with LLMs, since they're black boxes." (checked Oct 2026) For an early build: "In the initial building phase, it often makes sense to generate just a handful of examples." (checked Oct 2026)
Our advice, not a vendor quote: write five or so test messages, including one that asks the agent to ignore its instructions, and run them before you turn on public access.
A first-build checklist
Our advice, not a vendor quote:
- Chat Trigger with public access off while you build.
- AI Agent node with one chat model, Simple Memory and one read-only tool.
- API keys only in n8n credentials.
- Human review on any tool that sends, changes or deletes.
- A handful of test messages, run before you go public.
- Authentication on before you share the chat.
Not affiliated with or endorsed by n8n GmbH. Check n8n's current docs before relying on these details.