AI components in n8n: chains and agents
AI in n8n is built on cluster nodes: a root node in the middle with sub-nodes attached beneath it that extend what it can do.
The main sub-node types:
- Chat Model — which language model to use (OpenAI, Anthropic, Google, local models via Ollama and others)
- Memory — conversation history
- Tool — what the agent can call
- Embeddings, Vector Store, Document Loader — for RAG
Root nodes fall into two families: chains and the agent.
| Aspect | Chain | Agent |
|---|---|---|
| How it works | Calls components in a predetermined sequence | The language model decides which action to take |
| Tools | None | Yes — at least one tool must be connected |
| Memory | Not supported — it cannot remember previous queries | Supported |
| Number of runs | Once | Several times — it calls a tool, evaluates the response and continues |
| Predictability | High — you know what will happen | Lower — the model decides |
| Cost | One model call | Several calls — more expensive |
n8n provides three chain nodes:
- Basic LLM Chain — talks to the model directly, with no extra components
- Question and Answer Chain — connects to a vector store through a retriever, or to a workflow; for asking questions about documents
- Summarization Chain — takes an input and returns a summary
On the agent side there is one node: the AI Agent. It used to have an agent-type setting, but that parameter is deprecated from n8n 1.82.0 — every AI Agent node now works as a Tools Agent. That older version will be removed in n8n 3.0, so old workflows need updating.
The selection rule: when you know exactly what should happen, use a chain. When the model must decide for itself what information it needs, use an agent.
The most common mistake is reaching for an agent for everything. An agent runs several times, calling the model each time, which raises cost — and the result is less predictable. When the task is "summarise this text" or "classify this email", a chain is enough — cheaper and more consistent.
📚 Sources and documentation
- What agents doofficialdocs.n8n.io
- What chains doofficialdocs.n8n.io
The lack of memory support in chains is stated here officially.
- Agents vs chains (example workflow)officialdocs.n8n.io
- AI Agent nodeofficialdocs.n8n.io