Home / Guides

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:

  1. Notice something: a new email, a new lead, a time of day.
  2. Decide something: is this urgent, what kind of request is it, what should the reply say.
  3. 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

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:

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.

Free template

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 free
Bundle: best value

Solo 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)
Free weekly email

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 free

More guides