Supabase-Powered AI Agent with RAG Memory
detail.loadingPreview
This n8n workflow orchestrates a sophisticated AI agent using Supabase for persistent memory and task management, enhanced by Retrieval Augmented Generation (RAG). It enables the agent to remember past interactions, store knowledge, and manage its tasks through a robust database backend.
About This Workflow
Unlock the full potential of AI with this powerful n8n workflow, designed to build intelligent agents that learn and adapt. This solution integrates Langchain, OpenAI, and Supabase to create an AI agent capable of managing its own state, tasks, and historical knowledge. By leveraging Supabase as a vector store for RAG, the agent can "remember" past interactions and consult system instructions, ensuring contextually rich and consistent responses. It also performs comprehensive CRUD operations on agent_messages and agent_tasks tables, providing a complete framework for agent memory, task assignment, and status tracking, making your AI applications smarter and more reliable.
Key Features
- Persistent AI Memory with Supabase: Utilizes Supabase as a vector store to power Retrieval Augmented Generation (RAG), enabling the AI agent to remember past interactions and learn over time.
- OpenAI Embeddings Integration: Transforms text into vectors using OpenAI's
text-embedding-ada-002for efficient and accurate similarity searches in the RAG process. - Comprehensive Supabase Management: Features dedicated nodes for Creating, Reading, Updating, and Deleting (CRUD) agent messages, tasks, and knowledge within Supabase tables.
- Custom Langchain Trigger: Initiates the AI agent's operations, allowing for flexible integration into various systems and event-driven workflows.
- Structured Agent State Management: Organizes agent data into distinct Supabase tables (
agent_messages,agent_tasks,agent_knowledge) for clear oversight and control.
How To Use
- Set up Supabase: Ensure you have a Supabase project with tables named
documents,agent_messages,agent_tasks, andagent_knowledge. Configure your API keys and project URL. - Configure Credentials:
- Supabase Account: Provide your Supabase project URL and Anon/Service Role Key for the
Supabase accountcredential. - OpenAI Account: Enter your OpenAI API key for the
OpenAi accountcredential.
- Supabase Account: Provide your Supabase project URL and Anon/Service Role Key for the
- Customize RAG Node:
- In the
RAGnode, ensuretableNamepoints to your Supabasedocumentstable for storing vector embeddings. - Adjust
topKto control the number of relevant documents retrieved. - Modify
toolNameandtoolDescriptionto accurately reflect the agent's function if different from "ITERACOES" and its description.
- In the
- Tailor Supabase Tool Nodes:
- For
CREATE,GET,UPDATE,DELETE, andGET MANYoperations acrossAGENT_MESSAGE,AGENT_TASKS, andAGENT_KNOWLEDGE, verify that thetableIdparameter in each node correctly references your specific Supabase table names. - Adapt the input data for
CREATEandUPDATEnodes to match your table schema using expressions.
- For
- Activate Trigger: The
MCP_SUPABASEtrigger node uses a webhook. Configure your external system to send requests to this webhook URL to activate the agent.
Apps Used
Workflow JSON
{
"id": "8dda38da-f8b7-43a5-9883-a766dcdcdc85",
"name": "Supabase-Powered AI Agent with RAG Memory",
"nodes": 17,
"category": "Operations",
"status": "active",
"version": "1.0.0"
}Note: This is a sample preview. The full workflow JSON contains node configurations, credentials placeholders, and execution logic.
Get This Workflow
ID: 8dda38da-f8b7...
About the Author
SaaS_Connector
Integration Guru
Connecting CRM, Notion, and Slack to automate your life.
Statistics
Related Workflows
Discover more workflows you might like
Google Sheets to Icypeas: Automated Bulk Domain Scanning
This workflow streamlines the process of performing bulk domain scans by integrating your Google Sheets data directly with the Icypeas platform. Automate the submission of company names from your spreadsheet to Icypeas for comprehensive domain information, saving valuable time and effort.
Instant WooCommerce Order Notifications via Telegram
When a new order is placed on your WooCommerce store, instantly receive detailed notifications directly to your Telegram chat. Stay on top of your e-commerce operations with real-time alerts, including order specifics and a direct link to view the order.
On-Demand Microsoft SQL Query Execution
This workflow allows you to manually trigger and execute any SQL query against your Microsoft SQL Server database. Perfect for ad-hoc data lookups, administrative tasks, or quick tests, giving you direct control over your database operations.