Every conversational build follows the same four-phase cycle. You describe the result, the AI plans and builds (build); when something breaks, send the error back to it debug (troubleshoot) and, finally, ask for improvements to optimize. The diagram below shows the loop—and that it always returns to the plan.
Illustrative diagram — conceptual recreation of the cycle, not a real screenshot.
🔐 Permission modes & Plan Mode
What it is: before the AI does anything, you choose the permission mode — how much autonomy it has to edit files and run commands. The modes range from "ask before everything" to "skip all approvals". The Plan Mode is the mode where it only plans: it researches, asks questions, and proposes, without changing anything until you approve.
🧭 Why learn
The right mode balances speed and safety. Starting in Plan Mode ensures you always see the plan before the build; Bypass is faster, but you can’t see what the AI is doing—use it carefully, and never for potentially dangerous commands without understanding the risk.
✓ When to use each mode
- ✓Plan Mode: whenever you’re about to start something new—just plan.
- ✓Ask first: learns by observing each step.
- ✓Automatic editing / Auto: when you already trust the workflow.
✗ Beware of the Bypass
- ✗Bypass skips approval for potentially dangerous commands.
- ✗You stop seeing what the AI is doing.
- ✗Enable it only when you understand the build and want speed.
🎯 Practical tip
To enable Bypass, search for "bypass" in the settings (allow skipping permissions with care) and restart. But the golden rule still applies: always start in Plan Mode and only switch modes once you see the approved plan.
Key concepts
Only plans, doesn’t make changes.
Approve each edit.
More autonomy.
Skips approval — be careful.
📋 Phase 1 — Plan
What it is: during the planning phase, the AI researches the relevant nodes and patterns, then clarifying questions (which columns to record, extra actions such as labels or notifications) and then proposes a plan for you to approve. Nothing is built before your approval.
🧭 Why learn
The plan is your checkpoint: it’s where you correct course before a single line exists. Answering clarifying questions well determines the quality of everything that follows—it’s worth investing more here than fixing things at the end.
I need a workflow that monitors Gmail
for emails with "urgent" in the subject
and logs each one in a Google Sheets spreadsheet.
# the AI responds with:
- questions: which columns? label? notification?
- a plan with Gmail trigger → append row
- the list of required credentials
🎯 Practical tip
Non-determinism is normal: the same prompt can generate different node names, structures, and layouts each time. Variation isn’t an error—don’t compare your screen pixel by pixel with someone else’s.
Key concepts
Finds nodes and patterns.
Clarify before acting.
You subscribe to the plan.
Non-deterministic output.
🏗️ Phase 2 — Build
What it is: once the plan is approved, the AI creates and validates the nodes in n8n, automatically fixing validation issues. In the example, it builds a Gmail trigger connected to a Google Sheets “append row” node. But there are things it doesn’t do by you.
✓ What the AI does
- ✓Creates the nodes and connects the workflow structure.
- ✓Validates the configuration and automatically fixes validation errors.
- ✓Reports that credentials need to be configured manually.
✗ What AI Does NOT Do
- ✗Configure OAuth credentials (Gmail, Sheets).
- ✗Create the destination spreadsheet in your Google account.
- ✗Map the field values (from, subject, snippet, ID, date).
🧭 Why learn
Knowing the boundary between "what the AI builds" and "what requires manual work" avoids frustration: you won't wait for the AI to perform an OAuth login that only you can do. The build delivers the structure; you connect the accounts and create the destination.
Key concepts
Builds the workflow.
Auto-corrects config.
Trigger + append row.
Credentials are manual.
🔑 OAuth credentials & keys
What it is: securely connect the accounts the workflow uses. Gmail and Google Sheets are connected through OAuth2 (you sign in with your Google account); OpenAI is accessed through API key (a secret key you generate in the dashboard). It's the most important manual step in the build.
Credentials walkthrough
OAuth2 in Gmail and Sheets
In the node, choose “Create new credential” → OAuth2 → sign in with Google. Use a same account where you'll create the destination spreadsheet.
OpenAI API key
In the OpenAI dashboard, under “API keys,” create a secret key, give it a descriptive name, and copy it right away—it appears only once. Paste it into the node as a new credential.
Treat as sensitive data
Treat the key like a credit card: anyone with access can spend your tokens. Keep a secure copy (digital + physical).
⚠️ Why learn — and the trap
- ✗The OpenAI key is shown only once—if you don't copy it, generate another.
- ✗Never paste credentials into the chat—a leaked key can be abused.
- ✗Authorizing with the “wrong” account creates the spreadsheet that the AI can’t see.
Key concepts
Gmail/Sheets login.
OpenAI secret key.
Copy it during creation.
A spreadsheet the AI can see.
🔧 Phase 3 — Troubleshoot
What it is: the debugging phase is simple and powerful—you returns the error message for the AI, along with the node location, and it diagnoses and fixes it. You don’t have to decipher the error alone; the AI reads it, understands the cause, and applies the fix.
# erro no nó: "intervalo inválido: 14 horas" # você cola o erro de volta no chat ↓ "Deu este erro no gatilho do Gmail: ..." # a IA diagnostica e corrige: - troca o intervalo por uma expressão cron */5 - explica por que o formato anterior falhou
🧭 Why learn
Debugging through conversation changes your relationship with errors: they stop being blockers and become input. Always provide the error and the node location — the more context, the more accurate the fix. After each fix, reload n8n before testing again.
🎯 Practical tip
Some node settings only accept specific formats. The Gmail trigger, for example, only accepts “every minute” or a cron expression — so a request for “5 minutes” is resolved as cron (*/5).
Key concepts
Message + node.
The AI finds the cause.
Specific format.
Before testing again.
⚡ Phase 4 — Optimize
What it is: with the workflow working, you ask for improvements in natural language — for example, "change the polling interval to every 5 minutes". The AI applies the change; if it runs into an invalid format, that becomes another troubleshooting round. Optimizing simply means continuing the conversation.
✓ Ask in natural language
- ✓“Check Gmail every 5 minutes instead of 10.”
- ✓“Add a label to emails that have already been processed.”
- ✓“Include the received date in the spreadsheet.”
✗ Don’t Micromanage
- ✗Edit the cron expression manually inside the node.
- ✗Rebuild the workflow from scratch because of a small change.
- ✗Make multiple changes at once without testing.
🧭 Why learn
The optimization phase closes the loop, but the loop never "ends": each improvement can reveal a new error to debug or a new adjustment to plan. Thinking in loops—and not in straight lines—is what separates a toy build from a workflow that evolves.
Key concepts
Ask for the improvement.
Test between changes.
You can reopen troubleshooting.
The cycle doesn’t end.
📨 Project Guide: Support Agent (RAG)
What it is: the guide project for this module is a email support agent with RAG — it reads policy documents in PDF, identifies support questions, and drafts well-supported responses for human review. The architecture has two workflows: one indexes the knowledge, and the other responds to emails.
🧱 The two workflows
- •Database indexer: manual trigger → code node (document text) → in-memory vector store with OpenAI embeddings.
- •Support agent: Gmail trigger (every 15 min, unread only) → text classifier → OpenAI model → AI agent with the vector store tool → Gmail draft.
🧭 Why learn — system prompt vs. vector store
An architectural decision shows up right in the plan: embed the documents in the system prompt (simpler and cheaper for short texts) or use a vector store / RAG (scalable, retrieves only the relevant passages, better as you grow). Here we chose the vector store for scalability.
Embed the text directly. Simple, inexpensive, great for small docs.
Searches only for relevant passages. Scales and reduces context costs.
🎯 Practical tip
Execution order matters: run the indexer workflow once manually to populate the vector store; only then enable the support agent. Put the PDFs in the project folder and reference them by tag in the prompt so the AI can read them.
Key concepts
Responds based on docs.
Support vs. irrelevant.
Semantic search.
Human review first.
🧪 Verification & Testing
What it is: before trusting the agent, you run a visual checklist and test real-world scenarios. The golden rule: green ≠ correct — an error-free run doesn’t prove the answer is correct. The best agent is the one that refuses to make things up what you don’t know.
Real test scenarios
Return question
“I bought a laptop 3 weeks ago; I’ve already opened it.”
The draft must correctly state the 30-day window and the restocking fee. Check the numbers (30 days, not "one year").
Warranty question
“The TV broke after 8 months.”
The draft must mention the manufacturer's one-year warranty—exactly as stated in the policy PDF.
Out of scope (store hours)
“What time does the store open?”
The agent should honestly say that doesn’t have that information, instead of making things up—a sign that it uses only the provided PDFs.
✓ Test-by-test checklist
- ✓Email received → classified as support.
- ✓Correct policy found in the vector store.
- ✓Precise draft generated and visible in the Drafts folder.
✗ Warning Signs
- ✗Workflow is “green,” but the number in the response is wrong.
- ✗The agent makes up a store schedule that doesn’t exist in the PDFs.
- ✗Non-support email generating a draft (it should stop).
🧭 Why learn
Testing with real scenarios is what turns “seems to work” into “works.” Refusing to hallucinate is a desired result, not a bug—and gray-area questions (like store hours) reveal where you need to decide the scope of your own agent.
Self-healing (optional): the workflow ran without any errors (everything was “green”). Does that guarantee the answer is correct?
📌 Module Summary
Next Module:
1.3 — From “It Works” to “It Works Well”: Enhancement