n8n Gmail AI Agent That Drafts Replies (Free Template with Guardrails, Never Sends)
Search for "n8n Gmail AI agent" and most templates do one thing: pass the email to a model and send (or draft) whatever comes back. That works in a demo. In a real inbox, the problems are quieter. The model offers a discount you never approved, leaves "[Your Name]" in the signature, replies to a newsletter, starts a new thread instead of replying in the old one, or stacks three labels on the same email. This template keeps the agent and adds the boring checks that stop those mistakes.
Free download: n8n-gmail-ai-email-assistant.json (import with Workflows → Import from file). It has no credentials inside; you attach your own Gmail, Google Sheets and OpenAI accounts. It is also submitted to the n8n template library (pending review).
What the workflow does
| Step | n8n node | What happens |
|---|---|---|
| 1. New email | Gmail Trigger (full message) | Polls the inbox, skipping anything already labeled by the workflow, promotions, social and your own mail |
| 2. Pre-filter | Code + If | Skips no-reply senders, mailing lists (List-Unsubscribe / List-Id), bulk and auto-submitted mail, blocked domains and empty bodies. No AI call for these. |
| 3. AI Agent | AI Agent + OpenAI Chat Model + Window Buffer Memory (keyed by thread) | Classifies the email and drafts a reply using two tools: Look Up Approved Answers (a Google Sheets tab you control) and Read Thread History (Gmail) |
| 4. Structured output | Structured Output Parser | category, needs_reply, urgency, summary, reply_body, facts_used, commitments, missing_info, confidence |
| 5. Guardrails | Code + If | Mechanical checks before anything is drafted (below) |
| 6. Draft in thread | Gmail: create draft with threadId + sendTo | The draft sits in the original conversation, addressed to the sender. You review and press send. |
| 7. Label and log | Gmail (remove, then add label) + Switch + Google Sheets | Exactly one of AI/Drafted, AI/Needs Review or AI/Skipped, and a log row with the reason |
| 8. Daily digest | Schedule Trigger + Sheets + Code + Gmail | At 5pm, one email listing what needs you and why. Nothing to review means no email. |
The guardrails (why this isn't just "AI replies to email")
- Approved commitments only. You list what you're allowed to offer (for example "Free 15-minute intro call"). If the draft promises anything else, it goes to review.
- Risky wording is caught even when paraphrased. The workflow removes your approved offer text from the reply, then looks for money, %, refund, discount, waive/waiver, deadlines and guarantees in what is left. "We can waive part of the fee" is caught the same way as "15% off", and so is "15% off" sitting next to an approved "free intro call".
- No placeholders. "[Your Name]", "[Customer Name]" or curly-brace template tags send the draft to review. A missing sign-off is added from your settings.
- Recipient check. No valid sender address means no draft.
- Confidence and category. Below your minimum confidence, or a category you didn't allow for auto-drafting, goes to review.
- Failures aren't silent. If the model or the draft step errors, the email is labeled AI/Needs Review and logged instead of disappearing.
Setup (about 15 minutes)
- In Gmail, create three labels:
AI/Drafted,AI/Needs Review,AI/Skipped. Pick them in the label nodes (they start as PICK_ placeholders). - Create a Google Sheet with two tabs. Approved Answers:
topic, approved_answer, notes. Log:logged_at, from, subject, category, decision, reasons, urgency, confidence, summary, proposed_reply, draft_id, thread_id. - Open Settings (edit me): your name, email, business context, approved offers, auto-draft categories and minimum confidence.
- Attach Gmail, Google Sheets and OpenAI credentials. Run one email by hand, check the draft, then activate.
Tested how
We imported the workflow into n8n 2.44.4 and ran it with test emails against a mock model: a lead asking for a call (drafted in thread), a reply that tried to "waive part of the fee" (sent to review), an approved intro call with an extra "15% off" (sent to review), a newsletter (skipped with no AI call), a model error (sent to review), a receipt (skipped) and a draft with a "[Customer Name]" placeholder (sent to review). Test it on your own inbox with real credentials before you turn it on.
Related: if your inbound emails are seller leads, the seller lead analysis guide shows how to turn them into a call brief. For a job search inbox, see the tracker and reminder guide.
Free: AI Prompt Pack for Wholesalers & Job Seekers
10 copy-paste prompts from our paid packs: seller lead triage, underwriting, objection replies, job fit scoring, honest cover notes and interview prep. Free download (PDF); Gumroad asks for your email so it can send you the file.
Get the free prompt packNo email? Download the PDF directly.
Want an agent for your leads, not just your inbox?
Our paid agents use the same "AI drafts, you decide" approach: the Seller Intake + Offer Underwriting Agent turns seller leads into call-ready briefs, and the AI Job Search Autopilot scores jobs and drafts honest cover notes.
See the Seller Agent: $79 See the Job Autopilot: $29FAQ
Does this n8n Gmail AI agent send emails automatically?
No. It only creates drafts in the original thread. You review and press send. Emails that fail a guardrail get the AI/Needs Review label instead of a draft.
Can it use my own answers instead of making things up?
Yes. The agent looks up a Google Sheets tab of approved answers, and the guardrails send any reply that promises something not on your approved list to review.
Which model does it need?
Any OpenAI chat model that supports tool calling; the template defaults to gpt-4o-mini. You can swap in another chat model node supported by the n8n AI Agent.