Build your first agent in n8n

This walkthrough links to n8n's hosted plan — if you sign up through that link, we may earn a commission at no extra cost to you.
Most guides to AI agents start with the theory — planning loops, tool-calling, memory. We’re skipping that. This is the exact build we used to replace a client-onboarding checklist that used to eat forty-five minutes of manual work every time someone signed a contract.
By the end, you’ll have an agent in n8n that watches for a new signed contract, drafts a welcome email, creates the client’s folder structure, and pings you in Slack when it’s done — asking for your approval before anything gets sent.
What you’ll need
- An n8n instance — self-hosted or their hosted plan
- An OpenAI or Anthropic API key
- A Slack workspace you can install a bot into
Start with the trigger, not the agent
The mistake we made the first time: building the agent node before deciding what wakes it up. Start with the trigger. In our case, that’s a webhook from our contract tool firing the moment a document is signed — everything downstream depends on that payload being reliable, so test the trigger alone before you touch the agent node at all.
If your trigger is flaky, an agent built on top of it will just fail in more confusing ways. Get the boring part right first.
Wiring the agent node
n8n’s AI Agent node takes the webhook payload, a system prompt describing the onboarding steps, and a set of tools — in our case, a Google Drive node for folder creation and a Gmail node for the draft email. The agent decides the order and handles retries; you just define what tools it’s allowed to touch.
We kept a human in the loop deliberately: the final Slack message includes an approve/reject button before the welcome email actually sends. Two weeks in, that single gate has caught three cases where the contract data was malformed upstream — worth the extra click.
Join readers getting one email a week on what’s actually worth automating.