.env file. Copy .env.example as a starting point:
Application
Database
Two ways to configure the database connection:Option 1: Connection string
TLS / SSL
For managed Postgres (RDS, Azure, GCP CloudSQL, etc.) that requires TLS, setPGSSLMODE as an environment variable rather than embedding ?sslmode= in the URL:
PGSSLMODE from the environment.
If you keep ?sslmode=... in the URL (e.g. when pasting a connection string from a cloud console), Aegra translates it for the async driver automatically:
Other libpq-only parameters (
sslcert, sslkey, sslrootcert, channel_binding, gssencmode, target_session_attrs) are stripped from the async URL with a warning. Use the matching PG* env vars instead — those are honored by both drivers.
Option 2: Individual fields
Used whenDATABASE_URL is not set:
DATABASE_URL takes precedence. When set, individual POSTGRES_* variables are ignored.Connection pools
Aegra uses two connection pools: one for SQLAlchemy (metadata) and one for LangGraph (agent runtime).Server
Authentication
Logging
LLM providers
Redis
Workers
WhenREDIS_BROKER_ENABLED=true, runs are dispatched via a Redis job queue (BLPOP) and executed by concurrent asyncio worker tasks. Each instance runs multiple worker loops, each with a semaphore limiting concurrent jobs. Workers use lease-based crash recovery with heartbeats and a reaper process. See the worker architecture guide for the full design.
In dev mode (REDIS_BROKER_ENABLED=false), runs execute as in-process asyncio tasks with no Redis required.
Total capacity per instance =
WORKER_COUNT x N_JOBS_PER_WORKER (default: 30 concurrent runs).
Cron scheduler
The background scheduler polls the database for due cron jobs and fires them as runs.
Set
CRON_ENABLED=false to disable scheduling without removing cron records. Jobs will not fire but can still be created, updated, and queried.
Cron firing is at-least-once: if a worker crashes after claiming a cron but before the run setup commits, the claim eventually expires (after
CRON_CLAIM_DURATION_SECONDS) and another tick re-fires the cron. Make agent runs idempotent if duplicate firings are unacceptable.Thread TTL
AEGRA_THREAD_TTL takes precedence. When set, the checkpointer.ttl block in aegra.json is ignored entirely and unset fields fall back to their defaults. See the configuration reference for field semantics.Checkpoint durability
Prometheus metrics
When enabled, a
/metrics endpoint serves standard HTTP request metrics (request count, latency histograms, in-progress requests) using prometheus-fastapi-instrumentator. Compatible with any Prometheus/Grafana stack.
Observability (OpenTelemetry)
Langfuse
Arize Phoenix
Generic OTLP
See observability guide for configuration examples.