Skip to main content

Local document question answering with Ollama AI, Agentic RAG & PGVector

Workflow preview

Workflow preview
100%
Local document question answering with Ollama AI, Agentic RAG & PGVector preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

n8n Local AI Agentic RAG Template Author: Jadai kongolo What is this? This template provides an entirely local implementation of an Agentic RAG ...

Best for

  • Internal Wiki automation workflows
  • AI RAG automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

@n8n/n8n-nodes-langchain.documentdefaultdataloader, n8n-nodes-base.stickynote, n8n-nodes-base.extractfromfile, @n8n/n8n-nodes-langchain.memorypostgreschat, n8n-nodes-base.set, n8n-nodes-base.respondtowebhook, @n8n/n8n-nodes-langchain.chattrigger, n8n-nodes-base.webhook

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Jadai kongolo.

Original n8n.io source

1.1 Workflow description

Title
Local document question answering with Ollama AI, Agentic RAG & PGVector
Workflow name
Local document question answering with Ollama AI, Agentic RAG & PGVector

🚀 n8n Local AI Agentic RAG Template

Author: Jadai kongolo

What is this?

This template provides an entirely local implementation of an Agentic RAG (Retrieval Augmented Generation) system in n8n that can be extended easily for your specific use case and knowledge base. Unlike standard RAG which only performs simple lookups, this agent can reason about your knowledge base, self-improve retrieval, and dynamically switch between different tools based on the specific question.

Why Agentic RAG?

Standard RAG has significant limitations:

  • Poor analysis of numerical/tabular data
  • Missing context due to document chunking
  • Inability to connect information across documents
  • No dynamic tool selection based on question type

What makes this template powerful:

  • Intelligent tool selection: Switches between RAG lookups, SQL queries, or full document retrieval based on the question
  • Complete document context: Accesses entire documents when needed instead of just chunks
  • Accurate numerical analysis: Uses SQL for precise calculations on spreadsheet/tabular data
  • Cross-document insights: Connects information across your entire knowledge base
  • Multi-file processing: Handles multiple documents in a single workflow loop
  • Efficient storage: Uses JSONB in Supabase to store tabular data without creating new tables for each CSV

Getting Started

  1. Run the table creation nodes first to set up your database tables in Supabase
  2. Upload your documents to the folder on your computer that is mounted to /data/shared in the n8n container. This folder by default is the "shared" folder in the local AI package.
  3. The agent will process them automatically (chunking text, storing tabular data in Supabase)
  4. Start asking questions that leverage the agent's multiple reasoning approaches

Customization

This template provides a solid foundation that you can extend by:

  • Tuning the system prompt for your specific use case
  • Adding document metadata like summaries
  • Implementing more advanced RAG techniques
  • Optimizing for larger knowledge bases

The non-local ("cloud") version of this Agentic RAG agent can be found here.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Default Data Loader

Type / Role
@n8n/n8n-nodes-langchain.documentDefaultDataLoader - documentDefaultDataLoader
Config choices
Version 1

Block 2 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 3 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 4 - Extract Document Text

Type / Role
n8n-nodes-base.extractFromFile - extractFromFile
Config choices
Version 1

Block 5 - Postgres Chat Memory

Type / Role
@n8n/n8n-nodes-langchain.memoryPostgresChat - memoryPostgresChat
Config choices
Version 1

Block 6 - Set File ID

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 7 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 8 - Respond to Webhook

Type / Role
n8n-nodes-base.respondToWebhook - respondToWebhook
Config choices
Version 1.1

Block 9 - Edit Fields

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 10 - When chat message received

Type / Role
@n8n/n8n-nodes-langchain.chatTrigger - chatTrigger
Config choices
Version 1.1

Block 11 - Webhook

Type / Role
n8n-nodes-base.webhook - webhook
Config choices
Version 2

Block 12 - Extract PDF Text

Type / Role
n8n-nodes-base.extractFromFile - extractFromFile
Config choices
Version 1

Block 13 - Aggregate

Type / Role
n8n-nodes-base.aggregate - aggregate
Config choices
Version 1

Block 14 - Summarize

Type / Role
n8n-nodes-base.summarize - summarize
Config choices
Version 1

Block 15 - RAG AI Agent

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 1.6

Block 16 - Switch

Type / Role
n8n-nodes-base.switch - switch
Config choices
Version 3

Block 17 - Extract from Excel

Type / Role
n8n-nodes-base.extractFromFile - extractFromFile
Config choices
Version 1

Block 18 - Set Schema

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 19 - Extract from CSV

Type / Role
n8n-nodes-base.extractFromFile - extractFromFile
Config choices
Version 1

Block 20 - Sticky Note3

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 21 - Create Document Metadata Table

Type / Role
n8n-nodes-base.postgres - postgres
Config choices
Version 2.5

Block 22 - Create Document Rows Table (for Tabular Data)

Type / Role
n8n-nodes-base.postgres - postgres
Config choices
Version 2.5

Block 23 - List Documents

Type / Role
n8n-nodes-base.postgresTool - postgresTool
Config choices
Version 2.5

Block 24 - Get File Contents

Type / Role
n8n-nodes-base.postgresTool - postgresTool
Config choices
Version 2.5

Showing the first 24 of 41 workflow blocks. Download the JSON for the full node graph.

3. Summary Table

Workflow Local document question answering with Ollama AI, Agentic RAG & PGVector
Complexity advanced
Nodes 41
Categories Internal Wiki, AI RAG
Author Jadai kongolo
Published 25 Oct 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/10157/10157.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Local document question answering with Ollama AI, Agentic RAG & PGVector do?

n8n Local AI Agentic RAG Template Author: Jadai kongolo What is this? This template provides an entirely local implementation of an Agentic RAG ...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Internal Wiki, AI RAG use case.