Setup Guide
This guide covers the complete setup process for Agility, including environment configuration, service integrations, and credential management.If you’re deploying your own instance of Agility, follow this guide. If you’re using a hosted version, skip to Service Integrations.
Prerequisites
Before you begin, ensure you have:- Node.js 18+ or Bun runtime
- Supabase account (free tier available)
- API keys for services you plan to use:
- OpenAI API key for GPT models
- Anthropic API key for Claude models
- GitHub Personal Access Token for repository monitoring
- Discord Webhook URL for notifications
- Gmail OAuth credentials for email automation
Installation
Supabase Setup
Create Your Supabase Project
Create a New Project
- Go to supabase.com
- Click “New Project”
- Enter project details and select a region
- Wait for the database to initialize (2-3 minutes)
Get Your Project Credentials
Navigate to Settings → API and copy:
- Project URL:
NEXT_PUBLIC_SUPABASE_URL - Anon/Public Key:
NEXT_PUBLIC_SUPABASE_ANON_KEY
.env.local file.Deploy Edge Functions
Agility uses Supabase Edge Functions for serverless workflow execution. Deploy them using the Supabase CLI:Deploy All Functions
supabase/functions directory:generate-workflow- AI workflow generationgenerate-text- Text generation with GPT/Claudemanage-workflows- Save and load workflowsmanage-api-keys- Secure credential storageread-gmail- Gmail integrationsend-gmail- Gmail sendingsend-discord- Discord messagingread-github- GitHub repository monitoringrun-workflow- Workflow execution engine
Create Database Tables
Run these SQL commands in the Supabase SQL Editor (Database → SQL Editor):Service Integrations
OpenAI (GPT Models)
Get Your API Key
- Visit platform.openai.com/api-keys
- Click “Create new secret key”
- Copy the key (it won’t be shown again)
Add to Agility
In the workflow builder, click a Text Generator agent and paste your API key. Select a GPT model:
- GPT-3.5 Turbo: Fast and cost-effective
- GPT-4: More capable, higher quality
- GPT-4 Turbo: Faster GPT-4 with lower cost
Anthropic (Claude Models)
Get Your API Key
- Visit console.anthropic.com
- Navigate to API Keys
- Click “Create Key” and copy it
Gmail Integration
Gmail requires OAuth authentication for secure access:Create Google Cloud Project
- Go to console.cloud.google.com
- Create a new project
- Enable the Gmail API
Configure OAuth Consent Screen
- Navigate to APIs & Services → OAuth consent screen
- Select External and fill in required details
- Add scopes:
gmail.readonlyandgmail.send
Create OAuth Credentials
- Go to Credentials → Create Credentials → OAuth client ID
- Select Web application
- Add authorized redirect URI:
- Copy the Client ID and Client Secret
Discord Webhooks
Create a Webhook
- Open your Discord server
- Go to Server Settings → Integrations → Webhooks
- Click “New Webhook”
- Select a channel and copy the webhook URL
Configure in Agility
In the Discord Messenger agent configuration:You can use dynamic fields from previous agents:
GitHub Integration
Create Personal Access Token
- Go to github.com/settings/tokens
- Click “Generate new token (classic)”
- Select scopes:
repo(for private repos) orpublic_repo(for public only) - Copy the token
Security Best Practices
API Key Storage
All API keys are encrypted before storage:Row Level Security
All database tables use RLS policies to ensure users only access their own data:Environment Variables
- Never commit
.env.localto version control - Use different credentials for development and production
- Rotate API keys regularly
- Use Supabase’s built-in secrets for Edge Functions
Deployment
Deploy to Vercel
Connect Repository
- Go to vercel.com
- Click “Import Project”
- Connect your GitHub repository
Configure Environment
Add your environment variables in Vercel:
NEXT_PUBLIC_SUPABASE_URLNEXT_PUBLIC_SUPABASE_ANON_KEY
Update OAuth Redirects
After deployment, update your OAuth redirect URIs:Troubleshooting
Edge Function Errors
Issue: Edge function returns 500 error Solution: Check logs in Supabase dashboard under Edge Functions → LogsAuthentication Issues
Issue: Unable to sign in or sign up Solution: Verify email auth is enabled in Supabase under Authentication → ProvidersAPI Key Not Persisting
Issue: API key disappears after page refresh Solution: Ensure you clicked “Save Configuration” and the success message appearedGmail OAuth Fails
Issue: OAuth redirect shows error Solution:- Verify redirect URI matches exactly (including http/https)
- Check OAuth consent screen is configured
- Ensure Gmail API is enabled in Google Cloud Console
Next Steps
Build Workflows
Start creating automated workflows
Agent Reference
Detailed documentation for each agent type
API Documentation
Integrate workflows via REST API
Best Practices
Learn workflow optimization techniques