How to Build a Client-Docs AI Agent in n8n
For Consulting firms · Based on Alejandro AO Agentic RAG n8n Build
// TL;DR
Consulting firms can use Agentic RAG in n8n to let staff query a repository of client-uploaded PDF reports through a secure chat interface — without ever exposing the raw files. You build an Ingestion Workflow (Google Drive trigger → Document Loader → Hugging Face embeddings → Chroma vector store) and a Retrieval Workflow (authenticated chat trigger → AI Agent + Knowledge Base Search tool on the same Chroma collection). Staff access a published chat URL and the agent answers only from ingested reports, citing page numbers. Costs stay low with free embeddings and cheap open LLMs.
Why do consulting firms need Agentic RAG?
Consulting firms accumulate hundreds of client reports — PDFs full of findings, tables, and analysis. Staff need answers from these documents fast, but sharing raw files creates version-control chaos and confidentiality risk. Agentic RAG solves this: an AI agent queries an embedded knowledge base of your reports and returns grounded answers, so nobody handles the underlying files directly.
Unlike Manual RAG's rigid pipeline, Agentic RAG gives the agent a Knowledge Base Search tool and lets it decide when to search, how many times, and with what query. That means partners can ask nuanced, multi-part questions and the agent will retrieve exactly what it needs.
How do you set up secure document ingestion?
Build the Ingestion Workflow to trigger on a Google Drive file-added event pointed at a controlled folder. Connect a Document Loader (PDF) node, then chunk the text with a structure-aware splitter — remember that data extraction from tables and unusual layouts is one of the hardest parts of the pipeline, so consider a specialised extractor like Unstructured for production.
Attach a Hugging Face Inference embeddings node (using a model like BAAI/bge-m3) and feed the vectors into a Chroma vector store insert node — not the in-memory store, which loses data on restart. Record the collection ID; you'll reuse it exactly in retrieval.
How do staff query the reports securely?
Build the Retrieval Workflow with a 'Chat Message Received' trigger and enable n8n user authentication so only your team reaches the chat URL. Add an AI Agent node with a system prompt like: 'You answer only from internal client reports via the vector search tool. Cite page numbers.'
Attach an OpenAI Chat Model node routed to router.huggingface.co/v1 running an open model (Qwen 3 27B or GLM 5.1) — dramatically cheaper than closed frontier models. Add the Knowledge Base Search tool pointing at the same Chroma collection, with the exact same embedding model attached to its embeddings input. Enable 'include metadata' so the agent can cite page numbers and source filenames.
How do you keep it confidential and reliable?
Never leave the n8n instance internet-accessible without authentication — anyone with the URL could trigger workflows and consume your API quota. Deploy via Docker on a VPS behind a reverse proxy with auth, or use an SSH tunnel. Monitor the Executions panel to see which tools each query called and to catch errors early.
The biggest silent failure mode is embedding model mismatch: if the ingestion and retrieval embedding models differ even slightly, similarity scores become meaningless and answers degrade without any error. Use one embedding model node reference for both.
What does the finished system deliver?
A private chat URL where consultants ask natural-language questions and receive answers grounded strictly in ingested client reports, complete with page citations. New reports dropped into the Drive folder are ingested automatically. Running costs stay minimal thanks to free Hugging Face embeddings and $1–$3-per-million-token open models.
Next step: Stand up n8n via Docker on a secured VPS, create your Hugging Face token with 'read repos' and 'call inference providers' permissions, and build the Ingestion Workflow first — test it end-to-end before wiring up the agent.
// FREQUENTLY ASKED QUESTIONS
Can the agent answer only from client documents and not from general knowledge?
Yes. Write a strict system prompt instructing the agent to answer only from the Knowledge Base Search tool results and to say it doesn't know if the documents lack the answer. Because the agent decides when to call the tool, a precise tool description and system prompt keep it grounded in your ingested client reports rather than its training data.
How do we keep client reports confidential in n8n?
Enable authentication on the chat trigger (n8n user auth or Basic Auth), deploy n8n behind a reverse proxy with auth or via SSH tunnel, and never expose the instance publicly without a password. Store embeddings in a self-hosted Chroma or Qdrant instance you control. Staff query through the agent and never touch raw files directly.
What happens when a new client report is uploaded?
If your Ingestion Workflow uses a Google Drive file-added trigger, the new report is automatically loaded, chunked, embedded, and inserted into the same Chroma collection. No manual step is required — the agent can query the new content immediately, as long as the embedding model stays consistent with the existing vectors.