n8n AI Agent Tutorial: Build an AI Support Agent With Tools, Memory and Human Approval
Use n8n’s AI Agent node to build a support agent that answers from your knowledge base, looks up orders in Google Sheets or your API, remembers the conversation and asks a human before issuing refunds.

Table of contents
How AI agents work inside n8n
n8n includes AI nodes built on LangChain concepts. The AI Agent node receives a message, uses a connected chat model to reason, calls connected tools when needed, and can keep conversation memory. You connect sub-nodes to it: a Chat Model, a Memory and one or more Tools.

Step 1: Set up the trigger and model

- 1
Add a trigger: use the Chat Trigger for testing in n8n’s chat panel, or a Webhook / WhatsApp trigger for production.
- 2
Add the AI Agent node: connect it to the trigger.
- 3
Connect a Chat Model: add the model sub-node for your chosen LLM provider and add its API credential.
- 4
Write the system message: “You are the support assistant for Acme Store. Answer using the tools. Never promise refunds without approval. Keep replies short.”
Step 2: Add memory
Without memory, every message is a fresh conversation. Connect a memory sub-node — Simple Memory for testing, or a Postgres or Redis chat memory for production — and use a session key such as the customer’s phone number so each customer gets their own history. Keep a window of the last 10–20 messages to control cost.
Step 3: Give the agent tools
- Knowledge base: a Vector Store tool connected to your FAQs and policies, so answers are grounded in your content.
- Order lookup: a Google Sheets tool or HTTP Request tool that searches orders by order ID or phone number.
- Create ticket: an HTTP Request tool to your helpdesk or CRM for issues the agent cannot solve.
- Call another workflow: a workflow tool that runs a separate n8n workflow — useful for multi-step actions with their own validation.
Tip: Write clear tool descriptions such as “Look up an order by order ID. Input: order_id like ORD-1234.” The model chooses tools based on these descriptions.
Step 4: Add human approval for risky actions
- 1
Do not give the agent a refund tool directly: instead, give it a request_refund tool that calls a sub-workflow.
- 2
In the sub-workflow, send an approval message: post the order, amount and reason to a manager on Slack, email or WhatsApp with Approve and Reject options.
- 3
Wait for the response: use n8n’s wait or human-in-the-loop features so the workflow pauses until the manager responds.
- 4
Act on the decision: process the refund through your payment gateway API only if approved, then notify the customer.
Step 5: Test, monitor and control cost
“Let the agent read freely, but make it ask before it spends money or changes customer records.”
- Test conversations: try normal questions, missing order IDs, angry customers and attempts to make the agent ignore its rules.
- Limit iterations: set a maximum number of agent steps so a confused agent cannot loop.
- Log outcomes: store each conversation, tools used and whether it was resolved or escalated.
- Watch token usage: shorter system prompts, memory windows and smaller models for simple tasks reduce cost.
Topics
Umer Hasan
Co-Founder & CTO at Zapprex
Leads engineering, cloud infrastructure and AI automation at Zapprex Technologies, with 7+ years of full-stack and mobile experience.
Keep reading
All articlesWhat Are AI Agents? A Beginner’s Guide to Tools, Memory, Planning and Guardrails
AI agents explained without the hype: how an agent differs from a chatbot, the reason–act loop, tool calling, memory, when to use one, and how businesses keep agents safe with human approval and limits.
n8n Tutorial for Beginners: Automate Website Leads to Google Sheets and WhatsApp
Learn n8n from zero: install it with Docker or n8n Cloud, understand triggers, nodes and expressions, then build a real workflow that saves website leads to Google Sheets and alerts your team on WhatsApp.
Make.com Tutorial for Beginners: Scenarios, Modules, Routers and Your First Automation
Learn Make.com (formerly Integromat) step by step: scenarios, triggers, modules, mapping, filters, routers, iterators and error handlers — then build an automation that turns form leads into CRM records and WhatsApp alerts.
Questions readers ask
n8n supports several major LLM providers through chat model nodes, as well as self-hosted models via compatible endpoints. Choose based on quality, cost and where your data may be processed.
Yes. Trigger the agent from WhatsApp messages through the WhatsApp Business Platform and send its replies back via the WhatsApp node, using the phone number as the memory session key.
Consider custom code when you need very high volume, strict latency, complex permissions, deep testing pipelines or tight integration with your own product.
Have a project in mind?
Let's build something that moves your business forward.
Share your idea, process or problem — we will come back with a clear plan, timeline and cost range. No technical spec needed.
- Founder reply within 1 business day
- NDA on request · 100% code ownership
- Talk directly to the engineers
