Agentic RAG Workflow in n8n

Aug 11, 2025

Summary

  • The session provided a comprehensive walkthrough of the limitations of standard Retrieval-Augmented Generation (RAG) pipelines for knowledge base access and introduced the concept and practical setup of “agentic RAG” in n8n.
  • Topics included the design, deployment, and improvement of a multi-tool RAG agent, with hands-on demonstrations handling different document types and tabular data.
  • The meeting also covered enhancements to data ingestion pipelines (especially around CSV and Google Drive integration) and recommendations for further customization according to user needs.
  • The sponsor, UnrAI, was mentioned for advanced document extraction needs, especially with unstructured formats.

Action Items

  • Provide downloadable agentic RAG n8n workflow template for viewers.
  • Prepare a walkthrough for a local (non-cloud) version of the agentic RAG agent using the local AI package (pending interest/comments).
  • Share relevant links and documentation (including UnrAI GitHub and Superbase integration guides) in the video description.

RAG Limitations and Agentic RAG Motivation

  • Standard RAG is easy to implement but often fails by missing context, returning incomplete or incorrect document chunks, or not connecting related documents, especially in complex queries and data analysis.
  • Two main problems: inability to “zoom out” to entire documents/collections and lack of built-in data analysis capabilities.
  • Agentic RAG addresses these by giving agents a suite of tools (not just RAG lookup), reasoning about tool selection, and improving retrievals through secondary queries or direct file/SQL access.

Overview and Demonstration of Agentic RAG in n8n

  • The agentic RAG workflow is more complex than typical RAG agents but improves reliability by including:
    • Standard RAG tool (now with source citation).
    • Postgres-based tools to list documents, retrieve file contents, and query tabular data (CSV/Excel as SQL tables).
  • Demonstrations showcased the agent flexibly:
    • Using SQL queries to answer questions about spreadsheets.
    • Extracting relevant content from text-based meeting notes.
    • Directly retrieving and citing full file content if RAG lookup is insufficient.

Ingestion Pipeline and Knowledge Base Setup

  • The pipeline integrates with Google Drive to monitor for new/updated files, handles multi-file ingestion, and populates a Superbase database with document content, metadata, and (for tables) schema and row data.
  • Data is chunked and embedded for RAG, and tabular files are prepared with schema information for SQL querying.
  • Workflow includes logic for clearing old data on updates to ensure accuracy.

Building and Customizing the Agentic RAG Agent

  • Agent setup in n8n includes:
    • Triggers for webhooks and chat interaction.
    • System prompt instructing reasoning around tool use and fallback behavior (advising honesty if information is not available).
    • RAG module returning metadata, schema-aware SQL querying, and file listing tools.
    • Emphasized need for custom prompt engineering and tool descriptions depending on the use case.
    • Consideration of LLM model selection for balancing cost, speed, and power.

Sponsor Mention: UnrAI

  • Introduced UnrAI as a no-code, open-source platform for building LLM APIs and ETL pipelines, especially valuable for extracting structured data from complex, unstructured documents (PDFs, images, etc.).
  • Highlighted Prompt Studio for custom information extraction and API/pipeline deployment.
  • Recommended for advanced needs beyond simple CSV/text extractions.

Next Steps and Extensibility

  • Template encourages extension and customization of prompts, tools, and pipeline logic for diverse knowledge bases.
  • Plans to release a fully local agentic RAG workflow leveraging local AI.
  • Viewers invited to ask questions and suggest further features (e.g., local file triggers, advanced document handling).

Decisions

  • Adopt agentic RAG over standard RAG — Due to improved document context handling and data analysis via multiple complementary tools, resulting in higher accuracy and reliability for complex queries.

Open Questions / Follow-Ups

  • Viewer interest is solicited for a local AI-based version of the agentic RAG workflow.
  • Possible future feature: Handling of deleted files in the ingestion pipeline (currently unsupported in n8n's Google Drive integration).
  • Additional guidance may be needed on prompt engineering for specific knowledge base schemas.