Configuration

Table of contents

  1. Configuration
    1. Environment files
    2. Quick reference — all variables
      1. LLM
      2. Observability (LangSmith)
      3. Database
      4. Redis / Celery
      5. Object storage (S3 / MinIO)
      6. FX providers
      7. Reconciliation tuning
      8. Auth & multi-tenancy
      9. Ingestion pipeline (Celery Beat)
      10. Webhooks
      11. Application
      12. Frontend (Vite)
    3. Obtaining API keys
      1. Anthropic (required for live LLM)
      2. ExchangeRate-API (recommended for live FX)
      3. Open Exchange Rates (optional FX fallback)
      4. LangSmith (optional observability)
    4. Configuration by run mode
      1. Mock mode (no keys)
      2. Live LLM only
      3. Full production-like
    5. Docker Compose passthrough
    6. Confidence thresholds (hard requirements)

Default

Mock mode

No API keys. Deterministic pipeline for dev and CI.

LLM_MODE=mock

Live AI

Claude extraction

Real multimodal extraction and matching reasoning.

LLM_MODE=live + ANTHROPIC_API_KEY

Observability

LangSmith traces

Agent pipeline visibility for demo and debugging.

LANGSMITH_API_KEY + LANGSMITH_TRACING=true

Environment files

File Used by Purpose
backend/.env Local Python, hybrid dev Full backend configuration (overrides repo root)
backend/.env.example Template Copy to .env — safe to commit
frontend-novapay/.env NovaPay Vite dev Port 5173
frontend-admin/.env Admin app Vite dev Port 5174
frontend-tenant-mgmt/.env Mgmt app Vite dev Port 5175
.env (repo root) Docker Compose; hybrid backend Compose substitution for all backend services + VITE_API_KEY NovaPay build arg

Never commit .env files containing secrets. They are listed in .gitignore.


Quick reference — all variables

Copy backend/.env.example to backend/.env and fill in values as needed.

LLM

Variable Default Description
ANTHROPIC_API_KEY (empty) Anthropic API key — required when LLM_MODE=live
LLM_MODE mock mock = deterministic in-process responses; live = real Claude calls
SONNET_MODEL claude-sonnet-4-6 Model for ingestion (PDF), matching, report, bank statement (PDF)
HAIKU_MODEL claude-haiku-4-5-20251001 Model for ingestion (Excel/CSV), bank statement (text/CSV)
OPUS_MODEL claude-opus-4-7 Model for ingestion (images/scans — vision)
INGESTION_CONCURRENCY 3 Max parallel proof-extraction LLM calls (ThreadPoolExecutor)
INGESTION_MAX_RETRIES 3 Legacy per-document retry count; live mode uses LLM_MAX_RETRIES in LLMService
MATCHING_CONCURRENCY 3 Max parallel match-reasoning LLM calls (same executor pattern as ingestion)
LLM_MAX_RETRIES 5 Retries on Anthropic HTTP 429 across all pipeline LLM calls
LLM_RETRY_BASE_SECONDS 2.0 Initial backoff base for rate-limit retries
LLM_RETRY_TPM_BASE_SECONDS 30.0 Longer backoff from the third retry onward (output TPM windows)

Rate limits: Anthropic enforces per-model output TPM (e.g. 8,000 output tokens/minute on Sonnet for lower tiers). If jobs fail at the report stage after a large matching burst, lower INGESTION_CONCURRENCY and MATCHING_CONCURRENCY (try 2), or raise your org tier. After retries are exhausted on the report call only, ARIA falls back to a deterministic summary narrative so the job can still complete.

Observability (LangSmith)

Variable Default Description
LANGSMITH_API_KEY (empty) LangSmith API key for agent tracing
LANGSMITH_PROJECT aria Project name in LangSmith UI
LANGSMITH_TRACING false Set true to enable trace export (backend/.env.example recommends true for demos)
LANGSMITH_ENDPOINT https://api.smith.langchain.com LangSmith API base URL (EU/self-hosted overrides)

Database

Variable Default Description
DATABASE_URL sqlite+aiosqlite:///./aria.db Async SQLAlchemy URL

Examples:

# Docker / local Postgres
DATABASE_URL=postgresql+asyncpg://aria:aria@localhost:5432/aria

# Zero-infra SQLite
DATABASE_URL=sqlite+aiosqlite:///./aria.db

Redis / Celery

Variable Default Description
REDIS_URL redis://localhost:6379/0 General Redis connection
CELERY_BROKER_URL redis://localhost:6379/1 Celery message broker
CELERY_RESULT_BACKEND redis://localhost:6379/2 Celery result store
CELERY_TASK_ALWAYS_EAGER (unset) Set 1 to run tasks inline (tests)

Object storage (S3 / MinIO)

Variable Default Description
S3_ENDPOINT http://localhost:9000 S3-compatible endpoint
S3_ACCESS_KEY ariaadmin Access key (matches Docker MinIO)
S3_SECRET_KEY ariaadmin Secret key
S3_BUCKET aria-documents Bucket name (auto-created on first upload)
S3_REGION us-east-1 AWS region (required by boto3)
S3_PRESIGN_TTL_SECONDS 900 Presigned URL expiry (15 min)
S3_SERVER_SIDE_ENCRYPTION (unset) Set AES256 on AWS S3; leave unset for Docker MinIO

Local filesystem fallback (no MinIO):

S3_ENDPOINT=local://_uploads

FX providers

Variable Default Description
EXCHANGERATE_API_KEY (empty) Primary FX provider (ExchangeRate-API)
OPENEXCHANGERATES_APP_ID (empty) Fallback provider (Open Exchange Rates)
FX_CACHE_TTL_SECONDS 3600 In-memory FX cache TTL

If both keys are empty, ARIA falls back to static mid-market rates for USD/EUR/GBP/SGD → MYR (sufficient for demo, not production).

Reconciliation tuning

Variable Default Description
BASE_CURRENCY MYR Normalisation target currency
FX_VARIANCE_BUFFER_PCT 0.015 1.5% FX spread buffer in tolerance window
MATCH_CONFIDENCE_THRESHOLD 0.75 Auto-match floor
MATCH_REVIEW_FLOOR 0.5 Lower bound for the UNCERTAIN review band; below this scores route to UNMATCHED
EXTRACTION_ESCALATION_THRESHOLD 0.5 Skip normalisation/matching when avg extraction confidence is below this
DATE_WINDOW_DAYS 5 ± days for date filter in matching

Auth & multi-tenancy

Variable Default Description
ADMIN_API_KEY (empty) Legacy bootstrap key for programmatic admin endpoints; Docker Compose defaults to aria-dev-admin
JWT_SECRET_KEY (dev default in code) HS256 signing secret — change in production
JWT_ALGORITHM HS256 JWT algorithm
JWT_ACCESS_TOKEN_EXPIRE_MINUTES 1440 Token lifetime (24h)
DEFAULT_ADMIN_EMAIL admin@aria.local Platform admin email for auto-seed
DEFAULT_ADMIN_PASSWORD (empty) If set, seeds admin user when users table is empty

Ingestion pipeline (Celery Beat)

Variable Default Description
BATCH_SIZE_THRESHOLD 50 Auto-create a job when buffer hits this many transactions
BATCH_TIME_WINDOW_MINUTES 15 Auto-create a job when oldest buffered transaction is ≥ N minutes old
CELERY_BEAT_INTERVAL_MINUTES 2 How often the Beat scheduler checks the buffer

Webhooks

Variable Default Description
WEBHOOK_MAX_RETRIES 5 Max Celery retries for aria.deliver_webhook on HTTP/network failures
WEBHOOK_RETRY_BACKOFF_BASE_SECONDS 5 Base delay for non-429 failures; attempt N waits base × 2^(N-1) seconds
WEBHOOK_MIN_INTERVAL_SECONDS 1.5 Minimum spacing between POSTs to the same URL (per Celery worker) — reduces receiver 429s after job completion bursts
WEBHOOK_RATE_LIMIT_BACKOFF_SECONDS 60 Initial Celery retry countdown when the receiver returns HTTP 429 (doubles per retry; honors Retry-After when present)
WEBHOOK_SECRET_ENCRYPTION_KEY (falls back to JWT_SECRET_KEY) Fernet key material for encrypting webhook signing secrets at rest

Application

Variable Default Description
APP_ENV development development | test | staging | production
LOG_LEVEL INFO structlog level
CORS_ORIGINS http://localhost:5173,... Comma-separated allowed origins

Frontend (Vite)

Variable Default Description
VITE_API_BASE_URL http://localhost:8000 Direct API URL (production builds)
VITE_API_PROXY_TARGET http://localhost:8000 Vite dev proxy target for /api

In Docker production, nginx proxies /api/ to the backend — the frontend bundle uses relative /api paths.


Obtaining API keys

Anthropic (required for live LLM)

  1. Create an account at console.anthropic.com
  2. Add a payment method under Billing
  3. Go to Settings → API Keys → Create Key
  4. Copy the key (starts with sk-ant-api03-...) — shown once only
  5. Set ANTHROPIC_API_KEY and LLM_MODE=live
  1. Sign up at app.exchangerate-api.com/sign-up (free tier, no credit card)
  2. Verify your email
  3. Copy the API key from the dashboard
  4. Set EXCHANGERATE_API_KEY

Free tier: ~1,500 requests/month, daily rate updates, historical data included.

Open Exchange Rates (optional FX fallback)

  1. Sign up at openexchangerates.org/signup
  2. Copy your App ID from the account dashboard
  3. Set OPENEXCHANGERATES_APP_ID

LangSmith (optional observability)

  1. Sign up at smith.langchain.com
  2. Go to Settings → API Keys → Create API Key
  3. Set LANGSMITH_API_KEY, LANGSMITH_PROJECT=aria, LANGSMITH_TRACING=true
  4. View traces at smith.langchain.com after running jobs

Configuration by run mode

Mock mode (no keys)

LLM_MODE=mock
# Leave ANTHROPIC_API_KEY, FX keys, and LANGSMITH_API_KEY empty

Live LLM only

LLM_MODE=live
ANTHROPIC_API_KEY=sk-ant-api03-...

Full production-like

LLM_MODE=live
ANTHROPIC_API_KEY=sk-ant-api03-...
EXCHANGERATE_API_KEY=...
OPENEXCHANGERATES_APP_ID=...
LANGSMITH_API_KEY=lsv2_pt_...
LANGSMITH_PROJECT=aria
LANGSMITH_TRACING=true
DATABASE_URL=postgresql+asyncpg://aria:aria@localhost:5432/aria
S3_ENDPOINT=http://localhost:9000
APP_ENV=production

Docker Compose passthrough

The root .env file is read by Docker Compose for ${VAR} substitution. All backend services (api, worker, beat) share a common environment block defined in docker-compose.yml (x-backend-environment), including:

Category Variables
LLM ANTHROPIC_API_KEY, LLM_MODE, SONNET_MODEL, HAIKU_MODEL, OPUS_MODEL, INGESTION_CONCURRENCY, INGESTION_MAX_RETRIES, MATCHING_CONCURRENCY, LLM_MAX_RETRIES, LLM_RETRY_BASE_SECONDS, LLM_RETRY_TPM_BASE_SECONDS
Observability LANGSMITH_API_KEY, LANGSMITH_PROJECT, LANGSMITH_TRACING, LANGSMITH_ENDPOINT
Auth ADMIN_API_KEY, JWT_SECRET_KEY, JWT_ALGORITHM, JWT_ACCESS_TOKEN_EXPIRE_MINUTES
Webhooks WEBHOOK_MAX_RETRIES, WEBHOOK_RETRY_BACKOFF_BASE_SECONDS, WEBHOOK_MIN_INTERVAL_SECONDS, WEBHOOK_RATE_LIMIT_BACKOFF_SECONDS, WEBHOOK_SECRET_ENCRYPTION_KEY
FX EXCHANGERATE_API_KEY, OPENEXCHANGERATES_APP_ID, FX_CACHE_TTL_SECONDS
Reconciliation BASE_CURRENCY, FX_VARIANCE_BUFFER_PCT, MATCH_CONFIDENCE_THRESHOLD, MATCH_REVIEW_FLOOR, EXTRACTION_ESCALATION_THRESHOLD, DATE_WINDOW_DAYS
Ingestion BATCH_SIZE_THRESHOLD, BATCH_TIME_WINDOW_MINUTES, CELERY_BEAT_INTERVAL_MINUTES

The api service additionally receives DEFAULT_ADMIN_EMAIL, DEFAULT_ADMIN_PASSWORD, and CORS_ORIGINS. Docker-internal URLs (DATABASE_URL, REDIS_URL, S3_ENDPOINT, etc.) are fixed in compose for container networking.

NovaPay: VITE_API_KEY from root .env is passed as a Docker build arg to frontend-novapay. Rebuild that service after creating a tenant API key:

docker compose up --build frontend-novapay

Copy .env.example → .env at the repo root to get started. For hybrid development, put the full configuration in backend/.env and run the API/worker locally.


Confidence thresholds (hard requirements)

These values drive routing logic and should not be lowered in production without review:

Level Threshold Action
Field flag < 0.70 Flagged in ingestion prompts when field confidence is low
Extraction escalation < 0.50 (record avg) Skip normalisation and matching; report still generated
Match uncertain 0.50 – 0.74 Review queue; never auto-confirm
Match confident ≥ 0.75 Auto-match allowed
Match failed < 0.50 (all candidates) Exception report

See Architecture for how these map to agent routing.


Back to top

ARIA · AI Marathon 2026 · Challenge Track 3 — Global Treasury Agent. Documentation reflects production behaviour; amounts use tabular figures.