Sistava

n8n AI Agent Node: How to Build an Agent and Connect a Model

How-to — — by Mahmoud Zalt

How the n8n AI Agent node works: attach a chat model, add tools and memory, wire a Chat Trigger, and where the newer Agent Builder fits in.

An agent in n8n is not a bigger node. It is a small assembly: one root node that does the reasoning, and a set of sub-nodes clipped underneath it that supply the model, the memory and the tools.

That layout is the thing to understand first, because it is unlike every other node on the canvas. Ordinary nodes connect left to right and pass data along. The AI Agent node also has connectors along its bottom edge, and each one accepts a different kind of sub-node. Once you see the shape, the rest of the build is mechanical.

What does the n8n AI Agent node do?

It lets a language model decide which actions to take instead of you drawing them. n8n's own description of an agent is a chain that knows how to make decisions, and their conceptual page puts it plainly: when you send a query to an agent, it tries to choose the best tools to use to answer.

Their node documentation is specific about the minimum viable setup. An AI Agent node needs a chat model, and it requires at least one tool sub-node connected to it. Without a tool there is nothing for the model to choose between, so the node is not really an agent yet.

How do you connect a chat model to the AI Agent node?

You use the plus icon on the Chat Model connector underneath the agent node, pick your provider from the list, then create or select the credential holding that provider's API key. Independent walkthroughs of the node describe exactly this flow, and it is the same pattern for every provider n8n supports.

Two things are worth doing carefully at this point. Name the credential something you will recognise later, because a workspace with three model credentials all named after the node is unreadable within a week. And pick the model deliberately rather than accepting whatever appears first, since every user message runs the whole chain and the model choice is where the cost of that lands.

Standing up an agent on the canvas

  1. Add a Chat Trigger — This gives you a chat interface to test against. n8n's documentation states the Chat Trigger must connect to either an agent or a chain root node.
  2. Add the AI Agent node — Connect it to the trigger. The sub-connectors along its bottom edge are what you fill in next.
  3. Attach a chat model — Select the plus on the Chat Model connector, choose your provider, and create the credential with your API key.
  4. Attach at least one tool — Use the tools connector. n8n's node documentation requires at least one tool sub-node before the agent is functional.
  5. Attach memory if the conversation needs it — Memory is what lets the second message know about the first. Without it, every message starts from nothing.
  6. Test in the chat panel — Send a message that should force a tool call, not just a greeting. A polite reply proves the model works, not the agent.

How do you give an n8n agent tools?

Through the tools connector on the agent node, one sub-node per tool. Many ordinary app nodes can be attached this way. n8n's Gmail node documentation, for example, says the node can function as an AI tool where many parameters can be set automatically, or with information directed by AI.

That last phrase is where beginners lose an afternoon. A tool parameter can either be a value you set or a value the model fills in at runtime, and the model can only fill it in sensibly if the field is described well. One independent walkthrough of the agent node makes the same point about a database tool: supply a detailed schema description so the agent understands which tables and fields exist, or it will invent a query.

Treat tool descriptions as the actual prompt engineering of an agent build. The system message tells the model who it is. The tool descriptions tell it what is real. A vague tool description produces a confident agent that calls the wrong thing.

How does memory work in an n8n agent?

Memory is a sub-node too, attached to its own connector, and it is what carries context from one message to the next inside a session. Independent tutorials describe a simple in-instance memory option that needs no extra credential, which is the sensible starting point while you are still testing.

There is a detail in n8n's Chat Trigger documentation worth reading before you build anything user-facing. The node has a Load Previous Session option for retrieving earlier chat messages, and when it is enabled the Chat Trigger and the connected agent must both link to the same shared memory sub-node so there is a single source of data. Two different memory nodes means two different versions of the conversation.

How do people actually talk to the agent?

Through the Chat Trigger node, which n8n documents as the way to build chatbot and chat interface workflows. It carries the options that decide who can reach your agent, so it deserves more than thirty seconds of attention.

One line in that documentation deserves a highlighter: each user message triggers a complete workflow execution, consuming execution credits according to your plan. A chatty agent is not one execution, it is one execution per turn, and that is the number to model before you put it in front of customers.

Assembly work like this is exactly what we removed at Sistava. Rather than attaching a model, a memory store and a tool sub-node and then describing each field well enough for the model to use it, you hire an AI Employee and tell it in plain English what you want handled. The tools are connected already, it asks you when it is unsure, and there is no sub-node graph to keep in your head.

What is the Agent Builder, and how is it different?

n8n also documents a separate way of building agents that does not live on the workflow canvas at all. Their guidance describes agents as first-class artifacts alongside workflows, created through an Agent Builder reached from the Agents tab after you select a project, rather than assembled as nodes.

The configuration is form-shaped rather than graph-shaped. You choose a provider and model in the Agent tab's Model field, and n8n prompts you for credentials if it needs them. You describe the agent's role, tone, response format and boundaries in an Instructions field. Tools are added through Add tool in the Tools section, covering built-in integrations, project workflows, custom tools defined by JSON schema, and external tools reached over MCP servers.

Memory is handled differently here too. n8n's documentation says session memory keeps the context of the current conversation, that it is on by default and needs no setup, while episodic memory requires OpenAI credentials. Published agents can also be delegated to as sub-agents from the Agents section.

Which route you take depends on where the agent belongs. If it is one reasoning step inside a larger pipeline that already fetches, transforms and writes data, the node keeps it on the same canvas as everything else. If it is a standalone assistant people will talk to, the builder is the shorter path.

AI Agent nodeAgent Builder
Where it livesOn the workflow canvasIn the Agents tab of a project
ShapeRoot node plus sub-nodesA form with Model, Instructions and Tools
Model choiceChat Model sub-node with a credentialModel field in the Agent tab
ToolsOne sub-node per toolAdd tool, including MCP servers
MemoryMemory sub-node you attachSession memory on by default
Good forAgents that are one step inside a larger workflowA standalone assistant you publish and reuse

What do people get wrong when building an agent in n8n?

None of this is a criticism of n8n. Giving people a visual way to assemble an agent out of a model, a memory store and real tools is genuinely hard, and the sub-node design makes the moving parts visible instead of hiding them. The cost is that the moving parts are yours: you choose them, describe them, and own them when the model picks badly.

If what you wanted was an assistant that already knows its job, that is the question Sistava answers. You hire an AI Employee for a role, brief it in a paragraph, and correct it in plain English when it gets something wrong, the same way you would coach a new hire.

FAQ

What does the n8n AI Agent node need to work?

A chat model and at least one tool. n8n's node documentation states that an AI Agent node requires at least one tool sub-node connected to it, and it needs a chat model to do the reasoning. Both attach to connectors along the bottom edge of the node rather than to its left or right side.

How do I connect a chat model to the AI Agent node in n8n?

Use the plus icon on the Chat Model connector underneath the agent node, select your provider from the list, then create or choose the credential that holds that provider's API key and pick the model. Independent walkthroughs of the node describe this same flow across providers.

Which models can I use with an n8n agent?

n8n supports a range of providers through separate chat model sub-nodes, and independent tutorials show builds using different vendors including ones with free tiers. Rather than trusting any list in an article, open the Chat Model connector in your own instance, which shows exactly which providers your version offers.

Does an n8n agent remember previous messages?

Only if you attach a memory sub-node. n8n's Chat Trigger documentation also describes a Load Previous Session option for retrieving earlier messages, and notes that when it is enabled the Chat Trigger and the connected agent must link to the same memory sub-node so there is a single source of data.

What is the difference between the AI Agent node and the Agent Builder?

The AI Agent node is assembled on the workflow canvas from a root node and sub-nodes. The Agent Builder is a separate interface reached from the Agents tab in a project, where you configure a Model field, an Instructions field and a Tools section instead of wiring sub-nodes. n8n documents limitations on the Agent Builder route including no support for queue mode and self-hosted Enterprise.

How much does an n8n chat agent cost to run?

There are two costs stacked on each other: your model provider's charges for the tokens, and n8n's own execution accounting. n8n's Chat Trigger documentation states that each user message triggers a complete workflow execution and consumes execution credits based on your plan, so a long conversation is many executions rather than one.

Sources