Environment Variables
Required
| Variable | Description |
|---|---|
DATABASE_URL | PostgreSQL connection string |
Optional
| Variable | Default | Description |
|---|---|---|
LOGICAL_REPLICATION_ENABLED | true | Enable diff capture via WAL |
ENVIRONMENT | development | Environment name |
SEED | true | Run seed scripts on startup |
Performance Tuning
| Variable | Default | Description |
|---|---|---|
ENVIRONMENT_POOL_TARGETS | Auto-detect | Target pool sizes per template |
MAINTENANCE_IDLE_TIMEOUT | 300 | Seconds before maintenance stops |
MAINTENANCE_CYCLE_INTERVAL | 10 | Seconds between cycles |
POOL_REFILL_CONCURRENCY | 10 | Parallel schema builds |
REPLICATION_IDLE_TIMEOUT | 300 | Seconds before replication stops |
Database Requirements
PostgreSQL Version
- PostgreSQL 14+ recommended
- PostgreSQL 16 for best performance
Logical Replication
For diff capture, you need:Extensions
Required extensions (auto-installed with Docker setup):wal2json- For logical replication to JSON
Pool Configuration
The environment pool pre-creates schemas for fast test startup.Setting Pool Targets
template_name:target_count pairs, comma-separated.
Auto-Detection
If not set, Agent Diff auto-detects templates and sets a default target of 100 per template.Scaling Considerations
Single Instance
Default configuration works for development and small teams:- 10 concurrent builds
- 100 pooled schemas per template
High Load
For production with many concurrent users:Serverless (Neon)
For Neon with scale-to-zero:Logging
Log Levels
Agent Diff uses Python’s logging:Log Output
Logs go to stdout, which Docker captures:API Key Configuration
Development
In development, API key validation is relaxed. A default key is auto-created:Production
In production, configure a control plane for API key validation:Database Migrations
Run Migrations
Migration Files
Located inbackend/src/platform/db/migrations/versions/
