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 python-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.
If not set, get_basic_auth() defaults the username to "signalwire".
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. Accepts "true", "1", or "yes".
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 SSL certificates and URL generation.
SSL certificate verification mode.
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.
Fallback for SWML_PROXY_URL_BASE when that variable is not set.
Enable proxy request debug logging.
Setting SWML_PROXY_URL_BASE (or APP_URL) overrides SSL configuration and port
settings for webhook URL generation.
Disable SWML document schema validation. Accepts "1", "true", or "yes".
Useful for performance in production when you trust your SWML output.
Comma-separated list of allowed hosts. 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.
Maximum request body size in bytes. Default is 10 MB.
Rate limit in requests per minute.
Request timeout in seconds.
Enable HTTP Strict Transport Security headers when serving over HTTPS.
HSTS max-age directive in seconds. Default is 1 year.
Logging mode.
"auto" — automatic detection based on environment"off" — disable all logging"stderr" — log to stderr"default" — standard logging outputLog level.
"debug" — verbose output for development and troubleshooting"info" — standard operational messages"warning" — potential issues that do not prevent operation"error" — failures that affect a specific operation"critical" — severe failures that may prevent the service from runningLog output format.
"console" — 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.
Alternative to GOOGLE_CLOUD_PROJECT.
Google Cloud region.
Cloud Function entry point name.
Knative/Cloud Run service name.
Azure Functions environment detection variable.
Azure App Service site name. Used to construct function URLs.
Azure Function name.
CGI environment detection variable.
HTTP Host header value. Falls back to SERVER_NAME.
Server hostname.
CGI script path.