Run a RAG support copilot with Claude Sonnet and OpenAI embeddings
Quick overview This template ingests internal docs into an in-memory vector knowledge base using OpenAI embeddings, then runs a public support chat powered by Anthropic Claude that answers only from that knowledge and escalates unanswered requests to a Gmail inbox while logging all Q&A to an n8n Data Table.
How it works Receives knowledge-base entries from an n8n Form trigger with a source title and free-text content. Splits the submitted content into chunks, generates OpenAI embeddings, and stores the vectors in an in-memory vector store keyed as company_kb. Exposes a public chat endpoint where customers submit support questions. Uses an Anthropic Claude agent with short-term conversation memory to first search the company_kb vector store and respond only using retrieved passages. If the knowledge base does not contain the answer or the user requests a human, the agent sends an escalation email via Gmail with the question and context. Logs each question, the agent’s answer, the session ID, and a timestamp to an n8n Data Table.
Setup Add credentials for OpenAI (Embeddings) and Anthropic (Claude) and select the correct model in the Claude node. Connect a Gmail OAuth2 credential and set the destination support email address in the escalation email tool. Create or select an n8n Data Table named support_chat_log (or update the workflow to use your table). Publish the Form and Chat triggers and share their URLs as needed (use the form internally for ingestion and the chat URL for customers).
Requirements n8n instance with the Data Table feature enabled Anthropic API key (Claude) — the agent's reasoning OpenAI API key — embeddings for the vector store Gmail account connected via OAuth2 — human escalation
Customization Swap the in-memory vector store for Pinecone / Qdrant / Supabase to persist the knowledge base across restarts (production-grade) Replace the paste-text form with a file-upload field to ingest PDFs and DOCX Add more agent tools: create a ticket in your helpdesk, look up an order, book a call Change the escalation channel to Slack, WhatsApp, or a helpdesk instead of email Embed the hosted chat on your website, or expose it as a webhook for your own UI
Additional info Grounded, not generative-guessing: the agent answers only from your documents and escalates instead of hallucinating — the #1 trust issue buyers have with AI support. Both flows share the company_kb key, so ingestion and answering stay in sync. Universal fit: SaaS, e-commerce, clinics, agencies, education, real estate anyone with an FAQ and an inbox.
Related Templates
AI Email Classifier & Auto-Delete for Gmail (SPAM/OFFER Cleaner)
This workflow is designed for freelancers, solopreneurs, and business owners who receive a high volume of irrelevant mes...
Generate Product Ad Copy & CTAs with GPT-4 for Slack and Airtable
⚡ AI Copywriter Pro: Instant Ad Copy & CTA Generator Transform product details into compelling marketing copy in second...
Auto-classify Gmail emails with AI and apply labels for inbox organization
Who is this for? Professionals and individuals who receive high volumes of emails, those who want to automatically organ...
🔒 Please log in to import templates to n8n and favorite templates
Workflow Visualization
Loading...
Preparing workflow renderer
Comments (0)
Login to post comments