Skip to main content

Environment variables

The API server reads configuration from environment variables. Set them in a .env file referenced by agentflow.json or as process environment variables.

Setting variables

Via .env file

In agentflow.json:

{
"agent": "graph.react:app",
"env": ".env"
}

In .env:

GOOGLE_API_KEY=your-key
JWT_SECRET_KEY=your-secret
MODE=production

At the process level

MODE=production agentflow api --no-reload

Application variables

VariableDefaultDescription
APP_NAMEMyAppApplication name shown in logs
APP_VERSION0.1.0Application version
MODEdevelopmentdevelopment or production
LOG_LEVELINFOLogging level: DEBUG, INFO, WARNING, ERROR
IS_DEBUGtrueEnable debug mode (disable in production)

Security variables

VariableDefaultDescription
SECURITY_HEADERS_ENABLEDtrueAdd security headers to all responses
HSTS_ENABLEDtrueAdd Strict-Transport-Security header
HSTS_MAX_AGE31536000HSTS max age in seconds
FRAME_OPTIONSDENYX-Frame-Options value
REFERRER_POLICYstrict-origin-when-cross-originReferrer-Policy value

CORS variables

VariableDefaultDescription
ORIGINS*Comma-separated allowed origins. Set to specific domains in production
ALLOWED_HOST*Allowed Host header values
Production CORS

Setting ORIGINS=* in production allows any website to make requests to your API. Always restrict to specific domains in production:

ORIGINS=https://yourapp.com,https://api.yourapp.com

Authentication variables

VariableDescriptionRequired for
JWT_SECRET_KEYSecret key for JWT signing and verificationauth: "jwt"
JWT_ALGORITHMJWT algorithm (default: HS256)auth: "jwt"

Redis variables

VariableDescriptionRequired for
REDIS_URLRedis connection URLPgCheckpointer

Example: redis://localhost:6379/0


Request limits

VariableDefaultDescription
MAX_REQUEST_SIZE10485760 (10MB)Maximum request body size in bytes

API path variables

VariableDefaultDescription
ROOT_PATH/Root path prefix (useful for reverse proxy sub-paths)
DOCS_PATH/docsSwagger UI path (set to empty to disable)
REDOCS_PATH/redocsReDoc path (set to empty to disable)
Disable docs in production

Consider disabling API docs in production by clearing DOCS_PATH and REDOCS_PATH:

DOCS_PATH=
REDOCS_PATH=

Error tracking

VariableDescription
SENTRY_DSNSentry DSN for error tracking (optional)