Run Supabase 100% LOCALLY for Your AI Agents
AI Summary
Summary of Video Transcript
- Topic: Setting up Supabase locally for AI agents
- Supabase:
- Open-source platform with PostgreSQL under the hood.
- Offers features like authentication, object storage, and the PG Vector extension for vector databases.
- Useful for managing conversation history, state, and vector databases for AI agents.
Detailed Instructions & Tips
- Local AI Package:
- Includes Supabase for database and vector store capabilities.
- Originally contained n8n, Ollama, Quadrant, and PostgreSQL.
- Added Flow-wise, Open Web UI, and now Supabase, replacing PostgreSQL.
- Quadrant remains for faster vector store use cases.
- Prerequisites:
- Python, Git/GitHub Desktop, Docker/Docker Desktop.
- Clone the dedicated GitHub repository for the local AI package.
- Environment Setup:
- Create an
.env
file with variables for n8n and Supabase.- Set Postgres password, dashboard login, and Pooler tenant ID.
- Generate JWT secret, anonymous key, and service role key using Supabase’s self-hosting guide.
- Docker Compose:
- Use a separate Docker compose file for Supabase due to multiple containers.
- The Python script combines Supabase’s Docker compose with the local AI package.
- Containers run on the same Docker Network for easy connection.
- Starting the Local AI Stack:
- Use provided commands based on architecture (Nvidia GPU, AMD GPU, CPU, or Mac).
- The
start-services.py
script handles cloning, updating, and restarting containers.- Data in n8n workflows and Supabase tables persists across container restarts.
- Troubleshooting:
- Common issues and solutions are provided in the README.
Creating an AI Agent
- n8n Workflow:
- Automatically imports a local rag AI agent workflow.
- Set up credentials for AMA and Supabase (Postgres node and vector store).
- For vector store, use
host.docker.internal
as the host.- Local File to Vector Store Workflow:
- Watches for file changes in a local folder.
- Cleans the vector database for updated files.
- Extracts text from files and inserts vectors into Supabase.
- Testing the Agent:
- Use the n8n workflow to add local files to the Supabase vector store.
- Chat with the local AI agent to retrieve information from the vector store.
Conclusion
- The local AI package now includes Supabase, enhancing its capabilities for local AI development.
- The video provides a step-by-step guide to setting up and using the package.
- Future plans include expanding the package and incorporating community feedback.
URLs and Commands
- GitHub repository for the local AI package: (URL not provided in the transcript)
- Supabase self-hosting guide: (URL not provided in the transcript)
- Commands for starting the local AI stack, updating containers, and setting environment variables are mentioned but not provided in the transcript.