GenAI Exam Prep
Home Mock Exam
⚡ LECTURE 20

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.

Syllabus topics 79–83 ⏱ ~25 min read 12 practice questions

20.1 Low-Code / No-Code & n8n

Low-Code / No-Code (LCNC) — platforms that let you build applications and automations using visual drag-and-drop interfaces instead of writing line-by-line code.
n8n — a free, open-source, low-code workflow automation tool (pronounced "nodemation"). You build AI agents and automations by visually connecting nodes on a canvas.
🧱 n8n = LEGO blocks for software Each block (a node) does one specific job — fetch data, filter it, send an email, ask an AI a question. You snap them together to build anything. A task that would take 200+ lines of Python (requests, smtplib, API keys, cron jobs, error handling) becomes 5 boxes connected by arrows.

Why n8n for engineers?

Featuren8nZapierMake
PricingFree & open-sourcePaid (limited free tier)Freemium
Self-hosted?Yes — runs on your own machineNo — cloud onlyNo — cloud only
AI / LLM nodesBuilt-in (native LangChain integration)LimitedSome
Custom codeJavaScript & Python nodesVery limitedLimited
Data privacyData stays on YOUR machineGoes through Zapier serversGoes 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 is a factory assembly line Nodes = machines on the line (each does one job). Workflow = the full assembly line (machines connected in order). Trigger = the ON button. Connections = conveyor belts. Credentials = security badges to access restricted machines.
n8n conceptWhat it doesPython equivalent
NodeOne unit of work — a single taskA function
WorkflowA connected sequence of nodesA complete script
Trigger nodeStarts the workflow (the "ON" button)if __name__ == "__main__"
Connection (arrow)Passes data from one node to the nextA function's return value → next input
IF nodeBranches the flow on a conditionif / else statement
HTTP Request nodeCalls an external APIrequests.get()

The three core building blocks of automation

  1. Trigger — the event that starts the flow.
  2. Filter / Logic — rules that control the flow (e.g. the IF node).
  3. 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.

🧩 A 3-node AI workflow Manual Trigger (start) → HTTP Request (fetch a joke from an API) → Basic LLM Chain (a Groq/Ollama model explains why the joke is funny). Zero code — the HTTP Request node replaces a whole requests.get() block.

20.3 Triggers in Agentic AI Systems

Trigger — the node that starts a workflow. Nothing runs until a trigger fires. Every workflow needs exactly one starting trigger.
Trigger typeFires when…Python equivalent
Manual TriggerYou click "Execute" — for testingRunning the script by hand
Schedule TriggerAt a set time/interval (e.g. 8 AM daily)A cron job / schedule library
Webhook TriggerAn external HTTP request arrivesA Flask/FastAPI route
App TriggerAn event in an app (new file in Google Drive, new email)An event listener / polling loop
Manual vs Schedule Trigger A Manual Trigger is you deciding to wake up and check the time. A Schedule Trigger is an alarm clock that rings at 8 AM every day no matter what. To run a daily AI digest automatically, you replace the Manual Trigger with a Schedule Trigger.
⚠️ Local n8n limitation A Schedule Trigger on a local n8n only fires while your machine is on and n8n is running — if the laptop sleeps, the trigger is missed. For reliable 24/7 automation, host n8n on a cloud server.

20.4 Managing Credentials in n8n

Credentials — securely stored API keys, passwords and tokens that let nodes access restricted external services (Groq, Gmail, Google Sheets). The "security badges" of the assembly line.

How credentials work in n8n

🔑 Why separate credentials from the workflow? Keeping keys in a dedicated encrypted store (not pasted into nodes) means you can share or export a workflow without leaking secrets, rotate a key in one place, and limit who can see it — the same principle as never hard-coding API keys (Lecture 12).

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

🔑 The big idea Everything you built in code with LangChain/LangGraph (Lecture 19) has a visual equivalent in n8n. n8n has native LangChain nodes, so you can build the same agent — brain, tools, memory — by dragging boxes instead of writing Python.
LangChain / agent conceptn8n equivalent node
The LLM "brain"AI Agent / Basic LLM Chain node (+ a Chat Model sub-node, e.g. Groq or Ollama)
Tools the agent callsTool nodes attached to the AI Agent (HTTP Request, Calculator, etc.)
Memory / conversation stateWindow Buffer Memory node
Conditional routing (edges)IF / Switch nodes
Chaining stepsConnecting nodes with arrows
🧩 A complete agentic workflow in n8n Schedule Trigger (8 AM daily) → HTTP Request (fetch data) → IF node (filter — only continue if a condition holds) → AI Agent with an attached Chat Model + Window Buffer Memory (reason & explain) → Gmail node (send the result). That is a brain + tools + memory + control flow — the LangGraph agent of Lecture 19 rebuilt visually.
🧩 Real-world use case — AI Invoice Extractor Trigger: new file in a Google Drive folder → AI Agent (a vision model: "Extract Total Amount & Date, return JSON") → Action: insert the JSON into a Google Sheet / database. 1000 messy PDF invoices processed with no code.

Limitations of agentic AI to remember

This is also why Human-in-the-Loop (Lecture 19) matters — pause for human approval before critical actions to prevent expensive mistakes.

? Practice Questions

The final lecture — nodes, triggers and credentials are all common MCQs.

MCQQ1n8n basics

Which automation tool is best known for being free, open-source and self-hostable?

  • A Zapier
  • B Make (Integromat)
  • C n8n
  • D Excel
Answer: C

n8n is free, open-source ("fair-code") and can be self-hosted on your own machine — Zapier and Make are cloud-only.

MCQQ2Nodes

In n8n, a node is most like which Python concept?

  • A A whole script
  • B A single function (one unit of work)
  • C A variable
  • D A comment
Answer: B

A node does one job, like a function. A full workflow of connected nodes is the equivalent of a complete script.

MCQQ3Triggers

Which trigger should you use to run a workflow automatically every day at 8 AM?

  • A Manual Trigger
  • B Schedule Trigger
  • C Webhook Trigger
  • D IF node
Answer: B

A Schedule Trigger fires at set times/intervals — the n8n equivalent of a cron job. A Manual Trigger only fires when you click Execute.

MCQQ4Triggers

Every n8n workflow must begin with:

  • A An IF node
  • B A trigger node
  • C A credential
  • D A Gmail node
Answer: B

The trigger is the "ON button" — nothing in the workflow runs until a trigger fires.

MCQQ5Credentials

Why does n8n store credentials separately from the workflow?

  • A To make workflows run faster
  • B So secrets stay encrypted and a workflow can be shared without leaking keys
  • C Because nodes cannot use APIs
  • D To translate the keys
Answer: B

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.

MCQQ6Data flow

How do n8n nodes pass data to each other?

  • A As compiled binaries
  • B As JSON, referenced with syntax like {{ $json.field }}
  • C Through a shared global variable named X
  • D They cannot pass data
Answer: B

Each node outputs JSON; the next node reads fields using {{ $json.fieldName }} — like accessing a dictionary key.

MCQQ7IF node

The n8n IF node is the visual equivalent of which Python construct?

  • A A for loop
  • B An if / else statement
  • C An import statement
  • D A class definition
Answer: B

The IF node branches the workflow into a true and a false path based on a condition — exactly like an if/else.

MCQQ8LangChain logic

In n8n, the agent's conversational memory is provided by which node?

  • A HTTP Request node
  • B Schedule Trigger
  • C Window Buffer Memory node
  • D Gmail node
Answer: C

The Window Buffer Memory node gives the AI Agent memory of recent turns — the n8n equivalent of windowed conversation memory.

MCQQ9Limitations

Which is a real limitation of agentic AI workflows?

  • A They can never use tools
  • B They can get stuck in loops and cost adds up from token usage
  • C They cannot connect to APIs
  • D They are always faster than plain code
Answer: B

Agents can loop endlessly, are slower (they "think" and wait for generation), and each LLM call costs tokens — real limitations to manage.

Short AnswerQ10Concept

Describe a 4-node n8n workflow that emails you an AI-explained joke every morning.

Model answer

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.

Short AnswerQ11Mapping

Map these LangChain/agent concepts to their n8n equivalents: the LLM brain, tools, memory, conditional routing.

Model answer

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.

Short AnswerQ12No-code vs code

Give one task where n8n is the better choice and one where writing Python is better.

Model answer

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.

🎯 Lecture 20 — must-remember Low-code/no-code = build via drag-and-drop. n8n = free, open-source, self-hostable, native LangChain nodes. Node = a function; Workflow = a script; arrows pass JSON ({{ $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).