Agentic AI with n8n#
Build AI systems that think, decide, and act — without writing code.
This course teaches you to create AI agents using n8n, a visual workflow tool. By the end, you’ll understand when to use a simple prompt, when to build a workflow, and when to deploy a full agent.
Why AI Agents?#
The problem: Large Language Models (like GPT) are powerful, but limited:
They only produce text — they can’t check facts or take real actions
One attempt — if they’re wrong, you catch the error
Complex prompts often lead to errors and invented details
The solution: AI Agents go beyond simple prompts:
They use tools (calculator, search, APIs) to get real information
They loop until the task is complete
They decide the next step based on results
Why n8n: Visual, drag-and-drop interface. Perfect if you’re not a programmer. You see exactly what’s happening at each step.
What You’ll Build#
We start with three foundational patterns — the building blocks for everything that comes next:
PROJECT 1: Prompt Chaining PROJECT 2: Smart Routing
──────────────────────── ────────────────────────
┌────────┐ ┌────────┐ ┌────────┐ ┌─────────┐ ┌──▶ Refund Agent
│Outline │──▶│ Edit │──▶│ Draft │ │Classify │────┼──▶ Order Agent
└────────┘ └────────┘ └────────┘ │ Ticket │ └──▶ Support Agent
└─────────┘
You control the steps AI routes to the right handler
PROJECT 3: AI Agent with Tools
──────────────────────────────
┌─────────────────────────────────────┐
│ AI AGENT │
│ │
│ Think ──▶ Act ──▶ Check ──┐ │
│ ▲ │ │
│ └───────── loop ────────┘ │
│ │
└───────────────┬─────────────────────┘
│
┌─────────────┼─────────────┐
│ │ │
▼ ▼ ▼
┌─────────┐ ┌─────────┐ ┌─────────┐
│Calculator│ │Wikipedia│ │ Memory │
└─────────┘ └─────────┘ └─────────┘
AI decides which tool to use and when to stop
These patterns are your foundation. Once you master them, you’ll have the building blocks to create more sophisticated systems on your own.
All without writing a single line of code.
Course Structure#
Notebook |
What you’ll do |
|---|---|
08 - AI Agents Intro (this notebook) |
Understand the difference between workflows and agents |
08b - n8n Setup |
Install n8n on your computer |
08c - n8n Quick Start |
Build your first AI workflow from scratch |
08d - Workflow Patterns |
Learn patterns: chaining, routing, parallelization |
Prerequisites#
n8n: Download the Desktop App (Mac/Windows) — no coding needed
API key: From OpenRouter, OpenAI, or Google AI
About costs: Some workflows call paid AI APIs. Run in Test mode while learning, and keep workflows deactivated until ready. Tools like Wikipedia and Calculator are free.
What is an AI Agent?#
Before building workflows, let’s understand the key difference between a simple LLM call, a workflow, and an agent.
This will help you choose the right approach for each task.
The Problem with Single LLM Calls#
A simple LLM call works like this:
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Your prompt │────────▶│ LLM │────────▶│ Text response │
└─────────────────┘ └─────────────────┘ └─────────────────┘
Great for: Translation, summaries, rewriting — simple one-step tasks.
Limitations:
Only produces text (can’t check facts, can’t take real actions)
One attempt — if it’s wrong, you have to catch the error yourself
Complex prompts often lead to errors and invented details
Solution 1: Workflows (You Control the Steps)#
Instead of one complex prompt, break the task into smaller steps:
👤 YOU design this sequence
│
┌─────────────────────────────┼─────────────────────────────┐
│ │ │
▼ ▼ ▼
┌───────────────┐ ┌───────────────┐ ┌───────────────┐
│ STEP 1 │──────────▶│ STEP 2 │──────────▶│ STEP 3 │
│ Extract info │ │ Improve it │ │ Write draft │
└───────────────┘ └───────────────┘ └───────────────┘
Key characteristics:
You decide the steps in advance
Fixed sequence — always runs the same way
Each step is simpler → fewer errors
Tools are optional, but you choose them at design time (not the AI)
In n8n: You connect nodes like Basic LLM Chain, Switch, and Merge — you control the sequence.
Solution 2: Agents (AI Controls the Steps)#
An agent is different — the AI decides what to do next:
┌─────────────────────────────────────────────────────────────────────────────┐
│ 🤖 AGENT LOOP │
│ │
│ ┌──────────────────────────────────────────────────────────────────┐ │
│ │ │ │
│ │ ┌─────────┐ ┌─────────┐ ┌─────────┐ │ │
│ │ │ THINK │─────▶│ ACT │─────▶│ CHECK │ │ │
│ │ │ │ │ │ │ │ │ │
│ │ │ "What │ │ Call │ │ "Do I │ │ │
│ │ │ do I │ │ tool │ │ have │───── No ───────┤ │
│ │ │ need?" │ │ │ │ enough?"│ │ │
│ │ └─────────┘ └────┬────┘ └────┬────┘ │ │
│ │ │ │ │ │
│ │ ▼ │ Yes │ │
│ │ ┌──────────┐ │ │ │
│ │ │ TOOLS │ ▼ │ │
│ │ │──────────│ ┌─────────────┐ │ │
│ │ │Calculator│ │FINAL ANSWER │ │ │
│ │ │Wikipedia │ └─────────────┘ │ │
│ │ │ Email │ │ │
│ │ └──────────┘ │ │
│ │ │ │
│ └──────────────────────────────────────────────────────────────────┘ │
│ ▲ │
│ │ │
│ Repeat if needed │
└─────────────────────────────────────────────────────────────────────────────┘
Key characteristics:
AI decides the next step
Can use tools (Calculator, Wikipedia, APIs, databases…)
Loops until the task is complete
Can adapt when something doesn’t work
In n8n: This is the AI Agent node — you give it tools, and it decides when to use them.
The Key Question: Who Decides?#
Approach |
Who decides the steps? |
Who decides tools? |
Loops? |
Best for |
|---|---|---|---|---|
Simple LLM |
You (one prompt) |
No tools |
No |
Quick text tasks |
Workflow |
You (predefined steps) |
You (at design time) |
No |
Predictable, structured tasks |
Agent |
AI (dynamic) |
AI (at runtime) |
Yes |
Complex, ambiguous tasks |
Rule of thumb:
If you can write down all the steps → use a workflow
If the AI needs to figure it out → use an agent
Agent Building Blocks#
Every AI agent is built from four core components:
┌─────────────────────────────────────────────────────────────────────────────┐
│ AI AGENT │
│ │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │ LLM │ │ TOOLS │ │ MEMORY │ │ REASONING │ │
│ │ (brain) │ │ (actions) │ │ (context) │ │ (logic) │ │
│ └─────────────┘ └─────────────┘ └─────────────┘ └─────────────┘ │
│ │
│ Understands Interacts with Remembers Decides what │
│ language the real world conversations to do next │
└─────────────────────────────────────────────────────────────────────────────┘
Component |
What it does |
Examples in n8n |
|---|---|---|
LLM |
Reasoning, language understanding |
OpenRouter, OpenAI, Google AI |
Tools |
Actions the agent can take |
Calculator, Wikipedia, HTTP Request |
Memory |
Conversation history |
Window Buffer Memory (short-term), Vector Store (long-term) |
Reasoning |
Planning, deciding next steps |
ReAct loop (built into AI Agent node) |
Agentic Design Patterns#
The AI community identifies four main patterns for building agents:
Pattern |
What it means |
|---|---|
Tool Use |
Agent calls external tools to take actions |
Reflection |
Agent reviews and improves its own output |
Planning |
Agent breaks complex tasks into steps before acting |
Multi-agent |
Multiple agents collaborate on a task |
Tool Use is the most practical starting point — once you understand how agents call tools, the other patterns build naturally on top.
For a deeper dive into agent design, see Anthropic’s Building Effective Agents.
What Agents Struggle With#
Agents are powerful, but they have real limitations. Understanding these helps you design better systems:
Limitation |
Why it happens |
How to handle it |
|---|---|---|
Counting and math |
LLMs predict text, not compute |
Use Calculator tool |
Current information |
Training data has a cutoff date |
Use Search/Wikipedia tools |
Long-term memory |
Context window is limited |
Use Memory nodes for conversations |
Complex multi-step plans |
Hard to keep track of many steps |
Break into smaller workflows |
Following instructions exactly |
May ignore constraints |
Add validation, use Reflection pattern |
Key insight: Tools exist because LLMs have gaps. A Calculator tool isn’t a luxury — it’s necessary because LLMs genuinely struggle with arithmetic. Design your agents knowing these limitations.
Recap#
In this notebook, you learned:
Why AI Agents matter: They go beyond simple prompts by using tools, looping, and deciding next steps
Workflows vs Agents: Workflows have predefined steps (you control), agents decide dynamically (AI controls)
Agent building blocks: LLM (brain), Tools (actions), Memory (context), Reasoning (logic)
Design patterns: Tool Use, Reflection, Planning, Multi-agent
Agent limitations: Math, current info, memory, complex plans, instruction following
Next: Proceed to 08b - n8n Setup to install n8n on your computer.