Agents

Configuration

View as MarkdownOpen in Claude

The SignalWire Server SDK uses a layered configuration system. Settings can come from constructor parameters, environment variables, JSON config files, or sensible defaults. The layers are resolved in priority order:

  1. Constructor parameters — highest priority
  2. Config file values — loaded from JSON, override environment variables
  3. Environment variables — override defaults
  4. Defaults — built-in fallback values
from signalwire import AgentBase
# Constructor parameters take precedence over everything else
agent = AgentBase(
name="my-agent",
port=9000, # Overrides PORT env var and config file
config_file="my_config.json", # Explicit config file path
)

Config File Discovery

When no explicit config_file is provided, the SDK searches for JSON config files in this order:

  1. config.json
  2. agent_config.json
  3. swml_config.json
  4. .swml/config.json
  5. ~/.swml/config.json
  6. /etc/swml/config.json

See ConfigLoader for the full file discovery logic and environment variable substitution syntax.

Key Configuration Areas

AreaConfigured ViaReference
Server port, host, routeConstructor, PORT env var, config fileEnvironment Variables
AuthenticationSWML_BASIC_AUTH_* env vars, config fileAuthHandler
SSL/HTTPSSWML_SSL_* env vars, config fileSecurityConfig
CORS and host allowlistsSWML_CORS_ORIGINS, SWML_ALLOWED_HOSTS env varsSecurityConfig
LoggingSIGNALWIRE_LOG_MODE, SIGNALWIRE_LOG_LEVEL env varsEnvironment Variables
Relay / REST authSIGNALWIRE_PROJECT_ID, SIGNALWIRE_API_TOKEN, SIGNALWIRE_SPACEEnvironment Variables

Quick Example

{
"service": {
"name": "support-agent",
"host": "0.0.0.0",
"port": 8080,
"route": "/support"
},
"security": {
"auth": {
"basic": {
"user": "${AUTH_USER|support_agent}",
"password": "${AUTH_PASSWORD}"
}
},
"ssl_enabled": true,
"domain": "support.example.com",
"ssl_cert_path": "/etc/ssl/certs/support.crt",
"ssl_key_path": "/etc/ssl/private/support.key"
},
"agent": {
"auto_answer": true,
"record_call": false
},
"skills": [
{ "name": "datetime" },
{
"name": "native_vector_search",
"params": {
"index_file": "./support_docs.swsearch",
"tool_name": "search_support"
}
}
]
}