Local Development
Server configuration
Custom host and port
Using serve() directly (Python)
For more control, use serve() instead of run():
Development endpoints
Testing your agent
View SWML output
Using swaig-test CLI
Exposing local server
SignalWire needs to reach your agent via a public URL. Use ngrok or similar:
Connection Flow: SignalWire Cloud —> ngrok tunnel —> localhost:3000
Steps:
- Start your agent (see run command table above)
- Start ngrok:
ngrok http 3000 - Use ngrok URL in SignalWire:
https://abc123.ngrok.io
Using ngrok
ngrok provides a public URL like https://abc123.ngrok.io that forwards to your local server.
Using localtunnel
Environment variables for development
These environment variables work across all SDK languages:
Proxy URL configuration
When behind ngrok or another proxy, the SDK needs to know the public URL:
Development workflow
1. Code
Write/modify your agent code.
2. Test Locally
swaig-test my_agent.py --dump-swmlswaig-test my_agent.py --exec function_name --param value
3. Run Server
python my_agent.py (or your language’s equivalent run command)
4. Expose Publicly
ngrok http 3000
5. Test with SignalWire
Point phone number to ngrok URL and make test call.
Debug mode
Enable debug logging:
Or via environment variable:
Hot reloading
For automatic reloading during development, use uvicorn directly:
Or create a development script:
Then run:
Serving static files
Use AgentServer.serve_static_files() to serve static files alongside your agents. This is useful for web dashboards, documentation, or any static content:
Directory Structure:
Key Points:
- Use
server.serve_static_files(directory)to serve static files - Agent routes always take priority over static files
- Requests to
/serveindex.htmlfrom the static directory - Both
/supportand/support/work correctly with agents
Route Priority: