Operations
Lares is the most production-shaped project in the lab: tenant-scoped data, RBAC, OIDC, DSAR, metered billing, and a Postgres path. The reference core stays dependency-free and loopback-first.
Configuration
All settings are environment variables with safe defaults.
| Variable | Default | Meaning |
|---|---|---|
LARES_HOST |
127.0.0.1 |
Bind address. A non-loopback host requires auth or an explicit flag. |
LARES_PORT |
8787 |
Bind port. |
LARES_DATABASE_URL |
sqlite:///lares.db |
memory, a path, sqlite://…, or postgresql://…. |
LARES_LOG_JSON |
true |
Structured JSON logs. |
LARES_ALLOWED_ORIGINS |
empty | CORS origins. |
LARES_RATE_LIMIT_PER_MINUTE |
120 |
Per-key rate. |
LARES_RATE_LIMIT_BURST |
40 |
Token-bucket burst. |
LARES_MAX_BODY_BYTES |
1000000 |
Request body limit. |
LARES_IDEMPOTENCY_TTL |
86400 |
Idempotency-key lifetime. |
LARES_RETENTION_DAYS |
90 |
Event and finished-job retention. |
Auth, tenancy and the edge
Lares supports three modes:
- Static token.
LARES_TOKENis a single admin principal. It is fine for a local console, wrong for multi-user hosting. - Signed sessions.
LARES_AUTH_SECRETenables HMAC-signed sessions. - OIDC.
LARES_OIDC_ISSUERplusLARES_OIDC_AUDIENCEenables JWT auth;LARES_OIDC_JWKS_URLorLARES_OIDC_DISCOVERY_URLsupplies the keys.
Tenancy and roles come from claims:
LARES_OIDC_TENANT_CLAIM=tenant_id
LARES_OIDC_ROLES_CLAIM=roles
Cross-tenant reads return 404, not a filtered list. That is intentional: a tenant should not learn that another tenant's object exists.
The edge pattern: terminate TLS and authenticate at the proxy, then pass a short-lived signed session to Lares. Do not inject a shared static admin token for every visitor; that collapses every user into one principal and defeats the tenant model.
Safety and privacy
- Age gate at onboarding; store the verification result, not a birth date.
- Memory is user-visible and user-editable.
- DSAR is implemented:
GET /v1/dsar/:userId/exportandPOST /v1/dsar/:userId/erase(owner or admin). Erase is a hard delete across every table, including embeddings; thedsar.erasedaudit event survives. - Retention for events and finished jobs is configurable; relics decay but are not auto-deleted.
- No telemetry in the reference core.
- TLS in transit; encryption at rest in production.
Do not claim SOC 2, COPPA, or GDPR compliance until the controls are implemented and audited. The reference core is a baseline, not a certification.
Billing and usage
The usage ledger records model spend per tenant, character and day.
lares usage report --tenant <tenant>
lares usage export --customers <file>
lares audit usage
audit usage reports per-tenant spend, unbilled attempts, and estimate exposure. LARES_STRIPE_WEBHOOK_SECRET verifies Stripe webhook signatures; LARES_WEBHOOK_TOLERANCE sets the timestamp tolerance.
Deployment checklist
- Python 3.11+, a writable database, and a non-root user.
- Keep the bind on loopback unless auth is configured.
- Set
LARES_AUTH_SECRETor OIDC; never expose the static admin token to browsers. - Migrate the schema (
lares db migrate) before serving. - Run
lares maintainon a schedule and keepLARES_RETENTION_DAYShonest. - Back up the database and test a restore.
- Verify cross-tenant 404 and DSAR export/erase before inviting a second tenant.
- Put a model budget and a kill switch in front of any public launch.
Read next
- Memory: what a restore must preserve.
- Persona and proactivity: what the safety gates protect.