SWMLService
SWMLService is a lightweight HTTP service for serving non-AI SWML documents.
Unlike AgentBase (which always produces an AI block), SWMLService
generates pure SWML call-flow documents: IVR menus, voicemail, call recording, etc.
It uses a SwmlBuilder internally for verb construction and
Hono for HTTP serving.
AgentBase extends SWMLService. The SWAIG tool registry and
SWAIG hosting (the /swaig endpoint) live on SWMLService, so any service —
including standalone SWAIG hosts and sidecars that do not emit an AI block — can
register and dispatch tools. The SWAIG methods below are inherited by
AgentBase.
SWMLService generates and serves SWML documents over HTTP. See the SWML reference for the full document specification.
Constructor
opts
Configuration object.
opts.name
Service display name used in logging and startup messages. Required to
match the Python SDK, where name is a positional required parameter.
opts.route
HTTP route path where the service is accessible.
opts.host
Host the HTTP server binds to.
opts.port
Port the HTTP server binds to. Defaults to the PORT environment variable,
falling back to 3000.
opts.basicAuth
Basic auth credentials as [username, password]. Unlike AgentBase,
SWMLService does not fall back to environment variables — credentials
must be provided explicitly.
opts.schemaPath
Path to a JSON Schema file for verb validation.
opts.configFile
Path to a security configuration file for SSL, CORS, and host allowlist settings.
opts.schemaValidation
Enable schema validation. Can also be disabled via the
SWML_SKIP_SCHEMA_VALIDATION=true environment variable.
Properties
name
Service display name.
route
HTTP route path where this service is accessible.
host
Host address the HTTP server binds to.
port
Port the HTTP server binds to.
log
Structured logger bound to this service name. Exposed for subclass access.
security
Unified security configuration loaded from environment variables and optional config file. Controls SSL, CORS, and host allowlist settings.
sslEnabled
Whether SSL/HTTPS is enabled. Mirrors security.sslEnabled.
sslCertPath
Path to the SSL certificate file.
sslKeyPath
Path to the SSL private key file.
domain
Domain name for SSL certificates.
schemaUtils
Schema validation utilities for SWML documents.
verbRegistry
Registry of custom verb handlers for specialized SWML verb processing.