n8n AI Nodes: LangChain, OpenAI & Vector Store Node Reference
⚡ n8n Workflow Automation T3 · AI Nodes Reference
n8n AI Nodes: LangChain, OpenAI & Vector Store Node Reference

n8n 2.0 ships with 70+ dedicated AI nodes organized within the @n8n/n8n-nodes-langchain package, spanning Chat Models, Embeddings, Vector Stores, Tools, Memory, Chains, Agents, Document Loaders, Text Splitters, and Output Parsers. This architecture mirrors LangChain’s conceptual model while providing a visual, no‑code orchestration layer: the AI Agent node serves as the central reasoning engine, using LangChain‑powered decision logic to determine which tools to call based on user input, and connecting to LLM providers—OpenAI (GPT‑4o), Anthropic (Claude 3.5 Sonnet), Google Gemini, and over 130 specialized nodes in total. [1] [2]

70+
AI Nodes (LangChain) [1]
10
Node Categories [3]
6+
LLM Providers [4]
7+
Vector Stores [5]

How does the AI Agent node orchestrate tools, memory, and LLM reasoning in n8n?

The AI Agent node is the central orchestrator—it connects to a Language Model sub‑node (OpenAI, Anthropic, Gemini) for reasoning, to Tool sub‑nodes (HTTP Request, Code, sub‑workflows) for executing actions, and to Memory sub‑nodes (Buffer Window, Postgres Chat, Redis) for maintaining conversation context across exchanges. The agent uses LangChain‑powered reasoning to decide which tool to call, in what order, based on the user’s query and the tool descriptions provided. [4] [6]

The node accepts five connection types: Language Model for the primary LLM, Memory for conversation history storage, Tool for external APIs the agent can invoke, Output Parser for structured response formatting, and Text Splitter for document chunking. The maxIterations parameter (recommended range: 5–8) prevents infinite loops when the agent gets stuck; the system prompt should include explicit guardrails like “Do not invent information. If uncertain, say so and offer to escalate.” For multi‑agent patterns, a gatekeeper agent routes queries to specialized sub‑agents, each with its own tool set. For the complete RAG pipeline pattern that loads documents, chunks text, embeds vectors, stores in Pinecone, and retrieves via the AI Agent, see the n8n Vector Store Integration guide.

What LangChain node categories and execution patterns does n8n 2.0 provide?

The @n8n/n8n-nodes-langchain package organizes 130+ specialized nodes into ten categories: Agents (Agent, OpenAiAssistant), Chains (ChainLLM, ChainRetrievalQA, SentimentAnalysis), Chat Models (LmChatOpenAi, LmChatAnthropic, LmChatGoogleGemini), Embeddings (EmbeddingsOpenAi, EmbeddingsCohere), and Vector Stores (VectorStorePinecone, VectorStoreQdrant, VectorStorePGVector). [1] [3]

The remaining categories include Tools (ToolCode, ToolHttpRequest, ToolWorkflow, ToolCalculator), Memory (MemoryBufferWindow, MemoryRedisChat, MemoryPostgresChat), Document Loaders (DocumentDefaultDataLoader, DocumentGithubLoader), Text Splitters (TextSplitterRecursiveCharacterTextSplitter, TextSplitterTokenSplitter), Output Parsers (OutputParserStructured, OutputParserItemList), Retrievers (RetrieverVectorStore, RetrieverWorkflow), and Vendors (Anthropic, GoogleGemini, OpenAi). Two execution patterns govern these nodes: supplyData() for configuration nodes that create LangChain instances, and execute() for processing nodes that consume those instances. For practical implementation patterns, see the OpenAI GPT‑4o prompt chain tutorial.

Category Directory Example Nodes Execution Pattern
Agents nodes/agents/ Agent, OpenAiAssistant, AgentTool execute()
Chains nodes/chains/ ChainLLM, ChainRetrievalQA, SentimentAnalysis execute()
Chat Models nodes/llms/ LmChatOpenAi, LmChatAnthropic, LmChatGoogleGemini supplyData()
Embeddings nodes/embeddings/ EmbeddingsOpenAi, EmbeddingsCohere, EmbeddingsGoogleGemini supplyData()
Vector Stores nodes/vector_store/ VectorStorePinecone, VectorStoreQdrant, VectorStorePGVector supplyData()
Tools nodes/tools/ ToolCode, ToolHttpRequest, ToolWorkflow supplyData()
Memory nodes/memory/ MemoryBufferWindow, MemoryRedisChat, MemoryPostgresChat supplyData()

How do you configure the OpenAI Chat Model node and select the right model for your task?

The OpenAI Chat Model sub‑node (LmChatOpenAi) connects to the AI Agent and provides access to GPT‑4o, GPT‑4o‑mini, and other OpenAI models. You authenticate via an API key stored in n8n’s encrypted credential system, then configure Temperature (0–2, default 1: use 0.1–0.3 for factual support agents and 0.7–0.9 for creative writing), Max Tokens (capped at model maximum), and a System Prompt that defines assistant behavior. [7]

The model selector dynamically loads models available to your API account. For high‑volume classification tasks, use gpt-4o-mini to cut costs by 60–80% compared to full GPT‑4o; for customer‑facing support where quality matters, default to GPT‑4o. The AI Agent node can also route simple queries to cheaper models and complex ones to more capable models: a Switch node checks the input complexity and directs the request accordingly. For Azure OpenAI users, the community node n8n-nodes-azure-openai-ms-oauth2 supports Microsoft OAuth2 authentication with GPT‑4o, GPT‑4.1, o1, and embedding models. For the complete prompt‑chaining pattern, see the OpenAI prompt chain tutorial.

How does the Anthropic Claude node integrate with n8n’s AI Agent for autonomous tool use?

The Anthropic Chat Model sub‑node (LmChatAnthropic) connects Claude 3.5 Sonnet or Claude 3.5 Haiku to the AI Agent through the same Language Model connection type. You create API credentials from the Anthropic Console and configure model selection, temperature, and max tokens through the standard parameter panel. Claude models excel at complex multi‑step reasoning and tool‑calling scenarios where cost‑efficient, accurate execution matters. [8]

Two community Claude agent nodes extend this further: the n8n-nodes-claude-chat node enables multi‑turn conversations with skill‑based personalities and budget management, while @landreville/n8n-nodes-claude-agent brings the Claude Agent SDK directly into n8n for autonomous tool use without the AI Agent wrapper. For complex, high‑volume deployments, the recommended routing pattern sends simple queries to gpt‑4o-mini ($0.15/1M input) and complex reasoning to Claude 3.5 Sonnet, which can cut aggregate agent costs by 60% or more [6]. For multi‑model orchestration patterns with AI Agents, see the n8n AI Agents & LLM Orchestration guide.

What vector store nodes does n8n provide, and how do they support RAG workflows?

n8n supports seven vector database integrations natively: Pinecone, Supabase (pgvector‑backed), Qdrant, PGVector (PostgreSQL with pgvector extension), Milvus, MongoDB Atlas, and an in‑memory vector store for development and testing. Each vector store node supports four operation modes: Get Many, Insert Documents, Retrieve Documents (As Vector Store for Chain/Tool), and Retrieve Documents (As Tool for AI Agent). [5]

All vector store nodes follow the supplyData() execution pattern: they create a LangChain vector store instance that other nodes consume for semantic search. Five projection types—list, slice, object, flatten, and filter—enable complex nested JSON querying without custom code. For the search, each vector store supports semantic (embedding‑based), lexical (keyword‑based), or hybrid search. For production, match the embedding dimensions exactly: text-embedding- 3-small generates 1,536‑dimensional vectors, while text- embedding-3-large generates 3,072 dimensions. For self‑hosted pgvector, set chunk_size: 1000 and chunk_overlap: 200 as flexible starting points, then create an HNSW index for cosine similarity over millions of vectors. For the complete ingestion‑to‑retrieval pipeline, see the Vector Store Integration guide.

Vector Store Hosting Ideal Scale Key Advantage Operation Modes
Pinecone Cloud‑managed 1M–100M+ vectors Hands‑off ops, serverless, hybrid search Get Many, Insert, Retrieve (Chain/Tool), Retrieve (Agent Tool), Update
PGVector Self‑hosted (PostgreSQL) <1M vectors Zero new infra; existing Postgres + SQL backups Get Many, Insert, Retrieve (Chain/Tool), Retrieve (Agent Tool)
Qdrant Cloud or Self‑hosted 1M–50M+ vectors Production‑grade, multi‑tenant collections Get Many, Insert, Retrieve (Chain/Tool), Retrieve (Agent Tool)
Supabase Cloud or Self‑hosted <1M vectors Managed pgvector with native n8n integration Get Many, Insert, Retrieve (Chain/Tool), Retrieve (Agent Tool), Update

How do you build a complete RAG pipeline with n8n’s AI nodes—from document ingestion to citation?

A complete n8n RAG pipeline follows six stages: (1) Ingest— Default Data Loader reads PDFs, HTML, or JSON from Google Drive, HTTP, or manual upload. (2) Chunk—Recursive Character Text Splitter with chunk_size: 1000 and chunk_overlap: 200. (3) Embed—Embeddings OpenAI (text-embedding-3-small, 1,536 dims) or Cohere. (4) Store—Pinecone, Qdrant, or PGVector in Insert mode. (5) Retrieve—Vector Store in Retrieve Documents (As Tool for AI Agent) mode. (6) Answer—LLM generates a grounded response with source citations. [9] [10]

For each incoming query, the pipeline generates a query embedding, runs a similarity search (top_k: 5–10 with a relevance threshold), and maps results into a context string. An IF node checks when no results exceed the similarity threshold and branches to a fallback answer. Store index or collection names as workflow variables, and log the document IDs returned by retrieval for debugging. To implement productive guardrails, validate JSON schema with an IF node and fallback to a secondary LLM pass if malformed; capture errors in an Error Workflow. For multimodal RAG with image analysis, use GPT‑4o’s vision capability through the OpenAI Chat Model node. For the complete production‑grade RAG blueprint that works across Pinecone, Weaviate, and pgvector, see the Vector Store Integration guide.

References

This guide is for informational purposes only. For the most current and authoritative information, always refer to the official n8n website (n8n.io), the n8n documentation, and the respective OpenAI, Anthropic, Pinecone, and LangChain API documentation. Node counts, categories, and AI features may change over time.

Leave a Reply

Your email address will not be published. Required fields are marked *