Supabase Database Agent
Create an AI agent that can interact with your Supabase database
Overview
Welcome to Magma! 🌋
This template will help you create:
- An AI agent hosted on Magma
- A secure connection to your Supabase database
- Natural language interactions with your database to run complex queries
Prerequisites:
- A Supabase project with database access
- Your database’s master password
- If you’ve lost the password, reset it in the Supabase dashboard before continuing
Getting Started
Install the CLI
If you have already installed the CLI, you can skip this step
Login to Magma
magma init
command to create a new agent using the supabase-db
templateUse the Supabase Template
Supabase Configuration
Getting Your Connection String
Access Supabase Dashboard
- Go to your Supabase project dashboard
- Click the “Connect” button at the top of the screen
Find Connection Details
Locate the “Transaction Pooler” section in the connection panel
Make sure to use the Transaction Pooler connection string, not the direct connection string!
Copy Connection String
Copy the entire postgres connection string (starts with postgresql://
)
Set Environment Variable
Add the connection string to your .env
file:
Update database password
Replace [YOUR-PASSWORD]
with your database’s master password in the POSTGRES_URL environment variable.
Testing and Deployment
Local Testing
Test your agent locally first:
Deploy
When everything works locally, deploy to Magma:
Now, your agent is deployed on Magma and ready to use!