Handle customer support queries with cache-first RAG using Redis, LangCache and OpenAI
Ready for 3.0Ready for 3.0. This template uses no nodes that n8n 3.0 removes. No removed nodes, versions or helpers found. Static check, last run 2026-10-19.
Nodes used (16)
- Chat Trigger
@n8n/n8n-nodes-langchain.chatTrigger - AI Agent
@n8n/n8n-nodes-langchain.agent - Structured Output Parser
@n8n/n8n-nodes-langchain.outputParserStructured - Split Out
n8n-nodes-base.splitOut - HTTP Request
n8n-nodes-base.httpRequest - If
n8n-nodes-base.if - Edit Fields (Set)
n8n-nodes-base.set - Loop Over Items (Split in Batches)
n8n-nodes-base.splitInBatches - Aggregate
n8n-nodes-base.aggregate - Redis Vector Store
@n8n/n8n-nodes-langchain.vectorStoreRedis - Embeddings OpenAI
@n8n/n8n-nodes-langchain.embeddingsOpenAi - Default Data Loader
@n8n/n8n-nodes-langchain.documentDefaultDataLoader - OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi - OpenAI
@n8n/n8n-nodes-langchain.openAi - Schedule Trigger
n8n-nodes-base.scheduleTrigger - Simple Memory
@n8n/n8n-nodes-langchain.memoryBufferWindow
What it does
An end-to-end Retrieval-Augmented Generation (RAG) customer support workflow for n8n, using a cache-first strategy (LangCache) combined with a Redis vector store powered by OpenAI embeddings. This template is designed for fast, accurate, and cost-efficient customer support chatbots, internal help desks, and knowledge-base assistants. --- Overview This workflow implements a production-ready RAG architecture optimized for customer support use cases. Incoming chat messages are processed through a structured pipeline that prioritizes cached answers, falls back to semantic vector search when needed, and validates response quality before returning a final answer. The workflow supports: - Multi-question user inputs - Intelligent query decomposition - Cache reuse to reduce latency and cost - High-precision retrieval from a Redis vector database - Quality evaluation and controlled retries - Final answer synthesis into a single, coherent response --- Key Features - Chat-based RAG pipeline using n8n’s Chat Trigger - Query decomposition for multi-topic questions - LangCache integration (search + save) - Redis Vector Store for semantic retrieval - OpenAI embeddings and chat models - Quality scoring with retry logic - Session memory buffers for contextual continuity - Fallback-safe behavior (no hallucinations) --- How the Workflow Works 1. Chat Trigger The workflow starts when a new chat message is received. 2. Configuration Setup A centralized configuration node defines: - LangCache base URL - Cache ID - Similarity threshold (default: 0.75) - Maximum retrieval iterations (default: 2) 3. Query Decomposition The user message is analyzed and decomposed into: - A single focused question, or - Multiple independent sub-questions This improves retrieval accuracy and cache reuse. 4. Cache-First Retrieval Each sub-question is processed independently: - The workflow first searches LangCache - If a high-similarity cached answer is found, it is reused immediately 5. Vector Retrieval (Cache Miss) If no cache hit exists: - The query is embedded using OpenAI embeddings - A semantic search is executed against the Redis vector index - Retrieved knowledge-base documents are passed to a research-only agent 6. Knowledge-Only Answering The research agent: - Answers strictly from the retrieved knowledge - Returns "no info found" if no relevant data exists 7. Quality Evaluation Each generated answer is evaluated by a dedicated quality-check node: - Outputs a numerical SCORE (0.0 – 1.0) - Provides textual feedback - Low scores can trigger limited retries 8. Cache Update High-quality answers are saved back to LangCache for future reuse. 9. Aggregation & Synthesis All sub-answers are aggregated and synthesized into: - One final, user-facing response, or - A polite fallback message if information is insufficient --- Main Nodes & Responsibilities - When Chat Message Received — Entry point for user messages - LangCache Config — Centralized configuration values - Decompose Query (LangChain Agent) — Splits complex queries - Structured Output Parser — Ensures valid JSON output - Search LangCache — Cache lookup via HTTP - Redis Vector Store — Semantic retrieval from Redis - Embeddings OpenAI — Vector generation - Research Agent — KB-only answering (no hallucinations) - Quality Evaluator — Scores answer relevance - Save to LangCache — Stores validated answers - Memory Buffers — Session context handling - Response Synthesizer — Final message generation --- Setup Instructions 1. Configure Credentials Create the following credentials in n8n: - OpenAI API - Redis - HTTP Bearer Auth (for LangCache) 2. Prepare the Knowledge Base - Embed your documents using OpenAI embeddings - Insert them into the configured Redis vector index - Ensure documents are concise and well-structured 3. Configure LangCache Update the configuration node with: - langcacheBaseUrl - langcacheCacheId - Optional tuning for similarity threshold and iterations 4. Test the Workflow - Use the example data loader