Skip to main content

n8n Tutorial 2026: From First Automation to First AI Agent

A beginner n8n tutorial for 2026: pick Cloud or self-hosting, build and publish a scheduled workflow, then add an AI agent with a tool. Checked October 2026.

AI Automation Architect

Published
Feb 1, 2026
Updated
Oct 11, 2026
Reading time
15 min read
Quick answer

This n8n tutorial takes a beginner from an empty canvas to a published workflow, then to a first AI agent. Start a 14-day n8n Cloud trial, which needs no card, or self-host the free Community Edition with Docker. Build a morning weather email with a Schedule Trigger, an HTTP Request node, Edit Fields and Gmail, test it with Execute workflow and select Publish so it runs on its own. Then connect a chat model, Simple Memory and an HTTP Request Tool to an AI Agent node and chat with it.

This n8n tutorial for beginners has two parts: build and publish a scheduled workflow from an empty canvas, then build an AI agent that calls a tool. Plan about 20 minutes for the first part on an n8n Cloud trial, and a little longer if you install n8n yourself. Every step ends with a checkpoint, so you know it worked before you move on.

Updated 11 October 2026. Every step, screen name and price was checked against n8n's documentation, its pricing page and the source of n8n 2.42.6, the latest stable release on 9 October 2026. This is the third version of this page: the February 2026 original recommended npm with Node.js 16, basic-auth settings and Function nodes, which n8n has since removed or is removing, and called n8n open source; the 1 October rebuild fixed that; this update adds the AI agent part and the checkpoints.

This page is the starting point of our n8n hub. If you only need one thing, use the section links: install or sign up, the first workflow, expressions, the first AI agent, or debugging.

The learning path on this page
  1. 01
    Choose where n8n runs

    A Cloud trial with nothing to install, or the free Community Edition in Docker.

  2. 02
    Learn the editor

    Canvas, node details view, Execute step, Publish, Executions.

  3. 03
    Build a scheduled workflow

    Schedule Trigger, HTTP Request, Edit Fields, Gmail.

  4. 04
    Publish it

    A workflow only runs on its own once it is published.

  5. 05
    Build an AI agent

    Chat Trigger, AI Agent, a chat model, memory and one tool.

  6. 06
    Keep going

    Four more workflows, debugging habits and common mistakes.

Before you start
  • An email address for an n8n Cloud trial, or Docker installed if you will self-host
  • A Google account if you want the workflow to send through Gmail
  • Your latitude and longitude, to two decimal places
  • For Part 2: Gateway credits on n8n Cloud, or an API key from a model provider
  • A browser tab with the n8n docs open, for when a label on your screen differs

What n8n is

n8n is a workflow automation tool. You build a workflow by connecting nodes on a canvas: a trigger node decides when the workflow runs, and the nodes after it fetch, change and send data. The n8n homepage cites over 500 integrations, and the HTTP Request node can call any REST API that has no dedicated node. When the built-in nodes aren't enough, the Code node runs JavaScript or Python, and the AI Agent node connects language models to your tools.

One thing older guides get wrong: n8n isn't open source. Its code is public under the Sustainable Use License, which n8n calls fair-code. You can use it free for your own business, personal or non-commercial work, but you can't, for example, host it as a service that lets your customers build their own workflows. n8n itself says it does not call itself open source.

Step 1: Choose n8n Cloud or self-hosting

OptionCostBest for
n8n Cloud free trialFree for 14 days, no credit card. Limits: 1,000 executions, 5 at a time, 180-second timeout, plus 100 AI creditsLearning n8n today with nothing to install
n8n Cloud Starter20 euros a month billed annually (24 euros month to month) for 2,500 executionsRunning a few real workflows without managing a server
n8n Cloud Pro50 euros a month billed annually (60 euros month to month) for 10,000 executionsHigher limits, admin roles and workflow history
Self-hosted Community EditionNo license fee; you pay for the server and your timeFull control, custom nodes, or keeping data on your own machines

Prices and limits are from n8n's pricing page on 11 October 2026. An execution is one full run of a workflow, however many steps it has, and only production runs count; manual test runs don't. Registering a free Community instance by email unlocks folders, debug in editor and custom execution data, per n8n's plan guide. Our n8n pricing guide compares the plans in more detail.

Run n8n on your own computer

n8n's one-line setup is the quickest local install. Install Docker first (it includes Docker Compose), then run:

curl -fsSL https://get.n8n.io | sh

The script checks Docker, creates an n8n folder with a Compose file and generated secrets, and starts n8n at http://localhost:5678 with its built-in SQLite database. On Windows, run it from WSL with Docker Desktop's WSL2 integration turned on. To upgrade later, run the same command with sh -s -- --upgrade at the end.

Skip older tutorials that use npx n8n or npm install -g n8n. n8n's 3.0 breaking-changes page says n8n 3.0 no longer supports npm or npx installs and needs a Docker-based deployment. On 11 October 2026 the newest stable release was still 2.42.6, so do the move now and the upgrade later; our n8n 3.0 guide covers it. For a server with your own domain, HTTPS, Postgres and backups, follow our n8n self-hosting guide.

Checkpoint: you can sign in and see either a welcome screen with Start from Scratch or the Overview page with Create workflow.

Step 2: Learn the editor

  • Canvas: where you place and connect nodes. The + connector on a node, or the N key, opens the nodes panel to search for the next node.
  • Node details view: double-click a node to open it. Input data is on the left, the node's parameters in the middle and its output on the right. Execute step runs just that node and whatever it needs before it.
  • Execute workflow: runs the whole workflow as a manual test, showing each node's data as it goes.
  • Publish: n8n saves your edits automatically, but they only go live when you publish. Publishing turns on schedules, app triggers and production webhook URLs, per n8n's publishing docs.
  • Executions tab: the history of each run, including failed ones you can open and debug.
  • Credentials: saved logins and API keys for apps. You create one once and reuse it in any node for that app.
ShortcutWhat it does
Ctrl/Cmd + EnterExecute the workflow
NOpen the nodes panel
= (in an empty field)Switch the field to an expression
P (node selected)Pin the node's output data for testing
Shift + SAdd a sticky note
Ctrl/Cmd + KOpen the command bar

From n8n's keyboard shortcuts page. n8n also has n8n Assistant, a chat that builds a workflow from your description, which n8n labels as Preview. Build this first workflow by hand anyway: you cannot check an assistant's work until you know what each node does.

Step 3: Build your first workflow, a morning weather email

This workflow checks the day's forecast every morning and emails you a one-line summary. It uses four nodes: Schedule Trigger → HTTP Request → Edit Fields (Set) → Gmail. The weather comes from Open-Meteo, whose free API needs no key; its terms allow it for non-commercial use under 10,000 calls a day.

The five steps, with the result to expect
  1. 1
    Add a Schedule Trigger

    Expected result: a trigger set to 7am daily, in the timezone you live in.

  2. 2
    Fetch the forecast

    Expected result: Execute step shows JSON with daily temperatures and a rain probability.

  3. 3
    Write the message

    Expected result: a field named summary that reads like a sentence.

  4. 4
    Send it with Gmail

    Expected result: Execute step puts the email in your inbox.

  5. 5
    Test, then publish

    Expected result: one green run in Executions, and the Publish button shows the workflow is live.

1. Add a Schedule Trigger

  1. Create a new workflow, select Add first step, search for Schedule and choose Schedule Trigger.
  2. Set Trigger Interval to Days, Days Between Triggers to 1, Trigger at Hour to 7am and Trigger at Minute to 0.
  3. Check the timezone. The Schedule Trigger uses the workflow's timezone (three-dot menu, Settings) if set, otherwise the instance's, which defaults to America/New York on self-hosted n8n.

2. Fetch the forecast with an HTTP Request node

  1. Add an HTTP Request node after the trigger. Keep Method as GET and set URL to https://api.open-meteo.com/v1/forecast.
  2. Turn on Send Query Parameters, choose Using Fields Below and add these name/value pairs (use your own coordinates):
NameValue
latitude40.71
longitude-74.01
dailytemperature_2m_max,temperature_2m_min,precipitation_probability_max
forecast_days1
timezoneauto

Select Execute step. The output looks like this (trimmed):

{
  "timezone": "America/New_York",
  "daily_units": {
    "temperature_2m_max": "°C",
    "temperature_2m_min": "°C",
    "precipitation_probability_max": "%"
  },
  "daily": {
    "time": ["2026-10-11"],
    "temperature_2m_max": [23.3],
    "temperature_2m_min": [16.0],
    "precipitation_probability_max": [1]
  }
}

The values are an example of the shape, not today's weather. Open-Meteo returns Celsius by default. For Fahrenheit, add a temperature_unit parameter set to fahrenheit.

3. Write the message with Edit Fields (Set)

  1. Add an Edit Fields (Set) node and keep Mode on Manual Mapping.
  2. Add a field named summary of type String. In the value box, type = to switch to an expression, then enter:
High {{ $json.daily.temperature_2m_max[0] }}°C, low {{ $json.daily.temperature_2m_min[0] }}°C, {{ $json.daily.precipitation_probability_max[0] }}% chance of rain.

Everything inside {{ }} is an expression. $json is the current item's data from the previous node, and [0] picks the first value because the API returns arrays. You can also drag a field from the INPUT panel into the box instead of typing the path. Execute the step and check that summary reads correctly.

4. Send it with Gmail

  1. Add a Gmail node and choose Resource Message, Operation Send.
  2. Create a credential. On n8n Cloud, select Sign in with Google. Self-hosted n8n doesn't offer that managed sign-in, so you create an OAuth app in Google Cloud first, following n8n's Google credential guide, or you swap Gmail for the Send Email, Slack or Telegram node.
  3. Set To to your address, Email Type to Text, Subject to Weather for {{ $today.format('cccc, d LLLL') }} and Message to {{ $json.summary }}.
  4. Under Options, turn off Append n8n Attribution if you don't want the "sent automatically with n8n" line the node adds by default.

5. Test, then publish

  1. Select Execute workflow. n8n runs each node in turn and shows its output, and the email arrives.
  2. Select Publish. From now on the Schedule Trigger runs the workflow every morning, and each run appears in the Executions tab.

Checkpoint: the email arrived when you ran the workflow by hand, the workflow is published, and the next morning a new run appears in Executions without you touching anything.

How data and expressions work

Data moves between nodes as a list of items, and each item holds a JSON object. Most nodes process every item they receive, so if a node outputs 20 rows, the next Gmail node sends 20 emails. Keep that in mind before you connect a spreadsheet to a send step. n8n's data structure docs explain the format.

ExpressionReturns
{{ $json.email }}The email field of the current item
{{ $json.customer.address.city }}A nested field
{{ $('HTTP Request').item.json.timezone }}A field from an earlier node, by node name
{{ $now.toISO() }}The current date and time in ISO format
{{ $today.minus(7, 'days') }}The date a week ago, as used in n8n's own tutorial
{{ $json.email.toLowerCase() }}Any JavaScript string method works

Syntax from n8n's expression reference and first-workflow tutorial. When an expression gets long, move the logic into a Code node. n8n 3.0 removes the old Function and Function Item nodes, so use the Code node's Run Once for All Items and Run Once for Each Item modes instead.

Step 4: Build your first AI agent

A workflow follows the path you drew. An agent is given a goal, a model and some tools, and decides for itself which tool to call. In n8n that is one node, the AI Agent, with three connectors underneath it: Chat Model, Memory and Tool. This agent reuses the weather API from Step 3, so you can ask it about any city instead of one fixed set of coordinates.

What changes when you move from a workflow to an agent
The weather workflow
  • Runs on a schedule you set
  • Always calls the same API with the same coordinates
  • Every step is fixed and visible on the canvas
  • Costs one execution a day and no model tokens
The weather agent
  • Runs when someone sends a chat message
  • Works out the coordinates and decides whether to call the tool
  • You set the instructions and the tools, not the path
  • Costs one execution per message, plus model tokens
Build the agent, with the result to expect
  1. 1
    Add a Chat Trigger

    New workflow, Add first step, search for chat. Expected result: a node named When chat message received.

  2. 2
    Add the AI Agent node

    Expected result: a node with Chat Model, Memory and Tool connectors below it.

  3. 3
    Connect a chat model

    Select the + under Chat Model and pick a provider. On n8n Cloud choose Use Gateway credits; otherwise add your own API key as a credential.

  4. 4
    Connect Simple Memory

    Select the + under Memory. Leave Context Window Length at 5. Expected result: the agent can refer to your last few messages.

  5. 5
    Connect the HTTP Request Tool

    Same URL and query parameters as Step 3, plus a Description that tells the model what the tool returns.

  6. 6
    Let the model fill in the coordinates

    On the latitude and longitude values, select the star button. n8n writes a $fromAI expression in each.

  7. 7
    Give it instructions

    In the AI Agent node, add the System Message option: a weather assistant that answers in two sentences.

  8. 8
    Open chat and ask

    Try "Do I need an umbrella in Lisbon today?" Expected result: an answer with temperatures, and a tool call in the logs.

If you would rather start from a working copy, paste this JSON onto an empty canvas and select a credential on the chat model. It uses an Anthropic model; swap the model node for OpenAI or Gemini if that is the key you have.

{
  "name": "First AI agent: weather assistant",
  "nodes": [
    {
      "parameters": {
        "options": {}
      },
      "id": "c3e8a1f0-0001-4d2b-8a6e-000000000001",
      "name": "When chat message received",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "typeVersion": 1.3,
      "position": [
        0,
        0
      ],
      "webhookId": "c3e8a1f0-1000-4d2b-8a6e-000000000010"
    },
    {
      "parameters": {
        "options": {
          "systemMessage": "You are a concise weather assistant. When the user names a place, work out its latitude and longitude and call the get_weather tool. Answer in two sentences, in Celsius."
        }
      },
      "id": "c3e8a1f0-0002-4d2b-8a6e-000000000002",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 3,
      "position": [
        240,
        0
      ]
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "id",
          "value": "claude-haiku-5-5"
        },
        "options": {}
      },
      "id": "c3e8a1f0-0003-4d2b-8a6e-000000000003",
      "name": "Anthropic Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "typeVersion": 1.3,
      "position": [
        160,
        220
      ]
    },
    {
      "parameters": {
        "contextWindowLength": 5
      },
      "id": "c3e8a1f0-0004-4d2b-8a6e-000000000004",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        320,
        220
      ]
    },
    {
      "parameters": {
        "toolDescription": "Get today's forecast for a latitude and longitude: daily maximum and minimum temperature in Celsius and the chance of rain.",
        "url": "https://api.open-meteo.com/v1/forecast",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "latitude",
              "value": "={{ $fromAI('latitude', 'Latitude of the place in decimal degrees', 'number') }}"
            },
            {
              "name": "longitude",
              "value": "={{ $fromAI('longitude', 'Longitude of the place in decimal degrees', 'number') }}"
            },
            {
              "name": "daily",
              "value": "temperature_2m_max,temperature_2m_min,precipitation_probability_max"
            },
            {
              "name": "forecast_days",
              "value": "1"
            },
            {
              "name": "timezone",
              "value": "auto"
            }
          ]
        },
        "options": {}
      },
      "id": "c3e8a1f0-0005-4d2b-8a6e-000000000005",
      "name": "get_weather",
      "type": "n8n-nodes-base.httpRequestTool",
      "typeVersion": 4.2,
      "position": [
        480,
        220
      ]
    }
  ],
  "connections": {
    "When chat message received": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Anthropic Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "get_weather": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  }
}

Node types, versions and parameter names were checked against the n8n 2.42.6 source and the $fromAI documentation; the workflow was not executed for this article, so treat your first chat as the test. Three things to know before you rely on it:

  • Model access. On n8n Cloud Starter and Pro, supported models run on Gateway credits with no API key, and trials include some. Self-hosted n8n always needs your own key; our OpenAI API key guide covers getting one.
  • Memory is temporary. Simple Memory lives inside the n8n process and is lost on restart. When that matters, the n8n AI agent memory guide moves it to Postgres.
  • Sharing it. The chat only works inside the editor until you turn on Make Chat Publicly Available in the Chat Trigger and publish the workflow.

n8n also has a separate Agents tab, where an agent is built from a model, instructions and tools without a canvas. n8n's docs label it Preview, so this tutorial uses the AI Agent node, which works the same on Cloud and self-hosted.

Checkpoint: the agent answers a question about a city you never typed coordinates for, and a follow-up such as "and tomorrow?" shows it remembers the city.

Four beginner workflows to build next

  • Form to spreadsheet: n8n Form Trigger → Google Sheets (append a row) → Gmail or Slack notification. Start with the template library.
  • New lead to CRM: Webhook → If (check the email) → HubSpot or Pipedrive. See our CRM automation guide.
  • Weekly database report: Schedule Trigger → Postgres → HTML table → email. See our database automation guide.
  • An agent with a second tool: give the Step 4 agent a Google Sheets or Gmail tool and ask it to log or send what it finds. Add a human review step before any tool that sends or deletes.

Test and debug like a pro

  • Pin data while building. Select a node and press P to freeze its output, so later steps can be tested without calling the API again. Production runs ignore pinned data.
  • Use the test URL for webhooks, then switch. A Webhook node has a test URL that works while you listen for a test event, and a production URL that works only after you publish, per the Webhook docs.
  • Debug failed runs. Open a failed execution and choose Debug in editor to load its data into the canvas, fix the node and rerun it. You can also retry a failed execution from the list.
  • Add an error workflow before anything important goes live, so a failure sends you an alert. Our n8n error handling guide walks through it, and the Error Trigger guide has a workflow ready to import.

Common beginner mistakes

  • Forgetting to publish. A workflow that works when you click Execute workflow won't run on its own until it's published.
  • Wrong timezone. Schedules fire in the workflow or instance timezone, not necessarily yours.
  • Sending one email per item. If a node outputs many items, the next node runs once per item. Use Aggregate or Limit when you want one message.
  • Pasting API keys into fields. Keep keys in credentials, where n8n stores them encrypted, not in node parameters or Code nodes.
  • Giving an agent a vague tool. The model chooses tools by their name and description. "Gets data" gets ignored; say what goes in and what comes back.
  • Following outdated tutorials. Basic-auth variables stopped working in n8n 1.0, and npm installs end with n8n 3.0.

Where to go from here

Rebuild one task you do by hand every week, then add error handling and publish it. After that, read our n8n vs Zapier comparison and browse the n8n workflow library for ideas. If you would rather build your own AI product than turn n8n skills into client work, AI SaaS Builder is a different track: it has no n8n lessons, and covers validating an idea, building it on Supabase, Next.js and the Claude API, and charging with Stripe.

n8n tutorial FAQ

What is n8n used for?

n8n connects apps, APIs and AI models in workflows that run on a schedule, when a webhook or form is called, or when something happens in a connected app. Typical uses are syncing data between tools, sending reports and alerts, routing leads, processing form entries and building AI agents. Its homepage cites over 500 integrations, and the HTTP Request node can call any REST API.

Is n8n free?

The self-hosted Community Edition is free to use under n8n's Sustainable Use License, but you pay for the server and do the maintenance. n8n Cloud has a 14-day free trial with no credit card, then paid plans. On 11 October 2026 the Starter plan cost 20 euros a month billed annually, or 24 euros month to month, for 2,500 workflow executions a month.

Is n8n open source?

Not by the Open Source Initiative's definition, and n8n does not call itself open source. Its source code is public under the Sustainable Use License, which n8n calls fair-code: free for internal business, personal and non-commercial use, with limits such as not hosting n8n as a service where other people build their own workflows.

Do I need to know how to code to use n8n?

No. Most workflows are built by connecting nodes and filling in fields, and you can drag data from one node into another. Expressions such as {{ $json.email }} use JavaScript syntax, so a little JavaScript helps, and the Code node runs JavaScript or Python when the built-in nodes are not enough. An AI agent needs no code either: you connect a model, memory and tools.

How do I install n8n on my computer?

Install Docker, then run curl -fsSL https://get.n8n.io | sh in a terminal (on Windows, use WSL). n8n's one-line setup creates an n8n folder with a Docker Compose file and starts n8n at http://localhost:5678. Avoid npm and npx installs: n8n's docs say that approach no longer works from n8n 3.0, which is distributed through Docker only.

Why does my n8n workflow not run automatically?

It probably is not published. Manual runs with Execute workflow only test the workflow; schedules, app triggers and production webhook URLs only work after you select Publish, and later edits stay in draft until you publish again. Also check the workflow timezone, and that outside services call the production webhook URL, not the test URL.

Can a beginner build an AI agent in n8n?

Yes. Add a Chat Trigger and an AI Agent node, then connect three things underneath it: a chat model, Simple Memory and at least one tool, such as the HTTP Request Tool. On n8n Cloud you can run supported models with Gateway credits instead of an API key. Each chat message is one workflow execution, and the model's tokens are billed separately.

Free · no card needed

Start with the free Starter Kit.

A unit economics calculator from AI SaaS Builder, plus four more working files.

Starter Kit5 files · free
All Access · all four programs · $99/mo

First workflow, first agent. Next, a product of your own.

An n8n agent calls a model and a tool for you. AI SaaS Builder, included in All Access, teaches the same pieces in application code: Claude API tool use and structured output, MCP servers, a Supabase database with auth, deployment on Vercel and Stripe billing. It has no n8n lessons. The other three programs, weekly coaching and the community come with the same subscription.

See All Access: $99/mo →30-day money-back guarantee
Free

Stuck on a step?

Post the node, the error and a screenshot of the output panel in the free Discord, or pick your next build from the n8n hub.