TipsMake
Newest

How to create an AI Agent with n8n in 2026

n8n is an extremely powerful open-source workflow automation tool that allows you to connect hundreds of applications such as Google Sheets, Telegram, Notion, OpenAI, etc., without writing complex code. With its node-based drag-and-drop interface, n8n allows you to create intelligent automated workflows, and it integrates AI agents to build AI chat assistants, process data, send notifications, and more.

 

Compared to Zapier or Make.com, n8n stands out because it's free when self-hosted , highly flexible (supports JS/Python code), low-cost (based on execution workflow), and more secure because you control your data. It's a top choice for developers, small businesses, or anyone wanting to automate with AI without breaking the bank.

 

Why create an AI agent?

To put it simply, we can compare a regular AI and an AI Agent to the difference between an "encyclopedia" and a "professional personal assistant" .

Below is a comparison table with real-world examples of "Travel Planning" :

Characteristic Normal AI models (ChatGPT, basic Gemini) AI Agent (Built on n8n or Custom GPT)
Role A theoretical consultant. A law enforcement officer.
How it works The answer is based on available data. You ask, the AI ​​answers. Automatically connects with external tools for work.
When you say, "Let's schedule a trip to Da Lat," for example. The AI ​​will list beautiful places, delicious food, and suggest general itineraries in the chat window. The AI ​​Agent will automatically: 1. Check flight tickets; 2. Look up the actual weather; 3. Send the itinerary to Google Calendar; 4. Send a message to your friends.
Proactiveness Stop after you have finished writing the text. Make your own decisions and complete the workflow.

 

Here's a more relatable example from the workplace:

1. The Normal AI Model (Writing an article):

You provide the topic, and the AI ​​writes a blog post for you. Then, you have to manually copy the post, find accompanying images, upload it to your website, and share it on social media.

2. AI Agent (Total Automation):

You just need to provide the topic. The AI ​​Agent will automatically perform the following sequence of actions:

  1. Step 1: Search for the latest information on Google.
  2. Step 2: Write your own SEO-optimized articles using the latest Google structure.
  3. Step 3: Create illustrations in Canva that are suitable for the content of your article.
  4. Step 4: Automatically publish articles to WordPress during peak hours.
  5. Step 5: Send a notification to the work group to report: "I've finished posting!".

In short: If normal AI is the "brain," then AI Agent is the "brain with added hands and access to tools . "

The outstanding advantages of using n8n

  1. Free & self-hosted : Install locally or on a private server, no execution limitations like Zapier (potentially saving 10-50 times the cost when scaling).
  2. Highly flexible : Supports over 400 built-in integrations, custom nodes, JS/Python code, and powerful AI agents (connects to LLMs like OpenAI, Gemini, Groq.).
  3. Deep AI integration : Building AI chat agents, RAG chatbots, automation with tools (web search, calculations), and memory to remember context.
  4. Security & Customization : Data is stored locally, easy to back up, suitable for businesses that need control.
  5. Strong community : Thousands of ready-made workflow templates, regularly updated (version 2.x in 2026).

 

Guide to installing n8n on Windows 11 using Docker (easiest way 2026)

  1. Install Docker Desktop : Download from docker.com, select WSL 2 backend → install and restart if necessary.
  2. Update WSL if errors occur : Open PowerShell (admin) → wsl --update.
  3. Open Docker Desktop → Images tab → search n8nio/n8n → Pull latest.
  4. Click Run → Optional settings:
    1. Container name: n8n
    2. Ports: Host 5678 → Container 5678
    3. Volumes: Create a volume with the directory path containing the n8n data on your computer → mount /home/node/.n8n
    4. Environment: GENERIC_TIMEZONE - Asia/Ho_Chi_Minh, N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS = true, N8N_RUNNERS_ENABLED = true
  5. Run → Containers tab, see Running → access http://localhost:5678 → setup email/password.
  6. If you encounter a port/firewall error: Temporarily disable Windows Firewall or change the port to 5679.

See more details in this article: How to install and use n8n on Windows 11

How to build an AI Chat Agent with n8n

Construction steps

1. Creating a new workflow: When you open n8n, you will see:

  1. A blank canvas (if this is your first time logging in).
  2. Or from the Workflows list → click the + button to create a new one.

How to create an AI Agent with n8n in 2026 Picture 1

 

2. Add a Trigger node to any workflow that needs a starting point. Here, we use a Chat Trigger (a button that activates when a chat message arrives).

How to create an AI Agent with n8n in 2026 Picture 2

  1. Click Add first step or press the N key to open the node menu.
  2. Type "Chat Trigger" into the search bar → select it.

How to create an AI Agent with n8n in 2026 Picture 3

  1. The node will appear on the canvas. Close the node details window to return to the canvas.

How to create an AI Agent with n8n in 2026 Picture 4

What is a Chat Trigger ? It waits for you to type a message to run the workflow. In practice, you can attach it to the public chat of n8n or embed it into a website. Here, we'll use the local chat for testing – no additional installation is needed.

3. Add the AI ​​Agent node. This is the "heart" of the AI ​​in the workflow.

How to create an AI Agent with n8n in 2026 Picture 5

 

  1. Click the + (Add node) icon on the right side of Chat Trigger.
  2. Type "AI" → select AI Agent .

How to create an AI Agent with n8n in 2026 Picture 6

How to create an AI Agent with n8n in 2026 Picture 7

  1. The node editing window opens. With Chat Trigger, the default prompt settings are already okay and don't need to be changed.

4. Configuring the AI ​​Agent node: The AI ​​Agent needs to be assigned a chat model (language model) to process messages.

How to create an AI Agent with n8n in 2026 Picture 8

  1. Click the + sign under Chat Model (the first connection under the node).
  2. A menu will appear; filter by "Language Models".

How to create an AI Agent with n8n in 2026 Picture 9

  1. Choose the OpenAI Chat Model (or Gemini, Groq… if you prefer and feel it suits your work needs). Note that each model requires you to have its API Keys to use it in the AI ​​Agent on n8n.
  2. The OpenAI node will attach to the AI ​​Agent and open the editing window.
  3. In the Model section , select a model (for example, gpt-4o-mini – free for OpenAI basic accounts).

 

What is a chat model? It's the "brain" that generates text from prompts. Each model has its own strengths depending on the training data (for example, OpenAI excels in English, Gemini is strong in multiple languages.).

5. Add Credentials (login information – if needed). n8n requires an API key to connect to OpenAI (or another model).

  1. If you already have OpenAI credentials, they will appear automatically.
  2. If not already set: Click "Select credential" → "Set up credential".

How to create an AI Agent with n8n in 2026 Picture 10

  1. Simply paste the API key (long string) from the website of your chosen model.
  2. Note: Keep your API key confidential; do not share it.

For example, in the image below, I've chosen OpenRouter as the AI ​​Agent model. To obtain API Keys to use OpenRouter within the n8n AI Agent, I need to access the official OpenRouter website, find the section for creating API Keys, and select "Create."

How to create an AI Agent with n8n in 2026 Picture 11

Please fill in the information such as the API Key name, the maximum Credit amount that can be used for this API Key, the reset time when the limit is reached, and the validity period of this API Key. Finally, select Create to get the API Key.

How to create an AI Agent with n8n in 2026 Picture 12

Once you receive the API code, go back to the AI ​​Agent creation interface on n8n, select the AI ​​model (here I chose OpenRouter), and then select

How to create an AI Agent with n8n in 2026 Picture 13

Next, after adding the AI ​​model, you can add other items such as Tools, storage, Google Calendar, and any other data you frequently use for your work so that the AI ​​Agent can function accurately.

How to create an AI Agent with n8n in 2026 Picture 14

6. Test

  1. Click the Chat button below the canvas → the chat window opens on the left, the AI ​​log is on the right.
  2. Type any message → Press Enter → AI will reply immediately.
  3. The log section displays the input/output of the AI ​​Agent (very useful for debugging).

7. Change the System Prompt (the AI's "personality"). By default, the AI ​​starts with the message: "You are a helpful assistant."

  1. Open the AI ​​Agent node.
  2. Bottom section: Options → click Add Option → select System message .
  3. Change the prompt, for example: "You are a talented poet, always responding with rhyming couplets."
  4. Close the node → return to chat → ask again → see the AI ​​responds in a new way!

8. Add Persistence (memory – so AI remembers conversations). Currently, AI "forgets" everything after each message. For example: You say "My name is Minh," then ask again "What is your name?" → AI doesn't remember.

  1. On the AI ​​Agent node, click the + sign under Memory .
  2. Choose Simple Memory (simple memory, stored in n8n – sufficient for basic chat).
  3. By default, save the 5 most recent conversations → OK for testing.
  4. Try again: Say the name → ask the name → the AI ​​remembers it!

9. Save workflow

  1. Click the Save button in the upper right corner.
  2. The workflow is saved, so you can reopen the chat later to continue or add features.

You've completed your first AI chat assistant with n8n! You've learned: the basic AI building blocks, adding an AI agent and chat model , tweaking the system prompt to change your reply style, and adding memory to retain conversation context.

Conclude

n8n is more than just an automation tool – it's an AI-powered platform that saves you time and increases your productivity. With its free self-hosted capabilities and powerful AI agent integration, n8n is gradually replacing Zapier/Make for Vietnamese users. Try installing it today and start building your first workflow.

Kareem Winters
Share by Kareem Winters
Update 18 March 2026