What is an AI agent, really?
An AI agent is an automation that (1) is triggered by an event, (2) uses a language model to reason about what to do, and (3) takes an action using real tools — sending an email, updating a sheet, posting a message. The reasoning step is what separates an agent from a plain if-this-then-that automation.
n8n is the ideal home for agents because it gives you the triggers and the 400+ tool integrations, while a model like Claude provides the reasoning. You self-host it or use n8n Cloud, and every run stays on your own infrastructure.
What you'll need
- An n8n instance (free self-hosted, or n8n Cloud from ~$20/mo)
- An Anthropic API key for Claude (the reasoning layer)
- One tool account to act on — Gmail, Slack or Google Sheets is a great first choice
Step 1 — Pick a job small enough to trust
Do not start with 'run my whole business'. Start with one narrow job: 'when a new lead email arrives, draft a reply in my voice'. A tight scope is what makes an agent reliable.
Step 2 — Add a trigger
In a new workflow, add a trigger node for your event — a Gmail Trigger on new email, a Webhook for form submissions, or a Schedule Trigger to run on a timer. This is the agent's 'when'.
Step 3 — Add the reasoning step (Claude)
Add an AI/LLM node and connect your Claude API key. This is the brain. Give it a clear system prompt with the task, the input data from the trigger, and — critically — the exact output format you want (e.g. 'Return only the reply text, under 120 words, friendly and professional').
Step 4 — Add the action and guardrails
Wire the model's output into an action node (Gmail 'Create Draft', not 'Send', for your first run). Add an IF node as a guardrail so the agent only acts when it is confident — e.g. skip anything flagged as spam or off-topic. Guardrails are what let you sleep at night.
Step 5 — Test on real data, then activate
Run the workflow manually against a few real emails. Read the drafts. Once it is consistently good, switch the draft node to send and activate the workflow. Your first agent is now running 24/7.
Shortcut: start from a proven recipe
You do not have to build from scratch. Every recipe on FlowRecipesHub is a complete agent you can import and adapt. Browse the Gmail agents, Slack agents or everything that uses Claude.
Browse the agent library →Frequently asked questions
Do I need to know how to code?
No. n8n is a visual, node-based tool. The only 'code' is the plain-English prompt you give the model. Our recipes are written for business owners, not developers.
How much does it cost to run an agent?
n8n is free self-hosted. The main cost is model usage (Claude), which for most single-task agents is a few cents per run. You control the volume.
Is my data safe?
Agents run in your own n8n instance, so your data and credentials never touch our servers. We only host the recipe library.