Skip to content
AGNT

Start here

Environment variables.

Every variable the AGNT backend reads from .env, grouped by purpose. The canonical file is agnt-backend/.env.example— it ships with sensible local dev values and is the authoritative list when this page drifts.

The config layer is app/config.py — a pydantic-settings object that loads the env once at startup, validates the fields, and exposes them as settings.XYZ. The FastAPI lifespan hook in app/main.py performs additional hard-fail checks on production-critical keys before the server accepts any traffic.

Generating secrets

Two cryptographic generators cover every key you need:

bashgenerate secrets
# 32-byte hex (JWT_SECRET, HMAC_PHONE_KEY, A2A_SIGNING_KEY, INTERNAL_API_TOKEN)
python -c "import secrets; print(secrets.token_hex(32))"

# Fernet key (ENCRYPTION_KEY)
python -c "from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())"

# VAPID keypair (VAPID_PRIVATE_KEY + VAPID_CONTACT_EMAIL)
python scripts/generate_vapid_keys.py

Core infrastructure

VariableDefaultPurpose
DATABASE_URLreqpostgresql+asyncpg://agnt:agntlocal@localhost:5433/agntAsyncPG connection string. Must use the asyncpg driver.
REDIS_URLreqredis://localhost:6380/0Redis connection for sessions, rate limits, distributed locks, send queue.
ENVIRONMENTreqdevelopmentOne of development, staging, production. Triggers hard-fail validation in non-dev.
APP_URLprodhttp://localhost:3000Frontend URL for CORS, redirect URIs, email links.
CORS_ORIGINSprodhttp://localhost:3000Comma-separated CORS allowlist.

Security (hard-fail in production)

VariableDefaultPurpose
JWT_SECRETprodHS256 signing key for JWTs. Hard-fails on startup if left at the dev default.
ENCRYPTION_KEYprodFernet encryption key for PII at rest. Generate with the Fernet generator below.
INTERNAL_API_TOKENprodBearer token for plugin_bridge and /internal endpoints. Missing → 503 in those routes.
META_APP_SECRETprodFacebook / Instagram webhook signature verification.
TELEGRAM_WEBHOOK_SECRETprodTelegram webhook signature verification.
STRIPE_WEBHOOK_SECRETprodwhsec_...Stripe webhook signing secret (format: whsec_...).
HMAC_PHONE_KEYprodIndependent HMAC key for phone number hashing. MUST differ from JWT_SECRET in prod.
A2A_SIGNING_KEYprodIndependent HMAC key for A2A envelope signing. MUST differ from JWT_SECRET in prod.

LLM & AI

VariableDefaultPurpose
ANTHROPIC_API_KEYprodsk-ant-...Claude API key. Required in production for all LLM-driven message processing.
OPENAI_API_KEYOpenAI API key. Optional fallback.
OLLAMA_HOSThttp://localhost:11434Ollama local LLM endpoint for offline dev.
OLLAMA_MODELllama3:70b-q4_K_MOllama model name.
RUNPOD_API_KEYRunPod serverless GPU API key (alternative backend).
RUNPOD_ENDPOINT_IDRunPod endpoint ID.
ENABLE_SEMANTIC_SEARCHfalseEnable pgvector semantic search in venue retrieval. Requires pgvector extension.

Messaging channels

VariableDefaultPurpose
TELEGRAM_BOT_TOKENTelegram Bot API token from @BotFather.
WA_360DIALOG_API_KEYWhatsApp Cloud API key via 360Dialog.
WA_PHONE_NUMBER_IDWhatsApp Business Account phone number ID.
WA_VERIFY_TOKENprodWhatsApp webhook verify token. Must change from the default 'agnt_wa_verify' in prod.
IG_PAGE_IDInstagram Page ID for Messaging API.
IG_PAGE_TOKENInstagram Page access token.

Stripe payments

VariableDefaultPurpose
STRIPE_SECRET_KEYprodsk_test_...Stripe API secret key. Must be sk_live_* in production.
STRIPE_PRICE_STARTERStripe price ID for the consumer Starter tier.
STRIPE_PRICE_PROStripe price ID for the consumer Pro tier.
STRIPE_VENUE_PRICE_STARTERStripe price ID for the venue Starter tier.
STRIPE_VENUE_PRICE_GROWTHStripe price ID for the venue Growth tier.
STRIPE_VENUE_PRICE_PROStripe price ID for the venue Pro tier.

A2A · ClawPulse gateway

VariableDefaultPurpose
CLAWPULSE_API_KEYAuth token for the ClawPulse gateway. Without it, A2A sends fail closed.
CLAWPULSE_GATEWAYhttps://cp.gicm.appClawPulse gateway base URL.
CLAWPULSE_PLATFORM_AGENT_IDagnt-platformThis agent's identifier on the A2A network.
A2A_INBOX_POLL_INTERVAL_MS5000Response listener polling cadence in milliseconds.

Push notifications

VariableDefaultPurpose
VAPID_PRIVATE_KEYprodWeb Push VAPID private key. Generate via scripts/generate_vapid_keys.py.
VAPID_CONTACT_EMAILmailto:hello@agnt.aiVAPID contact email.

Observability

VariableDefaultPurpose
SENTRY_DSNSentry DSN for error reporting. Warn-only if missing.
ALERT_WEBHOOK_URLSlack or Discord webhook. Fires on DLQ > 0, circuit breaker open, error spikes, scheduler failures.

Feature APIs (dupe search, nutrition, transport)

VariableDefaultPurpose
SHOPEE_AFFILIATE_IDShopee marketplace affiliate ID.
TOKOPEDIA_AFFILIATE_IDTokopedia affiliate ID.
LAZADA_AFFILIATE_IDLazada affiliate ID.
SERPAPI_KEYSerpAPI key for product search fallback.
NUTRITIONIX_APP_IDNutritionix food database app ID.
NUTRITIONIX_APP_KEYNutritionix app key.
EDAMAM_APP_IDEdamam nutrition API app ID.
EDAMAM_APP_KEYEdamam nutrition API key.
USDA_API_KEYUSDA FoodData Central API key.
LALAMOVE_API_KEYLalamove courier API key.
LALAMOVE_SECRETLalamove API secret.
LALAMOVE_BASE_URLhttps://rest.sandbox-lalamove.comLalamove base URL. Flip to production to enable live delivery booking.
LALAMOVE_MARKETIDLalamove market code (ID for Indonesia).

Email & B2B scan

VariableDefaultPurpose
RESEND_API_KEYre_...Resend transactional email API key.
RESEND_FROM_EMAILAGNT <noreply@agnt.ai>Sender address for outbound email.
TRAINING_BOOKING_URLOptional Calendly / Cal.com link appended to venue welcome email.
FIRECRAWL_API_KEYfc-...Firecrawl for website scraping. Fallback: httpx + BeautifulSoup.
TAVILY_API_KEYtvly-...Tavily search API for Google and TripAdvisor lookup.
GOOGLE_PLACES_KEYAIza...Google Places API key.

Storage & plugins

VariableDefaultPurpose
KNOWLEDGE_UPLOAD_DIRdata/knowledge_uploadsLocal directory for venue knowledge base uploads.
PAPERCLIP_WEBHOOK_URLPaperclip control plane webhook for real-time events.
PAPERCLIP_WEBHOOK_SECRETPaperclip webhook signing secret.

How the backend loads env

app/config.py uses pydantic-settings to load values in this precedence order (highest first):

  1. Actual environment variables set in the shell
  2. .env file at the repo root (only when ENVIRONMENT=development)
  3. Defaults declared on the Settings class

Production deployments never rely on a .envfile — the orchestrator (Railway, Docker Compose, Kubernetes) injects the variables directly.

Related