The SignalWire Agents SDK reads environment variables for server configuration, authentication, SSL, logging, RELAY/REST client credentials, and serverless platform detection. Environment variables are overridden by constructor parameters but take precedence over config file values.
Use dotenv to load variables from a .env file during development:
Server port. Used when no port argument is passed to the constructor.
Username for HTTP Basic Authentication on all agent webhook endpoints.
When unset, the username falls back to the agent’s name.
Password for HTTP Basic Authentication. If not set, a random password is auto-generated on each startup and printed to the console.
In production, always set SWML_BASIC_AUTH_PASSWORD explicitly. Auto-generated
passwords change on every restart, which will break SignalWire webhook callbacks
until you update the credentials in your SignalWire dashboard.
Enable HTTPS. Only the string "true" is accepted (strict equality check).
Path to the SSL certificate file (.pem or .crt). Required when
SWML_SSL_ENABLED is set.
Path to the SSL private key file (.key). Required when
SWML_SSL_ENABLED is set.
Domain name for HSTS headers and URL generation.
Base URL when running behind a reverse proxy (e.g., https://my-agent.example.com).
The agent uses this URL to generate correct webhook URLs in SWML documents.
Enable proxy request debug logging. Only the string "true" is accepted.
Trust X-Forwarded-For, X-Forwarded-Proto, and X-Forwarded-Host headers
for client IP detection (used by rate limiting) and auto-detection of the
public URL. Only the string "true" is accepted. Enable only when running
behind a reverse proxy you control.
Setting SWML_PROXY_URL_BASE overrides SSL configuration and port settings
for webhook URL generation.
Disable SWML document schema validation. Only the string "true" is accepted (strict equality check).
Useful for performance in production when you trust your SWML output.
Comma-separated list of allowed Host header values. When unset, no host
check is applied. When set, requests with a Host header not in the list
are rejected with HTTP 403. Set to specific domain(s) in production
(e.g., "agent.example.com,api.example.com").
Comma-separated list of allowed CORS origins. Restrict to trusted origins in production.
When set to "true", POST requests whose Origin header is not in
SWML_CORS_ORIGINS are rejected with HTTP 403. Only the string "true" is
accepted.
Maximum request body size in bytes. Default is 1 MB. Requests exceeding this size are rejected with HTTP 413.
Rate limit in requests per minute per client IP. When unset, no rate limit is applied. When set to a positive integer, clients exceeding the limit receive HTTP 429.
Logging mode.
"auto" — automatic detection based on environment"off" — disable all logging"stderr" — log to stderrLog level.
"debug" — verbose output for development and troubleshooting"info" — standard operational messages"warn" — potential issues that do not prevent operation"error" — failures that affect a specific operationLog output format.
"text" — colored human-readable output (default)"json" — structured JSON log lines for log aggregation systemsColon-separated paths to directories containing custom skills. The skill registry scans these paths in addition to the built-in skills directory.
These variables are shared between the RELAY WebSocket client and the REST HTTP client.
SignalWire project ID for authentication.
API token for authentication.
JWT token for RELAY authentication. Alternative to project ID + API token.
Space hostname used for RELAY WebSocket connections and as the REST API base URL.
Maximum concurrent calls per RelayClient instance.
Maximum concurrent RelayClient connections per process.
The SDK auto-detects the execution environment from platform-specific variables. You typically do not set these manually — they are provided by the platform runtime.
Lambda function name. Used for URL construction and logging.
Lambda function URL. If not set, constructed from region and function name.
AWS region for Lambda execution.
Lambda environment detection variable. Set automatically by the Lambda runtime.
Google Cloud project ID.
Google Cloud region.
Cloud Function entry point name.
Knative/Cloud Run service name.
Azure Functions environment detection variable.
Azure Functions environment name.
CGI environment detection variable.