Estimated time to complete: 5 minutes

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
1
Install the CLI
If you have already installed the CLI, you can skip this step
2
Login to Magma
3
Use the
magma init
command to create a new agent using the supabase-db
template4
Use the Supabase Template
Supabase Configuration
Getting Your Connection String
1
Access Supabase Dashboard
- Go to your Supabase project dashboard
- Click the “Connect” button at the top of the screen

2
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!
3
Copy Connection String
Copy the entire postgres connection string (starts with
postgresql://
)4
Set Environment Variable
Add the connection string to your
.env
file:5
Update database password
Replace
[YOUR-PASSWORD]
with your database’s master password in the POSTGRES_URL environment variable.Testing and Deployment
1
Local Testing
Test your agent locally first:
2
Deploy
When everything works locally, deploy to Magma:
Troubleshooting
Database Connection Issues
Database Connection Issues
If you’re experiencing DNS or connection errors:
- Verify you’re using the Transaction Pooler connection string
- Check that your connection string is properly formatted
- Ensure your database password is correct
Deployment Errors
Deployment Errors
If you encounter Anthropic SDK related deployment issues:
- Open
tsconfig.json
- Add
"skipLibCheck": true
to thecompilerOptions
section - Run
magma deploy
again