AI Nodes & Agents in n8n
n8n's AI layer is built on LangChain under the hood, but exposed through its visual node editor. You connect an AI Agent node to LLM nodes, memory nodes, and tool nodes — and get a full reasoning agent without writing code.
The Four Components
The orchestrator. Receives the user prompt, plans steps, decides which tools to call, and produces the final output. Uses ReAct or OpenAI Functions reasoning loop.
The brain. Connects the agent to a language model — OpenAI, Anthropic, Google Gemini, Mistral, Ollama (local), or any OpenAI-compatible endpoint.
Keeps conversation history or context between runs. Options: Window Buffer Memory (last N messages), Redis Memory (persistent), Postgres Memory.
What the agent can do. Any n8n integration becomes a tool: HTTP request, database query, email send, Slack message, calculator, code executor, web scraper.
LLM Sub-nodes — Supported Providers
| Provider | Models | Notes |
|---|---|---|
| OpenAI | GPT-4o, GPT-4.1, o3, o4-mini | Native node — most feature-complete |
| Anthropic | Claude Sonnet 4.5, Haiku 4.5, Opus 4 | Native node — good for long documents |
| Gemini 2.5 Pro, Flash | Native node — multimodal support | |
| Mistral AI | Large 3, Small 4, Codestral | Via Mistral node or HTTP request |
| Ollama | Any local model (Llama 4, DeepSeek-R1, etc.) | Local — data stays on your machine. See /ollama section for setup. |
| Hugging Face | Any inference endpoint | Via HF Inference API node |
| OpenAI-compat | Any provider with /v1/ endpoint | Generic via OpenAI node + custom base URL |
Tool Nodes — What Agents Can Do
Tools are what make an AI agent useful beyond text generation. In n8n, most nodes can be converted into tools for an agent. Some come pre-built as dedicated tool nodes:
Memory Nodes
Example: Customer Support Agent
A realistic n8n AI agent for customer support:
- Trigger: Webhook receives incoming customer email
- AI Agent node with GPT-4o, Window Buffer Memory, and three tools:
- HTTP Request Tool → query your order management API
- HTTP Request Tool → search your knowledge base
- Code Tool → calculate refund amounts from order data
- If node: Route based on agent's output (refund / escalate / auto-reply)
- Gmail node: Send the response
- Slack node: Notify the support team if escalated
This whole agent takes about 20 minutes to build in n8n's visual editor, no code required. The equivalent in Python with LangChain would be 200+ lines.
Checklist: Do You Understand This?
- Can you name the four components every n8n AI agent needs?
- Do you know how to connect Ollama as the LLM for a local, private n8n agent?
- Can you explain the difference between Window Buffer and Redis Memory?
- Do you understand how a custom n8n workflow becomes a tool for another agent?