Build & sell

n8n AI Agent: How the AI Agent Node, Memory and Tools Work

・ Employee Store Operations

Summary

In n8n, you can build an AI agent by connecting a chat model, memory and tools to the AI Agent node. This article explains the role of each part, how to set up the Chat Trigger that receives conversations, and how to test the agent. The content was checked against the official documentation in October 2026.

An n8n AI agent starts from a single node placed in a workflow. The node is called AI Agent. This article uses the screen labels from the English interface.

The content of this article was checked against the official n8n documentation on October 2, 2026. n8n's screens and settings change between versions. Also check the official documentation for the version you use.

What the AI Agent node does

The AI Agent node is the node for building AI agents in n8n. When you connect a chat model and one or more tools, the agent decides on its own which tool to call. The official documentation explains that the AI Agent node needs at least one tool connected.

In n8n, a setup that processes steps in a fixed order is called a Chain. An Agent differs in that it uses a language model to decide what to do next. An agent may run several times within one execution. For example, once to call a tool, and again to check the result and reply.

You used to be able to choose the agent type in the AI Agent node. As of n8n 1.82.0, this setting is deprecated, and every agent runs as a Tools Agent. The old version that lets you choose a type (v1) is scheduled for removal in n8n 3.0. When you use old templates, replace the node with the latest version.

Connect three parts: chat model, memory and tools

The AI Agent node is a parent node, called a root node. Below it, you connect parts called sub-nodes. There are three kinds of parts to connect.

The 3 parts of an AI agent
Chat modelThinks and decidesMemoryRemembers the conversationToolsActs outsideAI Agent nodeAn AI agent in n8n
  • Chat model: a model from OpenAI, Anthropic, Google and others. Without one, an error asks you to connect a Chat Model
  • Memory: the part that remembers earlier exchanges. Connecting it lets the conversation continue
  • Tools: things the agent can call, such as search, spreadsheets and APIs

Main settings of the AI Agent node

  • Prompt: choose whether to take it automatically from the previous node or define it below. In automatic mode, it waits for an input named chatInput
  • System Message: instructions given to the agent before the conversation. Write its role and decision policy here
  • Max Iterations: the maximum number of times the model runs before giving an answer. The default is 10
  • Return Intermediate Steps: whether to include intermediate steps in the output
  • Require Specific Output Format: connect an Output Parser when you want to fix the output format

Receiving conversations with Chat Trigger

To build an agent people talk to through chat, put a Chat Trigger as the first node. The Chat Trigger must be connected to an agent or chain node.

Watch how usage is counted for billing. With Chat Trigger, the workflow runs once for each message received. Sending 10 messages in one conversation uses 10 executions.

Publishing and authentication settings

  • Make Chat Publicly Available: keep it off while building and turn it on when you publish
  • Mode: Hosted Chat uses an interface provided by n8n. Embedded Chat calls the Chat URL from your own interface
  • Authentication: choose None, Basic Auth or n8n User Auth
  • Response Mode: choose whether to respond when the last node finishes, through a response node, or by streaming

If Authentication is set to None, anyone who knows the URL can use it. If you expose it outside your organization, always check the authentication settings.

Giving the agent tools: search, spreadsheets and HTTP

Tools are the parts that let an agent fetch outside information or do work. n8n has built-in tool nodes, such as Wikipedia and SerpApi (Google search). You can also connect an MCP server as a tool.

The official documentation highlights the following three tools as especially versatile.

  • Call n8n Workflow Tool: calls another workflow as a tool. In the official example, reading a Google Sheet is set up as a separate workflow that the agent calls
  • Custom Code Tool: write code that the agent can run
  • HTTP Request Tool: fetch data from websites and APIs

In the Call n8n Workflow Tool, write when to use the tool in the Description. The agent reads this description to decide whether to call it. In production, the called workflow must also be published. If it is not, the tool call fails and the error message is returned to the agent.

Letting AI fill in tool inputs

You can let AI fill in a tool's input fields. Click the button to the right of the field, or write the $fromAI() function in an expression. One use is letting AI decide an email's subject line. This function works only in tools connected to the AI Agent node.

Add human approval before risky actions

For tools that do things hard to undo, such as sending messages or deleting data, you can insert a human approval step. Add Human review from the tool's connector and choose where approval requests go. Options include Slack, Telegram and Gmail. The tool runs only when approved, and the action is canceled if it is rejected.

Also write in the System Message which tools need approval and how to respond when a request is rejected. The official documentation recommends doing so as well.

Memory types and how to choose

Memory is the part that keeps the history of earlier messages so the conversation can continue. Only agents can use memory. Chains cannot.

The simplest option is Simple Memory. It keeps a set length of chat history for the current session. It has two settings.

  • Session Key: the key used to store the history. With Chat Trigger, it is usually received automatically
  • Context Window Length: how many past exchanges to take into account

Simple Memory has some caveats. If you run n8n in queue mode, it does not work correctly in production workflows, because there is no guarantee that calls reach the same worker. Also, if you place several Simple Memory nodes, they share the same history by default. To separate them, set a different session ID for each node.

Choosing a memory type

Where and how will it run?

You are trying it out and not using queue modeSimple Memory2 settings: Session Key and Context Window Length
It runs in queue mode, or you want to store history externallyPostgres Chat Memory and similarNodes for Redis, MongoDB, Zep and others also exist
You want fine control over the history itselfChat Memory ManagerIt can check the history size and trim it, for example

Postgres Chat Memory stores the history in a Postgres database. If the specified table does not exist, it is created automatically. When you load earlier conversations with Load Previous Session in the Chat Trigger, the documentation recommends connecting both the Chat Trigger and the agent to the same memory.

Testing and fixing the agent

An agent may give different answers or take different steps for the same question. After you build it, run it several times with fixed examples and compare the results.

The test-and-fix flow
  1. 1Try it in chatBefore publishing, run it in the editor's chat
  2. 2Check intermediate stepsTurn on Return Intermediate Steps
  3. 3Fix errorsMissing model, no prompt, session ID and so on
  4. 4Run examples in bulkRun a test table at once with Evaluations
  5. 5PublishSet up Chat Trigger publishing and authentication
  • No prompt specified: switch Prompt to the define-below setting and enter the previous node's output or fixed text
  • No sessionId: check that the Chat Trigger output includes sessionId. A fixed key works during testing, but manage it properly before publishing
  • Simple Memory errors: often caused by an old node version. Deleting and re-adding the node gives you the latest version

To test many examples at once, use the Evaluations feature. List test inputs and expected answers in a data table or Google Sheet. Click Evaluate all, and the workflow runs row by row and writes the results back to the table. The light version of evaluations is available on every n8n Cloud plan.

The basics of n8n itself are covered in How to Use n8n, and how agents connect to external tools in AI Agents and MCP.

List your agent on Employee Store

Employee Store is a marketplace where companies adopt AI agents built by developers, through a one-time purchase or a monthly plan. Any format is accepted, including n8n workflows. One person (or company) can list several AIs.

There is no listing fee and no upfront cost. The commission is 20% of the deal amount and applies only when a deal closes. See the seller guide for details.

FAQ

Does the n8n AI Agent node not work without a tool?
The official documentation explains that the AI Agent node needs at least one tool sub-node connected. If you only want to call a model in a fixed flow without tools, you can use a chain node such as Basic LLM Chain instead.
How much of the conversation does Simple Memory remember?
It takes into account as many past exchanges as you set in Context Window Length. It keeps only the history of the current session. It does not work correctly in production with queue mode, so use Postgres Chat Memory or similar in that case.
How are Chat Trigger conversations counted as executions?
The workflow runs once for each message received. Sending 10 messages in one conversation counts as 10 executions. Check the execution limit of your plan.

About the author

Employee Store OperationsThe operations team behind Employee Store, a marketplace for AI agents. We check tool features and pricing against official sources and list them at the end of each article. If you spot an error, please let us know via the contact form.

Sources

Ask AI

Ask AI if it fits your work.

Use your usual AI to explore what Employee Store offers and what to check before buying.

Opens an external AI service. Confirm pricing and deliverables on the listing page.