Sync Supabase Storage files into a chat agent with Supabase vectors and OpenAI
Needs changesNeeds changes. This template uses 1 thing(s) that n8n 3.0 removes: AI Agent v1 (old agent modes). 1 breaking item(s) found. Static check, last run 2026-10-19.
What to replace before upgrading
| Removed in 3.0 | Replace with |
|---|---|
| AI Agent v1 (old agent modes) AI Agent (v1.7) | Latest AI Agent node (Tools Agent). For SQL Agent, use a Postgres or MySQL tool with a recent AI Agent. |
Nodes used (17)
- HTTP Request
n8n-nodes-base.httpRequest - Default Data Loader
@n8n/n8n-nodes-langchain.documentDefaultDataLoader - Recursive Character Text Splitter
@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter - Extract from File
n8n-nodes-base.extractFromFile - Embeddings OpenAI
@n8n/n8n-nodes-langchain.embeddingsOpenAi - Supabase
n8n-nodes-base.supabase - If
n8n-nodes-base.if - Loop Over Items (Split in Batches)
n8n-nodes-base.splitInBatches - Manual Trigger
n8n-nodes-base.manualTrigger - Aggregate
n8n-nodes-base.aggregate - Chat Trigger
@n8n/n8n-nodes-langchain.chatTrigger - OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi - Vector Store Question Answer Tool
@n8n/n8n-nodes-langchain.toolVectorStore - Switch
n8n-nodes-base.switch - Supabase Vector Store
@n8n/n8n-nodes-langchain.vectorStoreSupabase - Merge
n8n-nodes-base.merge - AI Agent
@n8n/n8n-nodes-langchain.agent
What it does
Quick overview This workflow syncs files from Supabase Storage into a Supabase vector store using OpenAI embeddings, then exposes an n8n chat trigger where an AI agent answers questions by retrieving relevant document chunks from Supabase. How it works 1. Starts a manual sync run when you click “Test workflow”. 2. Reads existing file records from the Supabase files table and lists objects in the Supabase Storage private bucket. 3. Compares both lists and skips files that are already indexed or match the .emptyFolderPlaceholder marker. 4. Downloads each new file from Supabase Storage and extracts text (PDFs are parsed; files without an extension are treated as plain text). 5. Creates a new row in the Supabase files table and splits the extracted text into chunks. 6. Generates embeddings with OpenAI and inserts the chunks into the Supabase documents vector table for later retrieval. 7. When a chat message is received, an AI agent uses OpenAI and a Supabase vector search tool to retrieve the top matches and respond with answers grounded in the indexed files. Setup 1. Add a Supabase API credential and replace the hardcoded Supabase project URL used by the Storage list and download requests. 2. Create the Supabase files table (at least name and storageid) and a documents vector table plus the matchdocuments function required by the Supabase vector store integration. 3. Add OpenAI credentials for the embeddings model and chat models used by the indexing and chat steps. 4. Update or remove the hardcoded fileid metadata filter in the Supabase vector search so the chat agent searches across all indexed documents (or set it to the file you want to limit results to). 5. If you plan to index non-PDF text uploads, add a text extraction/reading step for the “txt” branch so plain files produce text for chunking and embedding.