The AI Agent node is the center of n8n's AI features; everything else plugs into it.
n8n's AI features are built on LangChain, a popular open-source toolkit for apps that use large language models (LLMs, the AI models behind chat assistants). In the editor they appear as cluster nodes: one main root node with smaller sub-nodes plugged into its bottom connectors.
The most important root node is the AI Agent. Unlike a fixed chain of steps, an agent lets the model decide what to do next, including which tools (actions it can call, next lesson) to use. Its sub-node slots are:
- Chat Model (required): which model to use, from providers such as OpenAI, Anthropic, Google, or models running on your own computer through Ollama. You need a credential for the provider (on Cloud, n8n's built-in AI credits may cover it). Model names change often, so pick from the current list.
- Memory: lets the agent remember earlier messages in a conversation.
- Tools: what it can do beyond writing text.
- An optional output parser to force a structured answer.
The quickest start: add a Chat Trigger ("When chat message received"), connect an AI Agent, plug in a chat model, and click Open chat. Each message you type becomes the agent's prompt.
The agent can also be fed by any other node, for example an email body, using an expression for the prompt.
In the node's options, the System Message sets standing instructions (role, tone, rules, what to do when unsure). Other options limit how many steps it may take (max iterations).
For simple one-shot jobs (summarise, classify), the Basic LLM Chain or Text Classifier nodes are cheaper and more predictable than an agent.
Remember
- AI nodes are clusters: a root node plus sub-nodes
- AI Agent needs a chat model; memory and tools are added as sub-nodes
- Use the System Message for standing instructions; use chains for simple one-shot tasks