◇ n8n · automation · workflows
What n8n is, how its node-based workflows actually work, how to wire in LLMs and AI agents, and why teams self-host it.
beginner · 30 min
n8n (pronounced “n-eight-n”) is a workflow automation tool: you wire together apps, APIs and logic on a visual canvas instead of writing glue code by hand. Think Zapier or Make — but source-available and self-hostable, so your data and credentials stay on your own infrastructure.
It is fair-code licensed: free to self-host, the full source is open, and it ships 400+ ready-made integrations plus an escape hatch to raw code whenever the visual nodes aren’t enough.
A workflow is a graph of nodes. Each node receives data, does one thing, and passes data on. Data travels between nodes as a list of items — plain JSON objects — so the output of one node is the input of the next.
Master three words and n8n clicks: node (a step), item (one JSON record flowing through), connection (the wire that carries items).
Every workflow begins with a trigger node. The common ones:
Everything after the trigger is action and logic nodes that run in order for each incoming item.
Three families cover almost everything you’ll build:
IF, Switch, Merge, Filter, Set/Edit Fields,
Loop Over Items, Aggregate.You map data between nodes with expressions — JavaScript inside {{ }}:
{{ $json.email }} // a field on the current item
{{ $json.items.map(i => i.name).join(", ") }} // transform inline
{{ $node["Webhook"].json.body.query }} // pull from another node
{{ $now.minus({ days: 7 }).toISODate() }} // built-in date helpers$json is the current item, $node[...] reaches any earlier node, and helpers
like $now save you from date math. This is where “no-code” quietly becomes
“a little code”.
n8n ships first-class AI nodes (built on LangChain). The base building block is a Chat Model node feeding an LLM Chain:
Chat Model (claude-opus-4-8) → LLM Chain → parsed output → next nodeSo any workflow can summarise, classify, extract or rewrite — mid-pipeline, right next to your Slack and database nodes.
The AI Agent node is where it gets powerful: give a model tools and memory, and it decides which tools to call to finish a task.
A “tool” is just another n8n node the agent is allowed to use. That turns n8n into an agent runtime with real-world side effects, not just a chat box.
Retrieval-Augmented Generation drops straight into a workflow. (New to RAG? See RAG Fundamentals.)
Ingest docs once (embed → vector store), then give the agent a retriever tool. n8n supports Qdrant, Pinecone, Supabase and Postgres/pgvector out of the box — so a private, self-hosted RAG bot is a weekend, not a quarter.
A “summarise my inbox” bot, end to end:
{{ $json.subject }} and {{ $json.body }} into the prompt.IF on the urgency tag.The trade-off: you run the infrastructure. For anyone who values control and privacy over a fully managed SaaS, that’s the point — not the price.
What makes the n8n AI Agent node more than a chatbot?
{{ }}) map data — no-code with a code escape hatch.