Tool Guide · Automation
n8n Guide
The definitive guide to n8n for AI workflows — self-host vs cloud, agent nodes, LLM chaining, code escape hatches, and when to pick it over Zapier or Make.
Key takeaways
- 1Visual workflow canvas with 400+ integrations and growing
- 2Native AI agent nodes — tool loops, memory, and multi-step LLM reasoning
- 3LangChain-style chains — prompt → model → parser → next step without leaving the canvas
- 4Code nodes — JavaScript and Python escape hatch for custom logic
- 5Sub-workflows — reusable RAG, triage, and enrichment pipelines
- 6Self-hostable — Docker, Kubernetes, or n8n Cloud managed
- 7Webhook triggers — turn any HTTP call into an automation entry point
- 8Execution logs per node — debug AI failures step by step
- 9Credentials vault — API keys stored encrypted, referenced by nodes
- 10Community nodes — extend with custom connectors including emerging MCP patterns
Best for
- AI agent workflows with tool use, retries, and branching
- Self-hosted automations where data must stay in your VPC
- High-volume runs (50k+/month) where Zapier task pricing hurts
- Complex multi-step pipelines — fetch → classify → LLM → CRM write-back
- Teams comfortable with light DevOps (Docker, env vars, backups)
- Prototyping automations before dropping to full code
Not for
- Non-technical teams that need zero setup — use Zapier
- Connect Gmail to Notion in 20 minutes — Zapier is faster
- Sub-100ms latency requirements — use code
- Git-versioned logic with unit tests — use a real codebase
- Teams allergic to maintaining a server
What it is
n8n is open-source workflow automation — a visual canvas where you connect triggers, actions, and logic into pipelines. Think Zapier, but you can self-host it, write code inside flows, and chain LLMs with real agent loops.
In 2026, n8n's differentiator for AI builders is the AI agent node: tool use, memory, retries, and multi-step reasoning without leaving the no-code canvas. That's why it anchors the AI Automation Engineer Roadmap.
Self-host vs n8n Cloud
| Self-host | n8n Cloud | |
|---|---|---|
| Cost | VPS (~$10–40/mo) + your time | ~$20/mo+ per execution tiers |
| Data | Stays in your VPC | n8n's infrastructure |
| Ops | You manage Docker, Postgres, backups | Zero |
| Scale | Limited by your server | Managed scaling |
| Best for | AI-heavy, high-volume, compliance | Fast start, small teams |
Self-host quick path: Docker Compose with Postgres, set N8N_ENCRYPTION_KEY, expose behind HTTPS, back up the database weekly. Production checklist lives in n8n docs.
When Cloud makes sense: you're validating an automation idea, team has no DevOps appetite, or volume is under ~5k runs/month.
Core concepts
Triggers
Every workflow starts with a trigger: webhook, schedule (cron), email, form submission, or app event. For AI pipelines, webhooks and schedules are the workhorses — ingest data on demand or run batch jobs nightly.
Nodes
Each step is a node: HTTP request, Slack message, OpenAI chat, code block, IF branch. Data flows left-to-right (or top-to-bottom); each node's output becomes the next node's input.
AI-specific nodes
- LLM Chain — linear prompt → model → output. Good for classification, summarization, extraction.
- AI Agent — loop with tools. The model decides which tool to call, observes the result, continues until done. This maps directly to how agents work in code.
- Vector store / memory nodes — persist context across agent steps for RAG-style workflows.
Code nodes
When the visual layer isn't enough, drop a Code node (JavaScript or Python): sanitize PII, transform JSON, call an undocumented API, implement custom routing. This is n8n's killer feature vs Zapier — you're never truly stuck.
Sub-workflows
Extract a reusable chunk (e.g., "embed document → store in Qdrant → retrieve top-k") into a sub-workflow. Call it from multiple parent flows. Keeps complex canvases readable.
Building your first AI workflow
A proven starter pattern — support ticket triage:
- Trigger: Webhook or Zendesk/Intercom node on new ticket.
- Code node: Strip PII if sending to external LLM.
- LLM Chain: Classify category + urgency (JSON output).
- IF node: Route by category.
- AI Agent: Search knowledge base, draft reply for high-confidence cases.
- Action: Update CRM, post to Slack for human review on low confidence.
Full walkthrough: Support Ticket Triage workflow.
n8n vs Zapier vs Make
Don't re-read a full comparison here — see n8n vs Zapier vs Make. The one-line version:
- n8n — AI agents, self-host, code escape hatches.
- Zapier — 8,000 integrations, fastest setup.
- Make — complex visual branching without self-host ops.
Pick n8n when AI logic is the hard part. Pick Zapier when integrations are the hard part.
Pairing with other tools
| Need | Pair with |
|---|---|
| Cheap classification model | Gemini Flash via HTTP node |
| Local/private inference | Ollama — point HTTP node at localhost:11434 |
| Custom tools for agents | MCP server or custom HTTP endpoints |
| RAG knowledge base | Self-hosted Qdrant/Pinecone + embed step in sub-workflow |
For MCP-native tool access beyond HTTP wrappers, you'll often drop to code or custom community nodes — see MCP Explained.
Production tips
- Version your workflows — export JSON to git. n8n doesn't give you PR-based review out of the box; treat exports as source of truth.
- Separate credentials per environment — dev/staging/prod API keys in n8n's credential vault, never hardcoded in nodes.
- Add error workflows — n8n can trigger a fallback flow on failure (alert Slack, retry with backoff).
- Log LLM inputs/outputs — execution logs help, but ship traces to your observability stack for production. See LLM Observability.
- Rate-limit webhooks — public webhook URLs get scanned. Add auth headers or IP allowlists.
- Test with real data — pin 10 representative inputs and run manually before enabling the schedule.
When to graduate from n8n
Signs you've outgrown the canvas:
- Flows exceed 40 nodes and nobody can read the diagram.
- You need git-native CI, unit tests, and typed interfaces.
- Latency budget is under 200ms end-to-end.
- You're building a product feature, not an internal automation.
Graduate to Python/TypeScript with Temporal, Inngest, or a plain API. Keep n8n for ops glue the team maintains without deploys.
The practical answer
Start with n8n Cloud and one real workflow — ticket triage, weekly intel, or email classification. Learn agent nodes on something that saves you time this week.
If volume or compliance pushes you to self-host, migrate when the math works — not before you've shipped workflow #1.
Pros and cons
Pros
- Best-in-class AI agent nodes among no-code platforms in 2026
- Self-host removes per-task pricing cliff at scale
- Code nodes mean you never hit a hard ceiling on logic
- Open source — inspect, fork, audit, air-gap
- Strong execution debugging — see exactly which LLM step failed
- Active community and AI workflow templates
Cons
- Smaller integration library than Zapier (~400 vs 8,000)
- Self-hosting means you own uptime, updates, and secrets rotation
- UI gets cluttered on flows with 30+ nodes
- n8n Cloud pricing can approach Make/Zapier at moderate volume
- Steeper learning curve than Zapier for non-engineers
- MCP support still emerging — often needs custom HTTP or code nodes
Real workflows using this tool
Support Ticket Triage
Classify tickets, draft replies, route to the right team — classic n8n AI agent pattern.
Open
Competitive Intel Monitor
Scheduled scraping, LLM synthesis, weekly briefing — cost stays flat on self-host.
Open
AI Email Assistant
Gmail triage pattern — adaptable to n8n with IMAP or Gmail nodes.
Open
MCP Server from API
When n8n isn't enough for tool-native agents, drop to MCP — n8n handles the glue around it.
Open
Prompt examples
Copy any of these, replace the placeholders, run.
LLM classification node system prompt
You classify incoming support tickets into exactly one category.
Categories: billing, technical, feature_request, account, other
Output JSON only:
{"category": "<category>", "confidence": 0.0-1.0, "summary": "<one sentence>"}
If unsure, use "other" and confidence below 0.6.Agent node task description
You are a support triage agent. For each ticket:
1. Read the ticket subject and body.
2. Search the knowledge base tool for relevant articles.
3. Draft a reply if confidence is high; otherwise flag for human review.
4. Update the CRM with category and priority.
Never promise refunds or policy exceptions — escalate those.Code node — sanitize before LLM
// Strip PII before sending to external LLM API
const text = $input.first().json.body;
const sanitized = text
.replace(/\b[\w.-]+@[\w.-]+\.\w+\b/g, '[EMAIL]')
.replace(/\b\d{3}[-.]?\d{3}[-.]?\d{4}\b/g, '[PHONE]');
return [{ json: { sanitized, original_length: text.length } }];Alternatives
Frequently asked questions
Watch
Hand-picked videos from official + trusted channels. Opens in a new tab.
- n8nOfficial
n8n AI agent tutorials
Official walkthroughs of agent nodes, LLM chains, and self-host setup.
- n8nOfficial
n8n LangChain agent workflow
See a full agent loop built on the canvas without writing orchestration code.
- n8nOfficial
Self-hosting n8n with Docker
Production self-host checklist — env vars, Postgres, backups.
Related on AIKnowHub
Comparison
n8n vs Zapier vs Make for AI
An honest comparison of the three dominant automation platforms for AI workflows — integrations, agent nodes, pricing, and when to pick each.
Concept
AI Agents Explained
Agents are LLMs that can take actions in a loop. Here's what that actually means, where they shine, and where they fall over.
Concept
MCP Explained
The Model Context Protocol is the USB-C of AI tooling. Here's what it is, why it matters, and how to think about it.
Workflow
Build a Competitive Intel Monitor
A weekly agent that tracks competitors — pricing, features, launches, hiring, and positioning — and delivers a cited briefing to Slack or email.
Workflow
Build Support Ticket Triage + Draft Reply
An automation that classifies incoming tickets, routes them, pulls account context, and drafts replies your agents review before sending.
Learning Path
AI Automation Engineer Roadmap
Become the person who turns manual workflows into AI-powered automations. Highly hireable, instantly useful.