Enhancement isn’t a leap: it’s a ladder. You climb one step at a time — first what breaks, then what's inefficient, then output quality and only then the performance. The diagram shows this priority order, from the bottom (errors) to the top (speed).
Illustrative diagram — conceptual recreation of the enhancement order, not a real screenshot.
🪜 Layered Enhancement Philosophy
What it is: a workflow that “works” is basic and has no apparent errors; one that “works well” handles edge cases, provides a good user experience, and is efficient. The enhancement philosophy is to close that gap in layers — one change at a time, in steps, so you don’t get overwhelmed.
✓ Works WELL
- ✓Edge cases handled (no match, automatic email).
- ✓Good experience: formatting, signature, tone.
- ✓Efficient from trigger to draft.
✗ Just “It Works”
- ✗Breaks on the first case outside the happy path.
- ✗Responds even to automated and no-reply emails.
- ✗Raw output, with no brand voice or personalization.
🧭 Why learn
Enhancement is iterative and fluid: do the essentials first, keep a list of “nice to haves,” gather real-world feedback, demo it to a small group, and only then apply new rounds of changes. Cleanup is enhancement too — organizing, labeling, and even coloring overlapping nodes counts.
🎯 Practical tip
Test everything after every change and save/ back up as you go. Re-test the happy path, test the edge case you fixed, and confirm nothing else broke.
Key concepts
One change at a time.
After each step up.
Save your progress.
Real-world feedback.
📊 Priority Order
What it is: there's a clear order for enhancement— error → logic → output quality → performance. First, what breaks; then, what’s inefficient; then, the experience; and finally, speed. Skipping this order wastes time.
The four steps, in order
Error handling—what breaks
Cases that cause the workflow to fail or produce the wrong response. They come first: a beautiful email is useless if no email (or the wrong email) is generated.
Logic improvements — what’s inefficient
Rules that could be smarter: filter old emails, ignore automated messages, branch when there’s no match.
Output quality — the experience
How the result feels: email formatting, brand voice, signature, personalization with the customer's name.
Performance—the speed
How quickly it goes from trigger to draft. Optimize last, once everything else is correct and polished.
🧭 Why learn
Always confirm that the happy path still works before and after to change—so you don’t blame your new change for a breakage that already existed. This order prevents polishing something that isn’t reliable yet.
Key concepts
What breaks.
What is inefficient.
The experience.
Speed.
🛟 No-match fallback
What it is: when the vector store can’t find it a policy for responding, the agent shouldn’t make anything up. The solution: the agent emits a confidence marker (“policy found” / “no policy”), a code node interprets it, a IF branches off, and a new polite draft says "let’s research this and get back to you".
agente → marcador: "no policy found"
↓
nó de código → lê o marcador
↓
IF → política encontrada?
├─ sim → rascunho normal
└─ não → rascunho "vamos pesquisar
e retornar" (bem formatado)
🧭 Why learn
It's the #1 defense against hallucinations. Anticipate the clarifying questions (match threshold, fallback message, relevance score) before requesting the change. And verify: a question about "international shipping" should go to the research draft, never to an invented answer.
🎯 Practical tip
Test with a question that's probably out of scope and confirm that the fallback draft appears—not a hallucination. Bonus: that draft is usually better formatted, with paragraphs and line breaks.
Key concepts
Trust in the system prompt.
Interprets the marker.
Branches the flow.
“Let’s research.”
⏱️ Time-based filtering
What it is: process emails only newer than X minutes, so you don't reprocess old inboxes. Instead of adding a time-check node, the AI discovers Gmail's search syntax and adds a filter “newer than” directly in the trigger.
# pedido em linguagem natural: "Processe só e-mails dos últimos 10 minutos." # a IA adiciona ao gatilho: query: newer_than:10m # sem nó separado de checagem de tempo
✓ Advantage
- ✓Filter directly in the trigger—no extra node.
- ✓Doesn’t reprocess old emails in the inbox.
- ✓Lighter and faster to run.
✗ What to Avoid
- ✗Create a redundant time-check node.
- ✗A window so short that it misses emails between runs.
- ✗A window so wide that it reprocesses and duplicates.
🧭 Why learn
Shows that AI often finds a more elegant approach than the obvious one—using Gmail’s native query instead of a node. Aligning the time window with the polling interval prevents missing or duplicating emails.
Key concepts
Gmail syntax.
No separate node.
Align it with polling.
Less reprocessing.
🚫 Filtering automated emails
What it is: not every email deserves a reply. A code node after the trigger detects out-of-office messages, delivery notifications, newsletters, and no-reply/postmaster/bounce/marketing senders, add a boolean isAutomated and the reason, and branches to skip. This creates three gates: automatic? → support? → policy match?
⚠️ The case-sensitivity trap
A classic bug: the filter let a sender through no-reply@ because the code read the header fields in lowercase, but they arrived capitalized. The fix: compare the two cases. A case-sensitive header silently breaks filters.
# falha: header.toLowerCase() vs "No-Reply@..." # corrige: comparar lower E original
🧭 Why learn
Avoid absurd drafts (responding to a "delivery complete") and wasting tokens. When multiple workflows are visible to the AI, name the existing workflow in the request—a vague request may lead the AI to create a new workflow from scratch.
🎯 Practical tip
To test a filter, you need to send exactly that type of email. If an automated email gets through, copy the issue back to the AI and have it fix the case sensitivity; reload n8n and test again.
Key concepts
Boolean + reason.
Auto → support → match.
Compare the two cases.
The existing workflow.
🗣️ Brand voice/tone
What it is: adjust the tone of the responses to be friendly, helpful, casual, and enthusiastic. The change is made in two places: the AI agent's system prompt (technical answers) and the fallback draft, "let's look that up." Here we enter the output quality layer.
🎨 What goes into the system prompt
- •Greeting and opening style.
- •Tone guidelines (“tech-savvy, but never condescending”).
- •Encouraging phrases and varied sign-offs.
🧭 Why learn
Tone is what makes the response sound "like the company" and not "like a generic robot." Be specific and reference the existing workflow for the AI to edit it instead of building a new one. Updating both places (agent and fallback) keeps the voice consistent on either path.
🎯 Practical tip
After applying it, send a test email and read the draft as if you were the customer: does it have the personality? Is the tone consistent between the technical response and the fallback?
Key concepts
Agent + fallback.
Friendly and clear.
Reference the workflow.
On every path.
👤 Personalization with the Customer’s Name
What it is: extract the customer's name from the signature/closing from the email (patterns like "Best, João" / "Thank you, Sara"), store it in a variable, and use it in the greeting—with a fallback “Hello” when there’s no subscription. A new code node handles the extraction; the agent prompt and the two drafts then use the name.
padrões: "Abraços, João" / "Obrigada, Sara"
↓
variável nome = "João"
↓
saudação: "Olá João," # ou "Olá" se vazio
⚠️ Why learn — "that's why you test"
The extraction/fallback logic may behave unexpectedly: without a signature, it may end up using the email address name instead of "Hello." Test with extreme inputs. The AI may also make unrequested adjustments (repositioning nodes)—review them.
🎯 Practical tip
Send one test email with a clear signature and another without one. Confirm the personalized greeting in the first and the “Hello” fallback (not the email name) in the second.
Key concepts
From the subscription.
Reused in drafts.
Without a name → generic.
With and without a subscription.
🟢 Trust Indicator
What it is: a high/medium/low badge based on the score showing how well the knowledge base matched — for internal review, appended to the end of the draft. The agent emits the marker (e.g., high > 0.8; medium 0.6–0.8; low < 0.6); a code node interprets it and builds an HTML badge (green/yellow/red, gray when there's no match).
📶 The trust scale
score > 0.8
0,6 – 0,8
score < 0.6
no match
🧭 Why learn
The badge gives the human reviewer a quick signal of how much to trust the draft before sending it—without reading everything. As with the other improvements, anchor your request in the named existing workflow for the AI to edit instead of recreate. It’s an example of output quality tailored to the person operating the agent.
🎯 Practical tip
Test with a price-match email (usually a partial match) to see the medium/low badge appear. The badge is internal: it guides the review; it isn't shown to the customer.
Self-healing (optional): what should be the FIRST enhancement step, before the others?
📌 Module Summary
Next Track:
Track 2 — Mastering the Code Agent: agentic workflows, the WAT framework, MCP, skills, and token management.