Low-Code Automation with n8n
Build AI agents by dragging boxes, not writing code. Learn n8n visual workflows, nodes, credentials, triggers, and how the visual canvas replicates LangChain logic.
In this lecture
20.1 Low-Code / No-Code & n8n
- No-Code — zero coding knowledge needed; for business users connecting apps quickly.
- Low-Code — a visual interface that also allows custom code (Python/JS) for complex logic.
Why n8n for engineers?
| Feature | n8n | Zapier | Make |
|---|---|---|---|
| Pricing | Free & open-source | Paid (limited free tier) | Freemium |
| Self-hosted? | Yes — runs on your own machine | No — cloud only | No — cloud only |
| AI / LLM nodes | Built-in (native LangChain integration) | Limited | Some |
| Custom code | JavaScript & Python nodes | Very limited | Limited |
| Data privacy | Data stays on YOUR machine | Goes through Zapier servers | Goes through Make servers |
n8n is "fair-code" and self-hostable (via npm/Docker), developer-friendly (write JS/Python inside nodes), and has native LangChain integration for agentic workflows. It can even run agents locally with Ollama for full privacy.
20.2 Nodes in n8n
| n8n concept | What it does | Python equivalent |
|---|---|---|
| Node | One unit of work — a single task | A function |
| Workflow | A connected sequence of nodes | A complete script |
| Trigger node | Starts the workflow (the "ON" button) | if __name__ == "__main__" |
| Connection (arrow) | Passes data from one node to the next | A function's return value → next input |
| IF node | Branches the flow on a condition | if / else statement |
| HTTP Request node | Calls an external API | requests.get() |
The three core building blocks of automation
- Trigger — the event that starts the flow.
- Filter / Logic — rules that control the flow (e.g. the IF node).
- Action — what happens next (send an email, write to a database).
Data flow between nodes
Every node receives data from the previous node as JSON. You reference a field from a previous node using the syntax {{ $json.fieldName }} — for example a Basic LLM Chain node can use {{ $json.setup }} to pull text from an HTTP Request node above it.
requests.get() block.
20.3 Triggers in Agentic AI Systems
| Trigger type | Fires when… | Python equivalent |
|---|---|---|
| Manual Trigger | You click "Execute" — for testing | Running the script by hand |
| Schedule Trigger | At a set time/interval (e.g. 8 AM daily) | A cron job / schedule library |
| Webhook Trigger | An external HTTP request arrives | A Flask/FastAPI route |
| App Trigger | An event in an app (new file in Google Drive, new email) | An event listener / polling loop |
20.4 Managing Credentials in n8n
How credentials work in n8n
- Credentials are created separately from the workflow and stored encrypted.
- A node references a saved credential — the key itself never appears in the workflow logic.
- One credential can be reused by many nodes/workflows.
- Because n8n is self-hosted, credentials stay on your machine — not a third-party server.
Example: to use a Groq model, you click "Create new credential" on the Groq Chat Model node, paste your gsk_... key once, and save it. Every node that needs Groq then just references that credential.
20.5 Replicating LangChain Logic
| LangChain / agent concept | n8n equivalent node |
|---|---|
| The LLM "brain" | AI Agent / Basic LLM Chain node (+ a Chat Model sub-node, e.g. Groq or Ollama) |
| Tools the agent calls | Tool nodes attached to the AI Agent (HTTP Request, Calculator, etc.) |
| Memory / conversation state | Window Buffer Memory node |
| Conditional routing (edges) | IF / Switch nodes |
| Chaining steps | Connecting nodes with arrows |
Limitations of agentic AI to remember
- Cost — LLM API calls (tokens) add up quickly.
- Latency — agents are slower than plain code because they "think" and wait for generation.
- Looping errors — an agent can get stuck retrying a problem forever.
This is also why Human-in-the-Loop (Lecture 19) matters — pause for human approval before critical actions to prevent expensive mistakes.
The final lecture — nodes, triggers and credentials are all common MCQs.
Which automation tool is best known for being free, open-source and self-hostable?
n8n is free, open-source ("fair-code") and can be self-hosted on your own machine — Zapier and Make are cloud-only.
In n8n, a node is most like which Python concept?
A node does one job, like a function. A full workflow of connected nodes is the equivalent of a complete script.
Which trigger should you use to run a workflow automatically every day at 8 AM?
A Schedule Trigger fires at set times/intervals — the n8n equivalent of a cron job. A Manual Trigger only fires when you click Execute.
Every n8n workflow must begin with:
The trigger is the "ON button" — nothing in the workflow runs until a trigger fires.
Why does n8n store credentials separately from the workflow?
Credentials are stored in a dedicated encrypted store and merely referenced by nodes, so you can export/share workflows without exposing the actual API keys.
How do n8n nodes pass data to each other?
Each node outputs JSON; the next node reads fields using {{ $json.fieldName }} — like accessing a dictionary key.
The n8n IF node is the visual equivalent of which Python construct?
The IF node branches the workflow into a true and a false path based on a condition — exactly like an if/else.
In n8n, the agent's conversational memory is provided by which node?
The Window Buffer Memory node gives the AI Agent memory of recent turns — the n8n equivalent of windowed conversation memory.
Which is a real limitation of agentic AI workflows?
Agents can loop endlessly, are slower (they "think" and wait for generation), and each LLM call costs tokens — real limitations to manage.
Describe a 4-node n8n workflow that emails you an AI-explained joke every morning.
1. Schedule Trigger — fires at 8 AM daily (the ON button). 2. HTTP Request node — calls a joke API and returns JSON. 3. Basic LLM Chain / AI Agent node — uses {{ $json.setup }} and {{ $json.punchline }} in its prompt to make an LLM explain why the joke is funny. 4. Gmail node — sends the explanation to your inbox. No code is written — each node replaces a block of Python.
Map these LangChain/agent concepts to their n8n equivalents: the LLM brain, tools, memory, conditional routing.
LLM brain → the AI Agent / Basic LLM Chain node with a Chat Model sub-node (Groq, Ollama). Tools → tool nodes attached to the AI Agent (HTTP Request, Calculator). Memory → the Window Buffer Memory node. Conditional routing → the IF / Switch node. n8n provides a visual node for every code-level building block.
Give one task where n8n is the better choice and one where writing Python is better.
n8n is better for automations that connect different services together — e.g. "when a new file lands in Google Drive, have an AI extract its data and write it to a spreadsheet." That is "plumbing" work n8n handles visually in minutes. Python is better for complex custom logic or algorithms — e.g. training a neural network or writing a custom sorting algorithm — where you need full control. n8n complements coding; it does not replace it.
{{ $json.field }}). Automation core: Trigger → Logic → Action. Triggers: Manual, Schedule (cron), Webhook, App. Credentials = encrypted, stored separately, referenced by nodes. n8n replicates LangChain: AI Agent (brain), tool nodes, Window Buffer Memory, IF node (routing).