Quickstart
Build one AI agent and reach it through two channels: a phone call and a text conversation. Choose the Server SDK or write SignalWire Markup Language (SWML) directly. Both paths produce one public agent configuration that you can connect to either channel.
Before you start, you need:
- A SignalWire account
- Python 3 and ngrok installed locally
- A SignalWire phone number for the Voice app
- Your Space name, project ID, and an API token with the
chatscope for the Chat app; manage tokens in the SignalWire Dashboard
Build and publish the agent
Choose one authoring path. Both paths create the same agent definition and give it a public configuration URL. You will connect that URL to a channel in the next step.
Server SDK
SWML
This quickstart uses Python throughout. The voice path is also available for TypeScript, but the AI Chat client used in the next step is currently available only for Python. See the Server SDK documentation for both SDKs.
Install the Server SDK
Write the agent
Create agent.py:
This is the complete agent application. agent.run() starts an HTTP server on port 3000 and
serves the SWML document that defines the agent.
Give the agent a public URL
In a second terminal, start ngrok:
Copy the HTTPS forwarding URL, such as https://abc123.ngrok-free.app. Keep ngrok running.
Start the agent with stable credentials
In the first terminal, set a URL-safe development password and the ngrok URL before starting the agent. Reuse these values for the rest of the quickstart.
The fixed credentials keep the agent URL valid if you restart the process. SWML_PROXY_URL_BASE
lets the SDK generate public callback URLs when you add tools later.
Verify the generated SWML
From another terminal, request the agent configuration through the tunnel:
A working agent returns a JSON document with "version": "1.0.0" and a sections.main array that
contains answer and ai methods. If the request returns 401, use the same credentials that you
exported before starting agent.py. If it cannot connect, confirm that both the agent and ngrok are
still running.
Connect a channel
Voice and Chat use the same agent definition. Choose how you want to interact with the agent; you can return later and connect the other channel to the same configuration URL.
Voice app
Chat app
Route a phone number to the public configuration URL, then place a call.
Create an External URL resource
Open the SignalWire Dashboard, select Script, and then select External URL. Use the matching Primary Script URL:
Select Create.
Assign a phone number
Open Phone Numbers, select a number, and then select Edit Settings. Under Inbound Call Settings, choose Assign Resource, select the External URL resource, and save the change.
Place a call
Call the SignalWire number. The agent greets you and asks how it can help. If the call does not reach
the agent, request the configuration URL with curl again, then confirm that the phone number is
assigned to the same External URL resource.