AI & Automation 10 min read

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.

Umer Hasan

Umer Hasan

Co-Founder & CTO at Zapprex

n8n AI Agent Tutorial: Build an AI Support Agent With Tools, Memory and Human Approval
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.

At a glance: Step 3: Give the agent tools — Knowledge base, Order lookup, Create ticket, Call another workflow
At a glance: Step 3: Give the agent tools

Step 1: Set up the trigger and model

Step 1: Set up the trigger and model: 4 steps
  1. 1

    Add a trigger: use the Chat Trigger for testing in n8n’s chat panel, or a Webhook / WhatsApp trigger for production.

  2. 2

    Add the AI Agent node: connect it to the trigger.

  3. 3

    Connect a Chat Model: add the model sub-node for your chosen LLM provider and add its API credential.

  4. 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. 1

    Do not give the agent a refund tool directly: instead, give it a request_refund tool that calls a sub-workflow.

  2. 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. 3

    Wait for the response: use n8n’s wait or human-in-the-loop features so the workflow pauses until the manager responds.

  4. 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.”

— Umer Hasan, CTO
  • 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

n8n AI AgentAI AutomationLangChainAI Support Agent
Umer Hasan
Written by

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.

FAQ

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.

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