The AI Agent Node: How n8n Thinks
- Explain how the AI Agent node differs from standard n8n action nodes
- Identify the three sub-node types the AI Agent requires: Chat Model, Memory, and Tools
- Describe the Think-Act-Observe reasoning loop the Tools Agent runs
- Write a system prompt that shapes agent behavior and defines its scope
What Makes the AI Agent Node Different
Most n8n nodes do one thing: send an email, fetch a spreadsheet, post to Slack. The AI Agent node is different. Instead of executing a fixed set of actions, it decides what to do. You describe the goal, and the agent works out the steps — calling tools, observing results, and adapting until the job is done.
Tools Agent: The Single Architecture
Since n8n v1.82.0, the AI Agent node runs exclusively as a Tools Agent. Earlier versions offered multiple agent type settings — ReAct, OpenAI Functions, Plan-and-Execute — but these have been consolidated. The Tools Agent was already the recommended and most widely used mode, so n8n standardised it. The legacy agent type setting is deprecated and will be removed in n8n 3.0.
The Sub-Node Architecture
The AI Agent is a root node — it cannot do anything alone. It needs sub-nodes connected to three input slots:
- Chat Model — the language model that does the reasoning (OpenAI, Anthropic, Gemini, Ollama, and more). Required.
- Memory — stores conversation history so the agent can hold multi-turn dialogues. Optional, but needed for any chatbot or assistant.
- Tools — functions the agent can call: search the web, run code, query a database. At least one tool sub-node is required.
The Reasoning Loop
When the AI Agent node receives an input, it runs a reasoning loop powered by the connected language model:
- Think — the model reads the request and the list of available tools, then decides what to do next.
- Act — it calls a specific tool with specific parameters.
- Observe — the tool runs and returns a result. The model reads the output.
- Repeat or respond — if the task is not yet complete, the loop continues. Once enough information is gathered, the agent produces a final answer.
This is the ReAct pattern (Reason + Act) used by most production AI agents today. n8n implements it via LangChain.
The System Prompt
Every AI Agent node has a System Prompt field where you define the agent's role, constraints, and persona. A clear system prompt is often the most important factor in agent quality:
"You are a support assistant for Acme Software. Only answer questions about our product. If a question is outside your scope, say so honestly and offer to escalate."
The system prompt runs before every message and shapes all of the agent's reasoning and decisions.
Execution Traces
After running a workflow with an AI Agent node, open the execution log and expand the node to see the full reasoning trace — every thought, every tool call, and every observation. This trace is your primary debugging surface when an agent behaves unexpectedly. Reading traces is a skill worth developing early.
- Since v1.82.0 all AI Agent nodes run as Tools Agent — the legacy multi-type setting is deprecated and removed in n8n 3.0
- The agent requires a Chat Model sub-node and at least one Tool sub-node to function
- The agent loops through Think, Act, Observe until it has enough information to respond
- The System Prompt is your primary control over agent behavior — write it before configuring anything else