Backend Setup Guide
This guide covers how to set up and run the AgentOps backend services from the/app
directory. The backend includes the API server, dashboard, database services, and observability infrastructure.
Architecture Overview
The AgentOps backend consists of several interconnected services:- API Server (
api/
) - FastAPI backend with authentication, billing, and data processing - Dashboard (
dashboard/
) - Next.js frontend for visualization and management - Supabase - Authentication and primary PostgreSQL database
- ClickHouse - Analytics database for traces and metrics
- OpenTelemetry Collector - Observability and trace collection
- Redis (optional) - Caching and session storage
Prerequisites
Before setting up the backend, ensure you have the following installed:Required Software
- Node.js 18+ (Download)
- Python 3.12+ (Download)
- Docker & Docker Compose (Download)
- Bun (recommended) or npm (Install Bun)
- uv (recommended for Python) (Install uv)
- Just (optional, for convenience commands) (Install Just)
External Services
You’ll need accounts and setup for these external services:- Supabase - Database and authentication (supabase.com)
- ClickHouse Cloud - Analytics database (clickhouse.com/cloud)
- Stripe (optional) - Payment processing (stripe.com)
Quick Start
1. Clone and Navigate
2. Environment Setup
Copy and configure environment files:3. Install Dependencies
4. Configure External Services
Update your.env
files with your service credentials. See External Services Configuration below.
5. Start Services
6. Verify Setup
- Dashboard: http://localhost:3000
- API Documentation: http://localhost:8000/redoc
- API Health Check: http://localhost:8000/health
External Services Configuration
Supabase Setup
- Create a new project at supabase.com
- Go to Settings → API to get your keys
- Run the database migrations:
- Update your
.env
files with:
ClickHouse Setup
- Sign up for ClickHouse Cloud or self-host
- Create a database and get connection details
- Run the ClickHouse migrations:
- Update your
.env
files with:
Stripe Setup (Optional)
For billing functionality:- Create a Stripe account
- Get your API keys from the dashboard
- Update your
.env
files with:
Additional Services (Optional)
- Sentry: Error monitoring
- PostHog: Analytics
Development Workflow
Using Just Commands (Recommended)
Thejustfile
provides convenient commands for development:
Manual Development
If you prefer running services manually:Service Configuration
API Server Configuration
Key environment variables for the API server (api/.env
):
Dashboard Configuration
Key environment variables for the dashboard (dashboard/.env.local
):
Troubleshooting
Common Issues
Port conflicts:- Verify your Supabase and ClickHouse credentials
- Check network connectivity to external services
- Ensure database migrations have been applied
Logs and Debugging
Next Steps
Once your backend is running:- Create an account at http://localhost:3000
- Generate an API key in the dashboard
- Install the AgentOps SDK and start tracking your AI agents
- Explore the dashboard to view traces and analytics