n8n Tutorial for Beginners – Full Guide for Automation, Workflows & First AI Agent

In this AI era, we all want our own AI agent to handle tasks automatically — but most of us don’t know how or where to start. So we search for things like “n8n tutorial for beginners – full guide”, “n8n automation”, or “how to build an n8n AI Agent”, hoping to find the answer.
You’re probably wondering:
- What is n8n, and what is it used for?
- How are n8n AI Agents different from regular automations?
- Can I build my own AI Agent without coding?
And yet… even after reading guides, you might still not get a satisfying result. I faced the same problem when I first tried to create my own AI agent.
But here’s the good news — since you’re still reading this, believe me, you’re just minutes away from building your first AI agent. In this guide, I’ll take you from zero to running your first automation and AI-powered agent, step-by-step.
By the end, you’ll know:
- What n8n is and why people use it
- What are n8n AI Agents, and the types you can build
- How to create your first workflow (automation)
- How to upgrade it into a smart AI Agent
- Practical examples you can copy and use right now
What is n8n?
n8n (pronounced “n-eight-n”) is an open-source, low-code automation platform that lets you connect apps, APIs, and AI models to run workflows automatically.
Think of it as a visual drag-and-drop control room for your tasks—everything from sending emails, processing data, updating spreadsheets, to talking with AI.
Key Features
- Automation without coding – You connect “nodes” that represent apps or actions.
- AI-ready – Works with ChatGPT, Claude, and other LLMs to add intelligence to workflows.
- Open-source + free self-hosting – Or use n8n Cloud for quick setup.
- Highly flexible – Hundreds of integrations plus custom API calls.
- Scalable – Start small, grow into enterprise-grade processes.
What is n8n Used For?
n8n is a universal automation tool. Here’s what that means in practice:
Use Case | Example Workflow | Why n8n Works Well |
---|---|---|
Marketing Automation | Capture lead → Enrich with API → Score with AI → Add to CRM | Automates multi-step tasks across tools |
Customer Support | New email → AI summarizes → Create support ticket → Notify Slack | Saves hours in triage work |
Data Processing | Pull data from API → Clean & format → Save to Google Sheets | Handles large, repetitive jobs |
Content Creation | Draft blog with AI → Upload to CMS → Notify editor | Speeds up production pipeline |
Reporting | Pull sales data → Summarize → Send daily report email | Speeds up the production pipeline |

What are n8n AI Agents?
An n8n AI Agent is a special kind of workflow you create in n8n that doesn’t just follow a strict set of rules — it can think, interpret, and adapt using artificial intelligence.
Think of it like this:
- A normal automation is like a vending machine — you press a button, and it gives you the same snack every time.
- An AI Agent is like a personal assistant — you tell it what you want, it understands the context, asks clarifying questions if needed, and then delivers a custom solution.
The Difference Between Normal Automation and an AI Agent
Normal Automation
- Works based on fixed “if this, then that” rules.
- Always produces the same output for the same input.
- Example: If a customer sends an email, it triggers an automatic “Thank you for your message” reply, no matter what the email says.
AI Agent
- Uses AI to understand the content of the input.
- Makes decisions based on the situation.
- Can produce different, context-aware outputs each time.
- Example: If a customer sends an email, the AI Agent:
- Reads the message.
- Identifies the intent (e.g., product question, complaint, refund request).
- Decides whether to escalate to support or respond automatically.
- Write a personalized reply in the correct tone.
What are the Types of n8n AI Agent?
From the transcript and real-world workflows, here are common agent types:
- Information Retrieval Agents are designed to fetch live, up-to-date data from sources like weather APIs, stock market feeds, or news sites, then process and summarize that information so it’s easy to understand. Instead of you manually checking multiple sites, the agent gathers everything and delivers a concise update, often tailored to your preferences.
- Customer Support Agents go a step further. They can read incoming messages or support tickets, understand the intent behind them, and decide on the best course of action. This could mean classifying the request, drafting a personalized response, and logging all details into your CRM or helpdesk automatically, reducing the workload for human agents and speeding up response times.
- Content Generation Agents focus on producing new material using AI prompts. They can write articles, social media posts, or product descriptions, generate images, or prepare reports — all based on the instructions you provide. This makes them invaluable for marketing, blogging, and creative workflows.
- Data Transformation Agents specialize in cleaning and reformatting information. They might take messy spreadsheet entries, validate them against rules, fix inconsistencies, and output them in a structured format that’s ready for analysis or reporting. This is especially useful when integrating data from multiple sources that don’t match in format.
Finally, Decision-Making Agents blend AI reasoning with your own rules to choose the right action in complex situations. For example, they might check whether a customer’s refund request meets your policy, then automatically approve it, reject it, or escalate it for review. These agents save time by making context-aware decisions that would otherwise require human judgment.
n8n Automation for Beginners: Weather Report
Step-by-step: simple automation first
Prerequisites (start here)
- Choose where to run n8n
- Easiest: n8n Cloud (sign up, no server setup).
- Or self-host (Docker/VM).
- Have a Gmail account ready (to send the email).
1) Create a new workflow
- Open n8n → New Workflow → name it:
Daily Weather Email
.
2) Add triggers (how it starts)
- Click Add first step → search Manual Trigger → add it (for testing).
- Click + → add Schedule Trigger.
- Set every day at 06:00.
- Make sure the timezone matches your local time (e.g., America/Chicago).
3) Fetch weather data (HTTP Request)
- Click + after a trigger → add HTTP Request.
- Method:
GET
- URL: use Open-Meteo (replace lat/long with your city): bashCopyEdit
https://api.open-meteo.com/v1/forecast?latitude=41.87&longitude=-87.62&daily=temperature_2m_max,temperature_2m_min&forecast_days=1&temperature_unit=fahrenheit&wind_speed_unit=mph
- For °C, use
temperature_unit=celsius
and km/h if you prefer. - Tip: find your latitude/longitude via Google Maps (right-click a spot → copy coords).
- For °C, use
- Click Test Step → You should see JSON with
daily.temperature_2m_max/min
.
4) Turn raw JSON into a neat sentence (Code node)
- Click + after HTTP Request → add Code → JavaScript.
- Paste this code: javascriptCopyEdit
// Read Open-Meteo response and craft one-line message const d = $json.daily || {}; const units = $json.daily_units || {}; const hi = Array.isArray(d.temperature_2m_max) ? d.temperature_2m_max[0] : null; const lo = Array.isArray(d.temperature_2m_min) ? d.temperature_2m_min[0] : null; const unit = units.temperature_2m_max || "°"; // Optional: rename location to your city for a nicer line const location = "Chicago"; // change to your city name const line = `Today in ${location}: High ${Math.round(hi)}${unit}, Low ${Math.round(lo)}${unit}.`; return [{ json: { message: line } }];
- Click Test Step → output should show
{ message: "Today in Chicago: High 70°F, Low 55°F." }
- If you used Celsius, the unit will reflect that.
(Don’t want to code? You can also ask ChatGPT to “write an n8n Code node that converts this Open-Meteo JSON into ‘Today in <city>: High X, Low Y’.” Then paste the result here.)
5) Send the email (Gmail node)
- Click + after Code → Gmail → Send a Message.
- Connect your Gmail with OAuth (Create New Credential → Sign in with Google).
- To: your email (e.g.,
me@domain.com
) - Subject:
Weather Report for Today
- Email Type:
Text
- Body: click the gear/Expression icon → choose Current Node → Previous Node (Code) → message (or type
{{$json["message"]}}
). - (Optional) In Options, disable “Append n8n attribution”.
- Click Test Step → check your inbox for the message.
6) Wire everything (ensure flow)
- Make sure both Manual Trigger and Schedule Trigger connect into HTTP Request → Code → Gmail in a straight line.
- If you see loose nodes, drag connectors so the flow is:
Manual Trigger → HTTP → Code → Gmail
andSchedule Trigger → HTTP → Code → Gmail
.
7) Test end-to-end (manual run)
- Click Execute Workflow (or Test Workflow) with the Manual Trigger selected.
- Confirm the Gmail step succeeds and the email arrives.
8) Activate (how it ends)
- Click Activate (top-right).
- You’re done. n8n will now run this at 6:00 AM daily and email you the weather line.
9) Common tweaks (optional)
- Change the city name in the Code node.
- Switch to °C/km/h by editing the URL.
- Add more daily fields (e.g., precipitation) in the URL and message.
- Send to Slack/Teams instead of Gmail by swapping the last node.
10) Next step (when you’re ready)
- Convert this into an AI Agent:
- Replace Manual/Schedule with a Chat Trigger.
- Add AI Agent node (OpenAI/other LLM) + Memory.
- Expose the same HTTP request as a Tool the agent can call.
- Let the agent answer “What’s the weather tomorrow?” and ask if it should email the summary.
That’s it—you started at zero and ended with a live, scheduled automation that emails you daily weather at 6 AM.
Turn n8n Automation into an AI Agent
Prerequisites
- OpenAI API key (Platform API, not ChatGPT web).
- Gmail is already connected in n8n (OAuth).
- Your Open-Meteo HTTP URL from the earlier automation (we’ll reuse it).
1) Change the Trigger → Chat Trigger
- Create a new workflow:
Weather Chat Agent
. - Click Add first step → search Chat → choose On Chat Message (Chat Trigger).
- (Optional) In the chat panel (bottom-left in n8n), you’ll be able to type messages like:
What’s the weather tomorrow in Chicago?
Email me a short report.
Why: This lets you interact with the workflow like a chatbot.
2) Add the AI Agent Node (with Memory)
- Click + → add AI Agent node.
- Prompt source: set to Use connected chat node (so whatever you type becomes the user message).
- Chat model: click + and select OpenAI → choose a model (e.g.,
gpt-4o
orgpt-4o-mini
). - Memory: click + Memory → choose Simple memory → set Context window to 10 (remembers the last ~10 turns).
- System/Instructions (inside AI Agent → “Define below” or “System Prompt” area, if available): paste something like: pgsqlCopyEdit
You are a helpful weather assistant. - If city/date are missing, ask a brief clarifying question. - Prefer concise answers with high/low and simple advice (umbrella/jacket). - Use tools when useful (weather API for facts; Gmail only after explicit consent). - Before sending an email, ALWAYS ask: “Should I email this report now?” and wait for a clear “yes”. - If email is approved, keep subject 3–5 words; body 1–3 short paragraphs.
- Connect Chat Trigger → AI Agent.
Why: The model + memory makes your agent conversational and able to remember context across turns.
3) Add Tools the Agent Can Use
A) “Get Weather” Tool (HTTP Request)
- In AI Agent, click + Tool → choose HTTP Request.
- Tool name:
get_weather
- Description:
Fetches weather forecast from Open-Meteo. Accepts city (or lat/long) and date.
- URL: start with your working Open-Meteo link (e.g., daily max/min for 1–3 days).
- To make it flexible, allow the model to define parameters. For example:
- Keep a base URL like
https://api.open-meteo.com/v1/forecast
- Add Query params and set some to “Let the model define this parameter”:
latitude
(model-defined or default)longitude
(model-defined or default)daily=temperature_2m_max,temperature_2m_min,precipitation_probability_max
forecast_days
(1–3, model-defined)temperature_unit
(Celsius/Fahrenheit, model-defined)timezone
(e.g.,America/Chicago
)
- Keep a base URL like
- To make it flexible, allow the model to define parameters. For example:
- In the tool Description, give the model a hint on how to resolve a city: rustCopyEdit
If user gives a city, use a known default lat/long for major cities or ask for it. If not provided, ask: “Which city?” before calling.
- (Optional) Add guardrails: “Only call domains under
open-meteo.com
.”
Why: This lets the agent pull live, factual weather data when answering.
B) “Send Email” Tool (Gmail)
- In AI Agent, click + Tool → choose Gmail → Send a Message.
- Credential: pick your connected Gmail.
- To:
- Easiest & safest: fixed to your own email (e.g.,
me@domain.com
). - If you want dynamic recipients later, add an approval step first.
- Easiest & safest: fixed to your own email (e.g.,
- Subject: enable Let the model define this parameter.
- Instruction:
3–5 words, short and enticing (e.g., “Tomorrow’s Quick Forecast”).
- Instruction:
- Body: enable Let the model define this parameter.
- Instruction:
Summarize weather for the requested city/date. Include high/low and simple advice.
- Instruction:
- Options: disable “Append n8n attribution” (if available).
- Description (important guardrail): pgsqlCopyEdit
Only send after user explicitly confirms (e.g., “yes, send it now”). If not confirmed, draft a preview text in your reply instead of sending.
Why: Gives the agent the power to email, but only after explicit approval.
4) Wiring & Flow
- Chat Trigger → AI Agent (the agent will autonomously call the tools you added when needed).
- You don’t need to wire HTTP or Gmail as separate nodes in the canvas when added as Agent Tools—the agent calls them internally.
5) Test the Conversation (End-to-End)
Try a realistic chat in n8n’s chat panel:
You: What’s the weather tomorrow in Chicago?
Agent: (Calls get_weather
tool) Looks mild: High 72°F, Low 54°F, low chance of rain. Want me to email a quick report?
You: Make it funny and send it.
Agent: Here’s a preview: “Sun’s out, fun’s out—pack sunglasses and a light jacket.” Send this to your email now?
You: Yes, send it now.
Agent: (Calls Gmail tool) Done. I’ve emailed the report.
If you don’t specify a city or date, the agent should ask a quick clarifying question (thanks to your instructions and memory).
6) Optional “Approval” Safety Net (Recommended)
If you want hard approval before sending an email:
- Replace the Gmail “Send Message” tool with “Create Draft” (if available), or
- Build a small approval branch:
- After the agent proposes an email, use an IF node to check a flag like
approved === true
(The agent sets this when the user says “yes”). - Only then call a standard Gmail Send node (outside the Agent) to send.
- After the agent proposes an email, use an IF node to check a flag like
Why: Prevents accidental emails and keeps you in control.
7) Make It Polished
- In the AI Agent system prompt, add:
- Style: friendly, concise; avoid long paragraphs.
- Units: respect the user’s region (°F/°C).
- Fallbacks: if the API fails, apologize and ask for another city/time.
- In the get_weather tool description, include unit handling and example coordinates for a few cities.
8) Activate
- Click Activate to make the chat endpoint live.
- (Optional) Expose via webhook or connect to a channel (WhatsApp/Slack/Telegram) if you want to chat with your agent outside n8n.
Troubleshooting Tips
- Model not calling tools? Loosen the instructions: “Use tools whenever they can improve factual accuracy.”
- City not recognized? Add a tiny lookup step or ask the user for lat/long.
- Are emails being sent too soon? Strengthen the rule: “Never send without an explicit ‘yes, send’.”
Why Beginners Love n8n AI Agents
- Start with no code, add AI later. You can build a working flow using drag-and-drop nodes (Gmail, Sheets, HTTP) and only introduce AI when you’re ready. For example, first send a daily email from a spreadsheet; later, drop in an LLM node to summarize or personalize that email.
- It’s visual—you see data between steps. Every node shows inputs/outputs, so you can open a node and instantly understand what’s passing through. This makes debugging far easier than black-box scripts.
- Mix static logic + dynamic AI. Combine IF/Switch rules for the predictable parts and use AI for the “it depends” parts—like classifying intent, drafting replies, or deciding escalation. If AI can’t decide, route to a safe fallback path.
- Connect hundreds of apps instantly. n8n integrates with tools you already use—Gmail, Slack, Notion, HubSpot, Airtable, Stripe, and more—so your agent can read, reason, and then actually do things in your stack.
Beginner Tips: n8n Automation & AI Agents
- Learn prompt engineering first. Clear, structured prompts = better agent decisions. Use Role → Task → Constraints → Output Format (often JSON) so downstream nodes can parse results reliably.
- Start small, then scale. Begin with one trigger and one action (e.g., Schedule → Gmail). Add nodes one at a time, testing after each change. This keeps failures isolated and easy to fix.
- Use the Test button constantly. Test each node, inspect the JSON, and confirm fields exist before the next step uses them. Catching a missing key early saves hours later.
- Store API keys in Credentials. Never hard-code secrets in nodes. Use n8n Credentials, separate dev/prod keys, and restrict scopes so your agent stays secure.
- Document as you build. Rename nodes clearly (“Get Weather,” “Summarize Email”), add short descriptions, and keep notes on prompts/assumptions. Future-you (and teammates) will thank you.
Final Thought
You now understand what n8n is and what n8n is used for (visual, low-code automation across your apps). You’ve learned what n8n AI Agents are and the common types you can build (retrieval, support, content, transformation, decision). You can build your first automation (e.g., daily weather email), then upgrade it into an AI Agent that chats, fetches live data, and only sends emails after your approval.
With just a Chat node, an AI Agent node, and a couple of tools (HTTP + Gmail), you can create assistants that not only automate repetitive tasks but also think, adapt, and act across your apps. When you’re ready, expand with more tools (Sheets/Notion/Slack) and refine prompts to make your agent smarter—one small improvement at a time.