How to Build an AI Agent with n8n: A Beginner's Guide for Small Business (Step by Step)
Updated 2026-10-25 · AI Agent Starter Kit
"AI agent" gets used for everything from a chatbot to a fully autonomous robot employee. For a small business, the useful version is much simpler: a workflow that wakes up on its own, reads something (your inbox, your calendar, a lead form), asks an AI model to make a judgment call, and then does one safe, useful thing with the answer.
n8n is a good place to build that. It is a visual workflow tool you can run on n8n Cloud or host yourself for free, it connects to Gmail, Google Sheets, Slack and hundreds of other apps, and it has built-in nodes for calling AI models. This guide walks you through the parts every agent needs and then a complete first build you can finish in an afternoon.
What an AI agent is (in plain terms)
Strip away the hype and a practical agent has three jobs:
- Notice something: a new email, a new lead, a time of day.
- Decide something: is this urgent, what kind of request is it, what should the reply say.
- Act on it: add a label, save a draft, log a row, send you a summary.
The AI model only does step 2. Everything else is ordinary automation, which is good news, because ordinary automation is predictable and easy to test.
The 5 parts every useful agent needs
1. A trigger. What starts the run. In n8n this is the first node: a Schedule Trigger (every morning at 7 AM), a Gmail Trigger (every new email), or a Webhook (a form submission).
2. Context. The facts the AI needs to make a decision. For a morning briefing that might be today's calendar events and the last 24 hours of unread email. Keep it small. Sending fewer, cleaner facts gets better answers and costs less.
3. Instructions. The prompt. Tell the model its role, what to produce, and what format to return. Ask for JSON when the next node needs to read the answer, and give an example of the exact shape you want.
4. A safe action. What happens with the answer. The safest actions write to places only you see: a Gmail draft, a label, a row in a sheet, an email to yourself. Avoid anything that sends to customers automatically until you have watched the agent work for a few weeks.
5. Guardrails. Checks that run after the AI answers. Does the JSON parse? Is the category one of the allowed values? Does a draft reply promise a price or a date it shouldn't? A small Code node can catch most problems before they reach the action.
Step by step: build a morning briefing agent
This is a good first agent because it is read-only. It can't send anything to anyone except you.
Step 1: Add a Schedule Trigger
Create a new workflow and add a Schedule Trigger set to every weekday at 7 AM. While you build, use the "Execute workflow" button to run it manually.
Step 2: Pull today's calendar
Add a Google Calendar node with the "Get Many" operation for your calendar, limited to events between now and the end of today. Connect your Google account with OAuth when n8n asks.
Step 3: Pull recent email
Add a Gmail node with "Get Many" messages, filtered with a search like is:unread newer_than:1d -category:promotions. Limit it to about 20 messages so the prompt stays small.
Step 4: Trim the data with a Code node
Raw API data is noisy. Add a Code node that keeps only what matters: event time and title, and for each email the sender, subject and the first few hundred characters of the snippet. Combine it into one short block of text.
Step 5: Ask the AI model
Add an AI node (the OpenAI node works with any OpenAI-compatible provider). A prompt along these lines works well:
You are my morning briefing assistant. From the calendar and emails below, write a short briefing with three sections: Today's meetings (time and title), Emails that need me (at most 3, with one line on why), and One priority (the single most important thing to do first). Plain text, under 200 words. Only use facts from the data below. If something is unclear, say so instead of guessing.
The last two sentences matter. They tell the model not to invent details, which is the most common failure in briefing agents.
Step 6: Send the briefing to yourself
Add a Gmail node that sends an email to your own address only, with the AI's answer as the body. Hardcode your address in the node so the agent can never email anyone else.
Step 7: Test, then turn it on
Run it manually a few times on real days. Check that the meetings match your calendar and that the "needs me" emails are actually the right ones. Adjust the Gmail search and the prompt until it's useful, then activate the workflow.
Safety rules for small business agents
- Drafts, not sends. Anything that goes to a customer should land in Drafts for you to review. The drafts-only AI email assistant guide explains why this one rule prevents most disasters.
- Treat email content as untrusted. An email can contain text that tries to give your agent instructions. Never let the content of an email decide where something gets sent. The guide on prompt injection in email agents covers the details.
- Code does the math. If the agent reports numbers (leads this week, overdue invoices), count them in a Code node and let the AI write only the wording.
- Log what it does. A Google Sheet row per run makes it easy to spot when something drifts.
Common mistakes
Sending too much context. Dumping 200 emails into a prompt is slow, expensive and produces vaguer answers. Filter first, then summarize.
No output format. If the next node needs a category, ask for JSON with fixed values and check them in code. Free-text answers break workflows.
Starting with something risky. Your first agent should not be an auto-responder to customers. Start read-only, earn trust, then add drafts.
Skipping error handling. Add an error workflow, or at least an IF node that emails you when the AI step fails, so a silent failure doesn't go unnoticed for a week.
What to build next
Once the briefing works, the same five parts give you more useful agents:
- Inbox triage: label every new email by type and draft replies for the ones that need one. See the n8n Gmail triage workflow guide.
- Lead follow-up: draft a personal first reply within minutes of a new inquiry, then Day 2, 5 and 10 follow-ups. See speed-to-lead automation.
- Weekly report: count your week's numbers and get a one-page summary every Monday. See the automated weekly CEO report.
If you're comparing tools before you start, the n8n vs Zapier guide covers the trade-offs for small teams.
Skip the build
The free Morning Briefing Agent is the workflow from this guide, already built and tested: one calm 7 AM email with your meetings, the emails that matter and one priority. Import it into n8n, connect your accounts and you're done in about 10 minutes. Get it free
When you're ready for more, the Solo Ops Command Center bundles three agents (inbox triage with reply drafts, lead follow-up, and the Monday CEO report) plus a dashboard, all built on the same drafts-only safety rules.
Morning Briefing Agent
One calm 7 AM email: your meetings, the 3 emails that matter, and one priority. Read-only. 10-minute setup.
Get it freeSolo Ops Command Center
All three paid kits (Inbox Chief of Staff, Speed-to-Lead, Weekly CEO Report) plus a bundle-only dashboard sheet. $87 separately.
Get the bundle ($69)One tested AI workflow a week
Short, practical n8n and Gmail automations for one-person businesses. Drafts-only, human-in-the-loop, no hype. Unsubscribe anytime.
Subscribe freeMore guides
- How to Set Up an AI Email Assistant That Never Sends Without You (n8n + Gmail)
- n8n Gmail Triage Workflow: Auto-Label Every Email With AI (Free Template Logic)
- Prompt Injection in Email: How to Keep Your AI Inbox Assistant From Getting Tricked
- Build an AI Morning Briefing: Calendar + Inbox + One Priority in a 7 AM Email
- Speed-to-Lead for Solo Businesses: Reply in 5 Minutes Without Sounding Like a Bot
- Weekly Business Report Automation: An Automated Weekly CEO Report for Solo Businesses
- n8n Templates for Small Business: 8 AI Agent Workflows Worth Setting Up First
- AI Agents for Small Business: A Beginner's Guide for Solo Owners
- Lead Follow-Up Email Templates: Day 2, Day 5 and Day 10 (Copy and Paste)
- Small Business KPI Dashboard in Google Sheets: A Weekly Template for Solo Owners
- n8n vs Zapier for Small Business: Which One Should a Solo Owner Pick?
- Customer Email Reply Templates for Small Business: 8 Copy-and-Paste Replies (and How to Have AI Draft Them)
- Lead Tracking Spreadsheet for Small Business: A Simple Google Sheets Template (Columns, Statuses and Formulas)
- How to Organize Your Gmail Inbox for a Small Business: Labels, Filters and a 15-Minute Daily Routine
- Weekly Review Template for Small Business Owners: 30 Minutes Every Monday (Free Checklist)
- ChatGPT Prompts for Business Emails: 12 Copy-and-Paste Prompts for Small Business Owners