swaig-test
swaig-test
The swaig-test command loads an agent file and allows you to test SWAIG functions,
generate SWML output, and simulate serverless environments — all without deploying
to production. It supports both webhook and DataMap functions.
If no action flag is specified, swaig-test defaults to --list-tools.
Actions
Choose one action per invocation:
--list-tools
List all SWAIG functions registered on the agent.
--list-agents
List all agent classes discovered in the file. Useful for multi-agent files.
--dump-swml
Generate and output the full SWML document. Combine with --raw for machine-readable JSON.
--exec FUNCTION
Execute a SWAIG function by name. Pass function arguments as --key value pairs
after the function name.
Common Options
-v, --verbose
Enable verbose output with debug information, including raw result types and detailed post data.
--raw
Output raw JSON only, suppressing all logs. Designed for piping to jq or
other JSON processors.
--agent-class
Specify which agent class to load when the file contains multiple agents.
Mutually exclusive with --route.
--route
Specify which agent to load by its registered route (e.g., /healthcare).
Mutually exclusive with --agent-class.
Function Execution Options
--minimal
Use minimal post_data containing only the function arguments. This is the default behavior.
--fake-full-data
Use comprehensive fake call data including call_id, from, to, and other
fields that would normally be present in a real SignalWire request.
--custom-data
JSON string with custom post_data overrides merged into the request payload.
SWML Generation Options
--call-type
Simulated call type. Valid values:
"sip"— SIP-originated call"webrtc"— WebRTC-originated call
--call-direction
Simulated call direction. Valid values:
"inbound"— incoming call"outbound"— outgoing call
--call-state
Simulated call state value.
--from-number
Override the caller/from phone number in mock data.
--to-extension
Override the destination/to extension in mock data.
Data Customization
--user-vars
JSON string injected as userVariables in the mock request. Used to test
agents that customize behavior based on user variables.
--query-params
JSON string injected as query parameters in the mock request. Used to test dynamic agents that read query parameters.
--header
Add an HTTP header in KEY=VALUE format. Can be specified multiple times.
--override
Override a specific value using dot-path notation (e.g., --override call.state=answered).
Can be specified multiple times.
Serverless Simulation
--simulate-serverless
Simulate a serverless platform environment. Valid values:
"lambda"— AWS Lambda"cgi"— CGI deployment"cloud_function"— Google Cloud Functions"azure_function"— Azure Functions
The simulator sets platform-specific environment variables so the agent generates correct webhook URLs for the target platform.
--env
Set an environment variable in KEY=VALUE format. Can be specified multiple
times. Applied after --env-file.
--env-file
Load environment variables from a file (one KEY=VALUE per line).
Platform-Specific Options
Run swaig-test agent.py --help-platforms for the full list. Key options per platform:
AWS Lambda: --aws-function-name, --aws-function-url, --aws-region, --aws-api-gateway-id, --aws-stage
CGI: --cgi-host (required), --cgi-script-name, --cgi-https, --cgi-path-info
Google Cloud: --gcp-project, --gcp-function-url, --gcp-region, --gcp-service
Azure: --azure-env, --azure-function-url
Extended Help
--help-platforms
Show detailed documentation for all serverless platform options.
--help-examples
Show comprehensive usage examples covering all features.
Examples
List Tools and Generate SWML
Execute Functions
Arguments are automatically type-converted: numeric values become integers or
floats, true/false become booleans, and everything else stays as a string.