Lesson 218·M22 AI Automation
n8n
OpenLearning Objectives
By the end of this lesson you should be able to:
- Explain n8n: nodes, triggers, and the AI node (L218)
- Explain the AI node: models inside a workflow (L163)
- Explain the fit: integration-heavy workflows, fast to build (L217)
- Explain the limits: complex state, branching, custom logic (L230)
- Decide n8n vs a custom build (L230)
One-Line Definition
n8n is the open-source workflow tool — visual workflows of nodes (the steps, L217), triggers (L220), and integrations (L223–227), with an AI node (L163) that calls models inside the pipeline — the fastest implementation of the L217 unit for integration-heavy, standard-shaped workflows (L230), self-hosted (L288), and bested by a custom build where state, branching, or custom logic outgrow nodes (L230).
The one-sentence interview answer: "n8n is the open-source workflow platform (L218). A workflow is a canvas of nodes: trigger nodes (L220) start it, integration nodes (L223–227) touch the systems, and the AI node (L163) calls a model — extract, classify, draft — inside the pipeline (L217). It's self-hosted (L288), has 400+ integrations, and is extensible with custom nodes (L230). The fit: integration-heavy workflows with standard shapes — trigger, extract, gate, post — built in hours (L217). The limits: complex state (L207), heavy branching (L215), and custom logic where code beats nodes (L230). My rule: n8n for the integration-heavy standard shapes (L230); a custom build — the L217 runner plus the L230 platform — when the workflow outgrows nodes (L230)."
Mental Model
Think of n8n as a visual wiring board — the L217 assembly line, drawn. Each node is a station on the line (L217): the trigger node is the start button (L220), the integration nodes are the connections to the outside world (L223–227), the AI node is the model station (L163), and the IF node is the fork (L230). You wire the stations by dragging and connecting — the skeleton (L199) is visible on the canvas. The board is great for standard lines (L230) — and when the line needs custom machinery (complex state, L207), you build that part yourself (L230).
the visual board (n8n, L218)
┌──────────────┐ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ trigger │ → │ AI node │ → │ IF / branch │ → │ integration │
│ (L220) │ │ (L163) │ │ (L230) │ │ (L227) │
└──────────────┘ └──────────────┘ └──────────────┘ └──────────────┘
the canvas — the L217 skeleton, drawn and wired
The mental model is the wiring board: the workflow (L217) as a visible canvas of nodes — fast to build, self-hosted, and bested by code when the line gets custom (L230).
Visual Flow — A Workflow in n8n
the canvas (L218)
│
▼
┌──────────────────────────────────────────────────────────┐
│ 1 · TRIGGER NODE (L220) │
│ webhook · schedule · email — what starts the line │
└──────────────────┬───────────────────────────────────────┘
▼
┌──────────────────────────────────────────────────────────┐
│ 2 · AI NODE (L163) │
│ the model call — extract, classify, draft — with │
│ the prompt and the schema (L143) │
└──────────────────┬───────────────────────────────────────┘
▼
┌──────────────────────────────────────────────────────────┐
│ 3 · THE BRANCH (L230) │
│ IF / switch nodes route by the AI output │
└──────────────────┬───────────────────────────────────────┘
▼
┌──────────────────────────────────────────────────────────┐
│ 4 · INTEGRATION NODES (L223-227) │
│ the CRM, the email, the database — the world │
└──────────────────────────────────────────────────────────┘
The flow is the canvas: trigger → AI → branch → integrate — the L217 unit, drawn as nodes (L218).
How It Works — The Nodes, the AI, the Fit, the Limits
- The nodes (L218). A workflow is a canvas of nodes: trigger nodes (L220), integration nodes (L223–227), logic nodes (IF, switch, L230), and the AI node (L163). Each node is a step with a contract (L217) — input, transform, output (L163).
- The AI node (L163). The model call inside the workflow: a prompt, a model, and a schema (L143) — extract, classify, summarize, draft (L163). The AI node is the L163 station on the L217 line (L218).
- The fit (L230). Integration-heavy workflows with standard shapes — trigger, extract, gate, post — built in hours (L217): the visual canvas (L218), the 400+ integrations (L223–227), and self-hosting (L288). The fastest L217 implementation for the standard line (L230).
- The limits (L230). Complex state (L207), heavy branching (L215), and custom logic where code beats nodes (L230): a long-running workflow with checkpoints (L207), a graph-shaped flow (L215), or business logic beyond IF nodes (L230) — those are the custom build's territory (L230).
Note
n8n is a tool for the L217 unit — not the L230 platform's replacement (L230). The senior rule: n8n implements the workflow (L217) — the standard-shaped line — beautifully (L218). But the platform (L230) — the events (L220), queues (L222), approval gates (L228), and recovery (L232) — is an architecture that n8n supports but doesn't replace (L230). The decision is by shape: standard workflows, integration-heavy → n8n (L218); custom state, branching, or scale → the custom build (L230). The tool follows the architecture, not the other way around (L230).
Real Project Usage
- Lead enrichment (L223). Trigger: a CRM lead (L223). AI: enrich the company (L163). Post: back to the CRM (L223). Built in n8n in an hour (L218).
- Invoice extraction (L163). Trigger: the invoice email (L224). AI: extract the fields (L163). Validate: the totals. Post: the ledger (L217).
- Support triage. Trigger: the ticket webhook (L220). AI: classify (L163). Route: the IF node (L230). Send: the queue (L222).
- Content pipelines. Trigger: the draft. AI: summarize (L206). Gate: the human approval (L228). Publish: the CMS (L227).
- Anything standard-shaped (L230). The canvas builds the standard line in hours (L218) — the custom machinery is where n8n ends (L230).
The through-line: n8n is the fastest L217 implementation for the standard line — and the senior call is knowing when the line outgrows the canvas (L230).
Interview Explanation
Say it in four moves:
- The platform. "n8n — open-source workflow tool: a canvas of trigger (L220), integration (L223–227), and AI nodes (L163)."
- The AI node. "The model call inside the workflow — extract, classify, draft — with a schema (L143)."
- The fit. "Integration-heavy, standard-shaped workflows — built in hours, self-hosted (L288)."
- The rule. "Standard line → n8n (L218); complex state, branching, custom logic → the custom build (L230)."
Senior-Level Insights
- The tool follows the architecture (L230). The senior answer designs the L230 platform first (L217–222, 228) and fits n8n into it (L218) — not the reverse (L230).
- The AI node is the L163 station (L163). The model call inside the canvas (L218) is the same contract as any AI step (L163): prompt, model, schema (L143) — the L217 discipline transfers (L230).
- Self-hosting is the control story (L288). n8n self-hosted (L288) means the data and the keys stay in your infrastructure (L275) — the security story (L212) is yours (L218).
- The integration count is the value (L223–227). The 400+ nodes (L218) are the L223–227 integrations pre-wired (L230) — the glue that would take weeks to build (L155).
- The limits are the architecture's (L230). Complex state (L207) and graph-shaped branching (L215) are L230 platform concerns — the senior answer names where n8n ends and the custom build begins (L230).
Common Mistakes
- Everything in n8n (L230). The platform's concerns — queues (L222), recovery (L232), scale (L230) — forced through nodes (L218).
- The AI node for everything (L163). Model calls where rules work (L199) — the token cost (L150) and the failure surface (L211) balloon (L230).
- No checkpoints (L228). Consequential steps in the canvas without the human gate (L208) — the trust (L324) gone (L218).
- Node spaghetti (L230). Heavy branching as nodes (L215) — the graph shape that code (L230) or LangGraph (L215) handles better.
- Vendor faith (L230). n8n by fashion instead of fit (L362) — the L230 decision skipped (L218).
- State in the canvas (L207). Long-running state (L207) forced into node variables — the checkpoints (L207) and the recovery (L232) break (L230).
Best Practices
- Design the platform first (L230) — then fit n8n into it (L218).
- Use the AI node with a contract (L163) — prompt, model, schema (L143).
- Gate the consequential steps (L228) — the human checkpoint in the canvas (L208).
- Keep the line standard-shaped (L218) — the canvas's strength (L230).
- Self-host for the control story (L288) — the data and the keys stay yours (L275).
- Know the exit (L230) — when the line outgrows nodes, the custom build takes over (L218).
Interview Questions
Q: What is n8n?
A: The open-source workflow platform (L218). A workflow is a canvas of nodes: trigger nodes (L220), integration nodes (L223–227), logic nodes (L230), and the AI node (L163) — the model call inside the pipeline (L217). Self-hosted (L288) with 400+ integrations. It's the fastest implementation of the L217 unit for integration-heavy, standard-shaped workflows (L230).
Q: What does the AI node do?
A: The model call inside the workflow (L163): a prompt, a model, and a schema (L143) — extract, classify, summarize, draft (L163). It's the L163 station on the L217 line (L218): a defined contract (L217), with the same discipline as any AI step (L143) — the prompt is a step contract, not a script (L230).
Q: When does n8n beat a custom build?
A: Integration-heavy, standard-shaped workflows (L230): trigger, extract, gate, post — the canvas builds it in hours (L218), with the 400+ integrations pre-wired (L223–227) and self-hosting for control (L288). The custom build wins when the workflow outgrows nodes: complex state (L207), graph-shaped branching (L215), or business logic beyond IF nodes (L230).
Q: What are n8n's limits?
A: The platform's concerns (L230). Complex state (L207) — long-running workflows with checkpoints (L207); heavy branching (L215) — the graph shape that LangGraph (L215) or code handles; custom logic beyond nodes (L230); and scale — the queues (L222) and recovery (L232) are architecture, not nodes (L230). n8n implements the workflow (L217); the platform is yours either way (L230).
Follow-Up Questions
- How does the AI node fit the L163 contract (L218)?
- When is the custom build right (L230)?
- How do you self-host n8n (L288)?
- How do the integrations map to L223–227?
- How does n8n fit the L230 platform (L230)?
Comparison Table — n8n vs Custom Build
| n8n (this lesson) | Custom build (L230) | |
|---|---|---|
| Building (L217) | canvas of nodes | the L217 runner |
| Integrations (L223–227) | 400+ pre-wired | per-integration code |
| State (L207) | node variables | real persistence (L207) |
| Branching (L215) | IF nodes | code / LangGraph (L215) |
| Scale (L222) | platform-dependent | queues by design (L222) |
| The fit (L230) | standard lines | custom machinery |
The senior read: the columns are the L230 decision — the standard line in the canvas, the custom machinery in code (L230).
Code Example — The n8n Workflow, as Data
// The n8n workflow as data — nodes, contracts, and the AI node (L218, L163).
const workflow = {
nodes: [
// TRIGGER (L220)
{ id: 'trigger', type: 'n8n-nodes-base.webhook', parameters: { path: 'invoice' } },
// AI NODE (L163) — the model call with a contract (L143)
{
id: 'extract', type: '@n8n/n8n-nodes-langchain.ai',
parameters: {
model: 'gpt-4o-mini',
prompt: 'Extract the invoice fields as JSON.',
schema: { vendor: 'string', amount: 'number', date: 'date' }, // L143
},
},
// THE GATE (L208, L228) — the human checkpoint
{ id: 'approve', type: 'n8n-nodes-base.wait', parameters: { resume: 'onWebhookCall' } },
// INTEGRATION (L227) — the world
{ id: 'post', type: 'n8n-nodes-base.postgres', parameters: { table: 'invoices' } },
],
connections: {
trigger: { main: [[{ node: 'extract' }]] }, // the skeleton (L199)
extract: { main: [[{ node: 'approve' }]] }, // the gate (L208)
approve: { main: [[{ node: 'post' }]] },
},
};
What the reader must SEE — the L217 unit, as nodes:
webhook → trigger (L220) · ai → the contract (L163, L143)
wait → the human gate (L208, L228) · postgres → the world (L227)
connections → the skeleton (L199)
The canvas is the L217 line, drawn.
Tip
The node that shows the unit's discipline: { type: 'wait', resume: 'onWebhookCall' } — the human gate as a node. The canvas is the L217 line — with the checkpoint where the consequence demands it (L208, L228).
Performance Notes
- The canvas is the prototype speed (L151). Visual workflows build in hours (L218) — the integration glue (L155) pre-wired (L230).
- The AI node is the token cost (L150). Model calls in the canvas (L163) are the workflow's spend (L149) — placed only where judgment pays (L230).
- The wait nodes are the latency (L151). Human gates (L208) pause the line (L228) — the workflow's wall-clock includes the approval (L218).
- Self-hosting is the infrastructure story (L288). The n8n instance is your container (L288) — the ops (L274) and the secrets (L275) are yours (L218).
Debugging Scenarios
| Symptom | Likely cause | First thing to check |
|---|---|---|
| The canvas is a tangle | Heavy branching as nodes (L230) | Move to code/LangGraph (L215) |
| The AI node is slow | The model on the hot path (L150) | Cache (L171), smaller model (L157) |
| The workflow lost state | State in node variables (L207) | Real persistence (L230) |
| The gate never resumes | The wait node miswired (L208) | Check the resume trigger (L228) |
| Scale problems | The platform's concerns in nodes (L222) | The queues + recovery (L232) |
Quick Revision Notes
- n8n = the open-source workflow tool (L218): a canvas of nodes.
- The nodes: trigger (L220), AI (L163), logic (L230), integration (L223–227).
- The AI node = the model call with a contract (L163, L143).
- The fit: integration-heavy, standard-shaped workflows (L230).
- The limits: state (L207), branching (L215), custom logic, scale (L222).
- The rule: standard line → n8n; custom machinery → the custom build (L230).
Cheat Sheet
N8N = the open-source workflow tool — the L217 unit, drawn
THE CANVAS (L218)
trigger nodes webhook · schedule · email (L220)
integration nodes CRM (L223) · email (L224) · DB (L226) · APIs (L227)
AI node the model call — prompt + model + schema (L163, L143)
logic nodes IF · switch — the forks (L230)
THE FIT (L230)
integration-heavy, standard-shaped workflows
built in hours · self-hosted (L288) · 400+ integrations (L223-227)
THE LIMITS (L230)
complex state (L207) → the custom build's persistence
heavy branching (L215) → code / LangGraph (L215)
custom logic + scale (L222) → the L230 platform
THE RULE
the tool follows the architecture (L230)
standard line → n8n (L218) · custom machinery → code (L230)
the platform — events (L220), queues (L222), approvals (L228),
recovery (L232) — is yours either way (L230)
INTERVIEW, 4 MOVES
1 platform "the canvas of nodes (L218)"
2 AI node "the model with a contract (L163, L143)"
3 fit "integration-heavy, standard shapes (L230)"
4 rule "standard → n8n · custom → code (L230)"Key Takeaways
Recap
- n8n is the open-source workflow tool (L218): the L217 unit drawn as a canvas of nodes — triggers (L220), integrations (L223–227), logic (L230), and the AI node (L163)
- The AI node is the model call with a contract (L163, L143) — the same discipline as any AI step in the L217 unit (L230)
- The fit is the standard line (L230): integration-heavy, standard-shaped workflows built in hours (L218), self-hosted for control (L288)
- The limits are the platform's (L230): complex state (L207), graph branching (L215), custom logic, and scale (L222) are the custom build's territory
- The tool follows the architecture (L230) — n8n implements the workflow (L217); the platform — events (L220), queues (L222), approvals (L228), recovery (L232) — is yours either way
- The decision is by shape (L230): standard line → n8n (L218), custom machinery → code (L230)
Check your understanding
Answer each one out loud. Then rate yourself honestly.
0/8What's the n8n canvas (L218)?
What does the AI node do (L163)?
What's the fit for n8n (L230)?
What are its limits (L230)?
Why is the tool following the architecture the rule (L230)?
How does self-hosting matter (L288)?
When does the custom build win (L230)?
What does the gate node represent (L208)?
A Closing Note — The Canvas That Draws the Line
You now hold the open-source tool: the canvas of nodes — triggers, the AI node with its contract, the gates, the integrations — that draws the L217 line in hours. It's the fastest path for the standard workflow, and the custom build takes over where the canvas ends (L230).
Next: the visual alternative — Make (L219), and when it fits.