n8n Deep-Dive — Visual Agent Automation
In 4.3 you met the idea of wiring tools without code. Now we go deep on the tool the agent-builder community loves most: n8n. Same anatomy — but with a real AI Agent node that packs the whole loop, tools, and memory into a single box.
🎯 By the end you'll understand
What n8n is and why it's a favourite for agentic automation, its core node families (triggers, action nodes, flow-control, and the AI nodes), how the AI Agent node wraps everything from Stage 2 into one box, how to modularize with sub-workflows, how n8n speaks MCP, how credentials and human-approval nodes keep you safe — and the honest line between when n8n wins and when code wins.
KEY INSIGHTThe one idea to take away
n8n's AI Agent node is the entire Stage 2 agent — the loop, the tools, the memory — folded into a single box on a canvas. You stop wiring the loop by hand and start configuring it.
In Lesson 4.3 the "AI step" was a fixed brain you dropped into a pipe. n8n takes that further. It gives you a proper AI Agent node with sockets underneath it — plug in a chat model, plug in tools, plug in a memory store — and the node runs the act → observe → decide loop you studied in Lesson 2.1 for you. The rest of n8n is the plumbing that feeds it (triggers), routes it (flow-control), and lets it touch the world (actions). One canvas, hundreds of integrations, and the agent loop is a node you assemble.
n8n's UI will keep changing — menu names, panel layouts, the exact look of the AI Agent node. Don't memorize pixels. Memorize the durable structure: a workflow is nodes connected by wires; a trigger starts it; an AI Agent node is loop + model + tools + memory; deterministic nodes do the irreversible work. Learn that and any version of n8n reads like a map you already own.
DEFINITIONWhat n8n actually is
n8n (pronounced "n-eight-n," short for nodemation) is an open-source, self-hostable workflow automation platform. Like Zapier and Make (which you met in 4.3), you build automations by connecting boxes on a visual canvas. But n8n earned its place in the agent-builder's toolbox for a few specific reasons:
- Open-source & self-hostable. You can run it on your own server. Your workflows, your data, your credentials — not locked inside someone else's cloud. (There's a paid hosted cloud too, if you'd rather not run servers.)
- Truly node-based and flexible. Where Zapier nudges you toward simple linear "zaps," n8n exposes branching, looping, merging, and a raw Code node for when you need to drop into JavaScript or Python. It sits closer to code than its rivals.
- A huge integration library. Hundreds of pre-built app connectors (Gmail, Slack, Notion, databases, Stripe…) plus a generic HTTP Request node that can call any API on earth. If a service has an API, n8n can talk to it.
- First-class AI nodes. This is the big one. n8n added native LLM nodes and a dedicated AI Agent node — so you're not bolting AI onto a dumb pipe, you're building real agents on the canvas.
An open-source, self-hostable automation platform where you build workflows as graphs of connected nodes. Notable for deep flexibility (branching, loops, raw code), a large integration library, and native AI Agent nodes that turn a workflow into an agent.
FRAMEWORKThe core node types
Everything in n8n is a node — a single box that does one job, wired to the next by a connection. There are only four families to learn, and once you know them you can read any workflow on the canvas.
| Node type | What it does | Example |
|---|---|---|
| ⚡ Trigger | Starts the workflow. Every workflow needs exactly one to run. | Webhook, Schedule, Gmail Trigger (new email), new row added |
| 🛠️ Action / Regular | Does work: calls an app, transforms data, runs code. The "hands." | HTTP Request, Gmail · Send, Set (shape data), Code (JS/Python) |
| ⑂ Flow-control | Decides where data goes and how it's grouped or repeated. | IF, Switch, Merge, Loop / Split in Batches |
| 🧠 AI nodes | Add intelligence: a model, a full agent, tools, memory, retrieval. | Chat Model, AI Agent, Tool nodes, Memory, Vector Store |
A quick tour of each family, with the config-level detail — what you actually put into the box:
Trigger nodes
The spark. A Webhook gives you a URL another app pings; a Schedule runs on a cron ("every weekday 8am"); an app-event trigger fires on "new email," "new row," "new Stripe payment." You configure which account and which event. No trigger, the workflow never runs.
Action / regular nodes
The doers. HTTP Request calls any API (you fill in URL, method, headers, body). App nodes like Gmail · Send expose friendly fields (to, subject, body). Set reshapes data; the Code node lets you write raw JavaScript or Python when no node fits. These are deterministic: same input, same behaviour.
Flow-control nodes
The routing. IF splits two ways on a true/false test; Switch splits many ways; Merge rejoins branches; Loop / Split in Batches runs a set of items one chunk at a time (handy for rate limits). This is how one workflow handles every situation, not just one.
AI nodes
The brains. A Chat Model node points at an LLM (you pick the provider/model and credential). The AI Agent node runs the loop. Tool nodes are capabilities the agent can call. A Memory node remembers the conversation. A Vector Store node powers retrieval (the RAG idea from Lesson 2.4).
Most wires flow left→right, carrying data from one step to the next. But the AI nodes use a second kind: things like the chat model, tools, and memory plug into the AI Agent node from underneath as attachments, not as the next step. Spotting that "plugged in from below" shape is the fastest way to recognise an agent on an n8n canvas.
CORE CONCEPTThe AI Agent node is Stage 2 in a box
Here's the payoff for everything you learned in Stage 2. Remember the formula from Lesson 1.1: an agent is an LLM + tools + a loop, pointed at a goal. The n8n AI Agent node is exactly that formula, wrapped in a single configurable box. Look at what you plug into it:
- A Chat Model — the LLM "brain" that reasons at each step (1.3). You attach one model node.
- Tools — the "hands" from 2.2. Each tool you attach (a calculator, an HTTP call, a sub-workflow, an MCP server) becomes an action the agent can choose to call.
- Memory — so it remembers earlier turns of the conversation (2.3).
- A system prompt & goal — the instructions that point it at the task.
And the part you don't wire by hand: the loop (2.1). Inside the node, the agent reads the goal, decides whether to call a tool, calls it, observes the result, and repeats — until it has an answer. In 4.3 you had to imagine that loop running between your boxes. In n8n the loop lives inside the AI Agent node. You configure it; n8n runs it.
AI Agent node = the Chat Model (brain) + attached Tools (hands) + Memory + the loop, all in one box, pointed at your system prompt (goal). Every Stage 2 concept becomes a socket you fill in.
PRACTICALWhat an agentic workflow looks like
Let's draw the canonical build we'll keep returning to: a new support email arrives → an AI Agent classifies it and drafts a reply → if it's urgent, route to a human for approval → send. Here is the node graph, with the AI Agent's attachments plugged in from below:
Read it as a sentence: "When a support email arrives, the AI Agent — using its model, its lookup tools, and the thread's memory — classifies it and drafts a reply. The IF node checks if it's urgent: if so, pause for a human to approve before the Gmail Send node fires; if routine, send straight away." That single shape covers a huge slice of real business automation.
SEE ITBuild an n8n workflow
Now assemble it yourself. Toggle nodes on in order to grow the workflow — and attach the AI Agent's brain, tools, and memory. Watch the node graph fill in and the readout describe what your workflow does, with a safety note. The order matters: an agent with no model can't think; a Send with no approval before it is risky.
CORE CONCEPTSub-workflows: the n8n way to modularize
As a workflow grows, one giant canvas becomes the "haunted house" we warned about in 4.3 — impossible to read or debug. n8n's answer is the sub-workflow: a workflow you can call from another workflow, like calling a function.
You wrap a chunk of logic — say, "look up a customer and enrich their record" — into its own workflow with an Execute Sub-workflow Trigger. Then, from a main workflow, an Execute Sub-workflow node calls it, passes data in, and gets a result back. The detail stays hidden in the child; the parent reads cleanly.
Recognise the shape? It's the orchestrator → worker pattern from Lesson 5.2 and Lesson 5.3. A main "orchestrator" workflow can call several specialised "worker" sub-workflows — each a focused agent. And because a sub-workflow can be attached to an AI Agent node as a tool, the agent itself can decide to invoke a worker. Sub-workflows are how you build modular, multi-agent systems on one canvas without the spaghetti.
CONTEXTMCP in n8n — joining the standard tool ecosystem
Back in Lesson 2.8 you met MCP (the Model Context Protocol) — the "USB-C for tools," a standard way for agents to discover and call tools without bespoke wiring for each one. n8n speaks MCP on both sides of the wire:
- n8n as an MCP client. There's an MCP Client Tool node you attach to an AI Agent. Point it at any MCP server and that server's tools instantly become tools your agent can call — no custom integration needed. The whole standard tool ecosystem becomes available to your n8n agent.
- n8n as an MCP server. There's also an MCP Server Trigger. It exposes your n8n workflows as MCP tools, so an external agent (Claude, a coded agent, another platform) can call your n8n automations through the standard protocol. Your carefully-built workflow becomes a reusable tool for the wider world.
MCP support means n8n isn't an island. It plugs into the same standard tool layer everything else is converging on (2.8). You can consume tools the community already built, and publish your workflows for others to consume — visual automation and the coded agent world, speaking one language.
PRACTICALCredentials & human-approval nodes
To let a node touch Gmail, Stripe, or your database, you store a credential in n8n — a saved login or API token the node uses to act on your behalf. This is power, and it deserves the two safety habits from across the course.
- Least privilege. Scope every credential to the minimum the workflow needs. If a node only sends email, don't hand it a token that can read and delete your entire mailbox. A self-hosted n8n holds these credentials on your server — good for control, but it means securing that server is now your job.
- Human-approval before irreversible actions. n8n has a Wait / human-approval pattern: the workflow pauses, sends you a notification (or shows an approve/reject form), and resumes only when a person responds. Place it before anything you can't undo — sending to a customer, charging a card, deleting records. This is the trust gradient from Lesson 3.4 made into a node.
A stored credential lets the workflow act without you watching. If an AI Agent mis-classifies one email and it's wired straight into Gmail · Send, a wrong reply lands in a real customer's inbox — and you cannot un-send it. Treat "send," "delete," "pay," and "post publicly" as irreversible. Scope credentials tightly, and gate every irreversible action behind a human-approval node until dozens of correct runs have earned your trust.
COMPARISONWhen n8n shines vs when code wins
n8n is brilliant, but it's not always the right answer. You met the no-code limits in 4.3 and crossed to code in Lesson 5.4. Here's the honest split:
| Reach for n8n when… | Reach for code when… |
|---|---|
| You're gluing many SaaS apps together (Gmail, Slack, Sheets, Stripe). | Your logic is genuinely complex — many edge cases, tricky transforms. |
| You need scheduled or triggered automations running unattended. | You need tight control over the loop, retries, and prompts. |
| You want visual debugging — seeing data flow node-to-node, inspecting each step. | You want version control, tests, and code review on the agent itself. |
| You want to ship fast without a developer. | You're hitting node limits, fighting the canvas, or need a tool nobody built. |
WEAKNESSCommon mistakes to avoid
Connecting a credential with read-write-delete over your whole Gmail or database "to be safe" is the opposite of safe. One bug or one bad agent decision now has the keys to everything. Scope every credential to the narrowest permission the workflow actually needs (3.4).
Wiring the AI Agent straight into Gmail · Send with no Wait / approval node feels efficient — until it mis-judges one email and fires a wrong reply you can't recall. Gate every irreversible action behind a human approval until many correct runs have earned trust (3.4).
Some logic — nested edge cases, intricate data transforms, careful retry rules — turns into a tangle of a dozen IF and Switch nodes that's harder to read than ten lines of code. When the canvas fights you more than it helps, drop into a Code node or move that piece to real code (5.4).
KEY INSIGHTWhere this connects in your course
- No-code: connecting tools (4.3) — the trigger → AI step → action anatomy; n8n is that anatomy made deep, with a real AI Agent node.
- The agent loop & tools (2.1, 2.2) — exactly what the AI Agent node wraps: loop + model + attached tools + memory.
- MCP (2.8) — n8n can be an MCP client (consume tools) and an MCP server (expose workflows). The standard tool layer.
- Human approval & the trust gradient (3.4) — the Wait node before irreversible sends.
- Agentic automation (3.10) — the agent decides, deterministic nodes execute.
- Multi-agent patterns (5.2, 5.3) — sub-workflows give you orchestrator → worker on a canvas.
- Build it in code (5.4) — the other side of the choice; when to graduate past visual.
- Agents + automation together (5.6) — next, where code agents and n8n workflows combine into one system.
Hold the durable structure — trigger → AI Agent (model + tools + memory) → flow-control → action, with approval before the irreversible — and any version of n8n, and any visual automation tool, will read like a language you already speak.
GLOSSARYKey terms introduced
- n8n
- An open-source, self-hostable visual automation platform where workflows are graphs of connected nodes; notable for flexibility and native AI Agent nodes.
- Node
- A single box on the canvas that does one job (trigger, action, flow-control, or AI), wired to others by connections.
- Trigger
- The node that starts a workflow — a webhook, a schedule, or an app event like "new email." Every workflow needs one.
- AI Agent node
- An n8n node that runs the full agent loop. You attach a chat model (brain), tools (hands), and memory; it decides and acts until done. Stage 2 in a box.
- Sub-workflow
- A workflow callable from another workflow (like a function), used to modularize logic and build orchestrator → worker multi-agent systems.
- Credential
- A stored login or API token an n8n node uses to act on a connected app on your behalf; scope it to least privilege.
- MCP client
- n8n acting as a consumer of MCP servers — attaching an MCP Client Tool node so an agent can call standard external tools.
- Human-approval node
- A Wait-style node that pauses the workflow until a person approves — placed before irreversible actions like sending or charging.
ACTIVE RECALLCheck your understanding
Answer in your own words first, then reveal.
1What does the n8n AI Agent node wrap, and which part don't you wire by hand?›
2Name the four families of n8n nodes and one example of each.›
Triggers (Webhook, Schedule, Gmail Trigger), action/regular nodes (HTTP Request, Gmail Send, Set, Code), flow-control (IF, Switch, Merge, Loop / Split in Batches), and AI nodes (Chat Model, AI Agent, Tools, Memory, Vector Store).