21/06/2025
Build an AI chat agent with n8n #
Welcome to the introductory tutorial for building AI workflows with n8n. Whether you have used n8n before, or this is your first time, we will show you how the building blocks of AI workflows fit together and construct a working AI-powered chat agent which you can easily customize for your own purposes.
"Screenshot of the completed workflow"
Many people find it easier to take in new information in video format. This tutorial is based on one of n8n's popular videos, linked below. Watch the video or read the steps here, or both!
What you will need #
n8n: For this tutorial we recommend using the n8n cloud service - there is a free trial for new users! For a self hosted service, refer to the installation pages.
Credentials for a chat model: This tutorial uses OpenAI, but you can easily use DeepSeek, Google Gemini, Groq, Azure, and others (see the sub-nodes documentation for more).
What you will learn #
AI concepts in n8n
How to use the AI Agent node
Working with Chat input
Connecting with AI models
Customising input
Observing the conversation
Adding persistence
AI concepts in n8n #
If you're already familiar with AI, feel free to skip this section. This is a basic introduction to AI concepts and how they can be used in n8n workflows.
An AI agent builds on Large Language Models (LLMs), which generate text based on input by predicting the next word. While LLMs only process input to produce output, AI agents add goal-oriented functionality. They can use tools, process their outputs, and make decisions to complete tasks and solve problems.
In n8n, the AI agent is represented as a node with some extra connections.
Feature LLM AI Agent
Core Capability Text generation Goal-oriented task completion
Decision-Making None Yes
Uses Tools/APIs No Yes
Workflow Complexity Single-step Multi-step
Scope Generates language Performs complex, real-world tasks
Example LLM generating a paragraph An agent scheduling an appointment
By incorporating the AI agent as a node, n8n can combine AI-driven steps with traditional programming for efficient, real-world workflows. For instance, simpler tasks, like validating an email address, do not require AI, whereas a complex tasks, like processing the content of an email or dealing with multimodal inputs (e.g., images, audio), are excellent uses of an AI agent.