How to Build AI Agents with n8n: From Simple Chatbot to Autonomous Agent
Most tutorials show you one AI agent and stop. In practice, agents come in levels — and each level unlocks a new class of tasks. Build them in order: every stage reuses the previous one’s nodes, so nothing you wire up goes to waste.
Level 1: The prompt chatbot (15 minutes)
Nodes: Chat Trigger → AI Agent (with an LLM model attached, no tools, no memory).
This is a personality over an API: a support-tone assistant or a brainstorming partner. Its limits teach you the fundamentals — system prompts, model selection (GPT-4o for tool-calling reliability, Claude for reasoning-heavy answers, Ollama for private local runs), and temperature settings. Ship this first to validate that anyone actually uses the thing before investing further.
Level 2: Give it hands with tools (the real “agent” moment)
A model that only outputs text is a chatbot. Connect tool sub-nodes to the AI Agent and it becomes an agent:
- HTTP Request Tool for your internal APIs (“how many leads today?” → live CRM query).
- Calculator / Code Tool for arithmetic LLMs famously flub.
- Gmail, Slack, Calendar tools so answers turn into actions, not just words.
Write tool descriptions like documentation: the model decides when to call a tool based on its name and description, so “Fetches open support tickets from Zendesk created in the last N days” beats “ticket tool.” Test each tool in isolation before attaching it — half of all “agent is dumb” complaints are actually broken tool configs.
Level 3: Add memory so it holds a conversation
Attach Window Buffer Memory (last 10–20 messages) for chat continuity. When conversations get long or span sessions, upgrade:
- Redis or Postgres memory persists context across executions and restarts.
- Summarization memory compresses old turns so you don’t blow the context window on long threads.
Rule of thumb: buffer memory for demos and short chats, persistent memory for anything customer-facing.
Level 4: Ground it with RAG, then let it loop
Connect a vector store tool (Pinecone, Qdrant, Supabase pgvector) loaded with your docs. Now the agent retrieves before it answers — support replies cite your help center instead of hallucinating. This retrieval + tools + memory combination is what people mean by an autonomous agent: it plans multi-step work (search docs → query API → draft reply), observes each result, and repeats until done.
Two guardrails before production:
- Output parsers force structured JSON so downstream nodes never choke on prose.
- Human-in-the-loop approval (a Slack button or form) on any action that spends money, contacts customers, or deletes data.
Learn faster from working agents
Each level above maps to real templates you can inspect node by node. Browse the free n8n AI agent templates — import a Level 2 tool-agent or a Level 4 RAG setup, run it with pinned test data, and adapt its prompts and tools to your stack. Starting from a working agent compresses weeks of trial and error into an afternoon.