SignalWire AI

Programmable, integrated, realtime voice AI
View as Markdown

SignalWire AI is built for unlimited programmability and scale. Integrate AI and deploy a MVP with low-code/no-code drag-and-drop tools, then scale your application on SignalWire’s cloud platform.

Quickstart

Deploy a serverless AI Agent and call it over the PSTN in under 5 minutes.

1

Create a free account

Register your SignalWire account.

2

Import SWML script

Open the RELAY / SWML tab in your SignalWire Dashboard, paste the following script, and hit Save.

Fun fact
This simple YAML/JSON document is a complete calling application!
swml.yaml
1version: 1.0.0
2sections:
3 main:
4 - ai:
5 prompt:
6 text: You are a knowledgeable developer. Have an open-ended discussion with the caller about SignalWire and programmable communications.
3

Assign a phone number

Buy a phone number using your $5 promotional credit.

4

Give it a call

Dial your newly configured AI Agent over the PSTN from your cell phone or a VoIP dialer.

SWML

SWML (SignalWire Markup Language) is the most powerful and flexible way to use AI on the SignalWire platform.

SWML is a structured language for configuring and orchestrating real-time communication applications using lightweight and readable JSON or YAML files. These SWML Scripts can be deployed serverlessly in SignalWire’s cloud, or from your server.

SWML’s ai method integrates advanced AI Agents, which can interact with external APIs.

AI Agents

Configure AI Agents right in your SignalWire Space with a streamlined, no-code user interface.

Call Flow Builder

Add AI Agents built in your SignalWire Space directly to drag-and-drop call flows.

Agents SDK

Build powerful custom voice AI agents with Python. The SignalWire Agents SDK provides complete programmatic control for sophisticated voice applications.

Use cases

Simple AI Phone Call

A basic AI-powered phone agent that can hold an open-ended conversation.

1from signalwire_agents import AgentBase
2
3# Create an agent and assign a route
4agent = AgentBase("My Assistant", route="/assistant")
5
6# Add some basic capabilities
7agent.add_skill("datetime") # Current date/time info
8agent.add_skill("math") # Mathematical calculations
9
10# Start the agent
11agent.serve()

Agents SDK docs | Quickstart guide

An AI agent that answers frequently asked questions about your business.

1from signalwire_agents.prefabs import FAQBotAgent
2
3agent = FAQBotAgent(
4 faqs=[
5 {
6 "question": "What are your hours?",
7 "answer": "We're open 9 AM to 5 PM, Monday to Friday."
8 },
9 {
10 "question": "Where are you located?",
11 "answer": "123 Main Street, Downtown."
12 }
13 ]
14)
15
16agent.run()

Agents SDK docs | FAQ Bot prefab

An agent that looks up customer accounts and transfers calls to human support when needed.

1from signalwire_agents import AgentBase, SwaigFunctionResult
2
3agent = AgentBase(name="support")
4agent.prompt_add_section("Role", "You are a helpful customer service agent.")
5
6@agent.tool(description="Look up customer account")
7def lookup_account(account_id: str) -> SwaigFunctionResult:
8 # Simulate database lookup
9 customer = {"name": "John Doe", "status": "active"}
10 return SwaigFunctionResult(f"Account: {customer['name']}, Status: {customer['status']}")
11
12@agent.tool(description="Transfer to support")
13def transfer_support() -> SwaigFunctionResult:
14 return SwaigFunctionResult("Connecting you to support.").connect("+15551234567")
15
16agent.run()

Agents SDK docs | Custom functions guide

A virtual concierge that helps guests with amenity information and service bookings.

1from signalwire_agents.prefabs import ConciergeAgent
2
3agent = ConciergeAgent(
4 venue_name="Grand Hotel",
5 services=["room service", "spa bookings", "restaurant reservations"],
6 amenities={
7 "pool": {"hours": "7 AM - 10 PM", "location": "2nd Floor"},
8 "gym": {"hours": "24 hours", "location": "3rd Floor"}
9 }
10)
11
12agent.run()

Agents SDK docs | Concierge prefab

An agent that checks availability, books appointments, and sends SMS confirmations.

1from signalwire_agents import AgentBase
2from signalwire_agents.core.function_result import SwaigFunctionResult
3from datetime import datetime
4
5appointments = []
6
7agent = AgentBase(name="scheduler", route="/scheduler")
8agent.prompt_add_section("Role", "You help customers schedule appointments.")
9agent.prompt_add_section("Guidelines", """
10- Collect customer name, date, and preferred time
11- Confirm all details before booking
12- Send SMS confirmation when booking is complete
13""")
14agent.add_language("English", "en-US", "rime.spore")
15
16@agent.tool(description="Check if a time slot is available")
17def check_availability(date: str, time: str) -> SwaigFunctionResult:
18 for apt in appointments:
19 if apt["date"] == date and apt["time"] == time:
20 return SwaigFunctionResult(f"Sorry, {date} at {time} is not available.")
21 return SwaigFunctionResult(f"{date} at {time} is available.")
22
23@agent.tool(description="Book an appointment")
24def book_appointment(
25 name: str,
26 phone: str,
27 date: str,
28 time: str
29) -> SwaigFunctionResult:
30 appointments.append({
31 "name": name,
32 "phone": phone,
33 "date": date,
34 "time": time,
35 "booked_at": datetime.now().isoformat()
36 })
37 return (
38 SwaigFunctionResult(f"Appointment booked for {name} on {date} at {time}.")
39 .send_sms(
40 to_number=phone,
41 from_number="+15559876543",
42 body=f"Your appointment is confirmed for {date} at {time}."
43 )
44 )
45
46if __name__ == "__main__":
47 agent.run()

Agents SDK docs | InfoGatherer prefab

An agent that conducts customer satisfaction surveys with different question types.

1from signalwire_agents.prefabs import SurveyAgent
2
3agent = SurveyAgent(
4 survey_name="Customer Satisfaction Survey",
5 questions=[
6 {
7 "id": "satisfaction",
8 "text": "How satisfied were you with our service?",
9 "type": "rating",
10 "scale": 5
11 },
12 {
13 "id": "recommend",
14 "text": "Would you recommend us to others?",
15 "type": "yes_no"
16 },
17 {
18 "id": "comments",
19 "text": "Any additional comments?",
20 "type": "open_ended",
21 "required": False
22 }
23 ]
24)
25
26if __name__ == "__main__":
27 agent.run()

Agents SDK docs | Survey prefab

A virtual receptionist that greets callers and routes them to the right department.

1from signalwire_agents.prefabs import ReceptionistAgent
2
3agent = ReceptionistAgent(
4 departments=[
5 {
6 "name": "sales",
7 "description": "Product inquiries, pricing, and purchasing",
8 "number": "+15551234567"
9 },
10 {
11 "name": "support",
12 "description": "Technical help and troubleshooting",
13 "number": "+15551234568"
14 },
15 {
16 "name": "billing",
17 "description": "Payment questions and account issues",
18 "number": "+15551234569"
19 }
20 ]
21)
22
23if __name__ == "__main__":
24 agent.run()

Agents SDK docs | Receptionist prefab

An agent that collects information from potential customers and qualifies them for the sales team.

1from signalwire_agents.prefabs import InfoGathererAgent
2
3agent = InfoGathererAgent(
4 questions=[
5 {"key_name": "name", "question_text": "What is your name?"},
6 {"key_name": "company", "question_text": "What company are you with?"},
7 {"key_name": "phone", "question_text": "What is your phone number?", "confirm": True},
8 {"key_name": "budget", "question_text": "What is your budget range for this project?"},
9 {"key_name": "timeline", "question_text": "What is your timeline for making a decision?"}
10 ],
11 name="lead-qualifier"
12)
13
14agent.prompt_add_section(
15 "Role",
16 "You are qualifying leads for the sales team. Be friendly and professional."
17)
18
19if __name__ == "__main__":
20 agent.run()

Agents SDK docs | InfoGatherer prefab

An agent that records calls and provides real-time transcription.

1from signalwire_agents import AgentBase
2from signalwire_agents.core.function_result import SwaigFunctionResult
3
4agent = AgentBase(name="transcription-agent")
5agent.add_language("English", "en-US", "rime.spore")
6agent.prompt_add_section("Role", "You are a helpful assistant. The call is being recorded for transcription.")
7agent.set_params({"save_conversation": True})
8
9@agent.tool(description="Start recording the call for transcription")
10def start_recording() -> SwaigFunctionResult:
11 return (
12 SwaigFunctionResult("Recording has started.")
13 .record_call(
14 control_id="transcription",
15 stereo=True,
16 format="wav"
17 )
18 )
19
20if __name__ == "__main__":
21 agent.run()

Agents SDK docs | Call recording guide


How does it work?

Under the hood, the SignalWire AI Gateway (SWAIG) orchestrates the many supporting services that make integrated realtime voice AI possible.

  • AI Agent
  • Prompt
  • LLM
  • SWAIG Functions
  • TTS (Text-To-Speech) Providers

AI Agent diagram.