Skip to main content
Beginner⏱ 2-3 hours

How to Automate a Workflow With AI: Build Your First One

By Thomas Lovas Lokoy•20 April 2026•11 min read

Affiliate disclosure: This article contains affiliate links. If you click a link and make a purchase, we may earn a commission at no extra cost to you. Our editorial recommendations are never influenced by commissions — read our full disclosure policy.

Difficulty: Beginner to intermediate | Estimated time: 2–3 hours for your first automation

---

To automate a workflow with AI, pick one frequent, rule-based task, build it as a short chain — a trigger, an AI step that classifies or drafts, a human approval, an action and a log — test it on five real past examples, and measure the time it saves over 30 days before automating anything else. This tutorial builds one concrete example end to end: triaging support emails and drafting replies in n8n, with a person approving every reply before it is sent.

What you need

  • A workflow tool. We use n8n: a visual builder whose AI Agent node "decides which tools to call to complete a task". n8n Cloud lists Starter at €20 a month (2,500 executions) billed annually, and a self-hosted version is available on GitHub. Our tutorial on self-hosting an AI agent on a VPS covers running it yourself.
  • A Gmail account with a label for support mail (for example "Support").
  • An AI model account to connect to the AI Agent node.
  • Slack or another approval channel. n8n's documentation lists Slack, Microsoft Teams, Gmail, Telegram, Discord and others for approval requests.
  • A spreadsheet for logging.

Step 1: List your weekly repeat tasks

Write down every task you repeat at least weekly that follows roughly the same steps: answering common emails, formatting a report, posting to social channels, copying data between systems. Do not filter yet. If it helps to see dependencies, map them in a tool such as MindManager.

Step 2: Pick the first task with a simple test

Score each task on frequency (how often) and judgement (how much thinking it needs). Choose one that is frequent, low-judgement and low-risk if something goes wrong. Support triage fits: the categories are predictable, and a human can approve each reply. Social posting is another good first candidate — a scheduler such as Vista Social handles that without building anything.

Step 3: Write the rules down before you build

Automation fails when the rules only exist in your head. For support triage, write:

CategoryHow to recognise itWhat to do
Order statusMentions an order number or deliveryDraft a reply with the tracking link template
Refund requestAsks for money backDo not draft — flag for a person
Product questionAsks how something worksDraft a reply from the FAQ text
OtherAnything elseFlag for a person

Step 4: Add the trigger

In n8n, add a Gmail Trigger node. Its event is "Message Received", and it checks for new messages on a poll schedule you choose. Set Label Names or IDs to your Support label and leave Read Status on unread. The node fetches up to 10 emails per poll by default and queues the rest for the next cycle.

Step 5: Add the AI step

Add an AI Agent node after the trigger and connect a chat model. n8n requires at least one connected tool; connect a tool that can look up your FAQ text, such as a spreadsheet or document lookup. Give it instructions that mirror your rules table:

"Classify this email as one of: Order status, Refund request, Product question, Other. Reply with the category on the first line. For Order status and Product question only, draft a reply in our tone using only the FAQ sheet. If the FAQ does not cover it, write NEEDS HUMAN instead of a draft. Never promise refunds."

Step 6: Put a person in the loop

Add an approval before anything is sent. n8n's human-in-the-loop feature pauses the workflow and "waits for a person" to approve or deny; if denied, the action does not run. Send the approval to Slack with the original email, the category and the draft. Route Refund request, Other and NEEDS HUMAN straight to a person without a draft.

Step 7: Send and log

After approval, add a Gmail node to send the reply, then append a row to your spreadsheet: date, sender, category, approved or edited, and minutes you estimate it saved. That log is your evidence in Step 9.

Step 8: Test on five real past emails

Before switching the trigger on, run the workflow manually on five real emails from last week. For each, record whether the category was right and whether the draft was usable as-is, usable with edits, or wrong. Three usable drafts out of five is a reasonable bar to go live in approval mode; below that, tighten the instructions and FAQ text and test again. Pay most attention to the strange ones — edge cases break automations.

Step 9: Measure for 30 days, then decide

Turn the trigger on, keep approval on, and review the log weekly. Count net time: minutes saved minus minutes spent fixing drafts and checking the workflow. After 30 days, keep it, change it or switch it off. Only then pick task number two.

Troubleshooting

SymptomLikely causeFix
Wrong categoriesVague instructionsGive one example email per category in the prompt
Drafts invent policiesModel not restricted to your textTell it to use only the FAQ tool and to write NEEDS HUMAN otherwise
Same email processed twiceRead status or label not updatedMark as read or move the label after processing
Approvals pile upToo many categories draftedDraft only the simplest categories; flag the rest

Frequently asked questions

What is the easiest workflow to automate with AI?

A frequent, rule-based, low-risk task — sorting and drafting replies to common emails, formatting a recurring report, or scheduling social posts. Start with one and keep a human approval step.

Do I need to code to automate with AI?

No. Visual tools such as n8n connect triggers, AI steps and actions without code, and hosted agent platforms take plain-language instructions. Some scripting helps for edge cases.

How do I stop an AI automation making mistakes?

Restrict it to your own source text, give it a way to say it does not know, and require a person to approve anything that is sent, paid or deleted. n8n, for example, can pause a step until someone approves it.

How much does it cost to automate a workflow?

It depends on the tool and volume. n8n Cloud listed its Starter plan at €20 a month for 2,500 executions on annual billing, a self-hosted version is available, and your AI model usage is billed separately — see how AI agents are priced.

Next steps

The design principles behind this build are in how to build an AI agent workflow, and choosing tools for the wider stack is covered in how to build an AI agent stack. For more tools, see best AI productivity tools and best AI agents 2026.

Sources checked 16 October 2026: n8n Docs (Gmail Trigger node; AI Agent node; human-in-the-loop for AI tool calls); n8n.io/pricing. Editorial tutorial.

Covered in this guide

Written by Thomas Lovas Lokoy, Co-founder & Editor — researched and drafted with AI assistance, then read, fact-checked and approved by Thomas before publishing · Editorial policy · Disclosure · Last updated: 17 October 2026

A swirl of multicoloured light filaments on black
Tutorial

More tutorials

Continue in this collection