Contact Sales

All fields are required

Build a Voice AI Agent in 50 Lines of Python | SignalWire
Python Agents SDK

Voice AI in 50 Lines of Python

Your code handles the conversation. The platform handles state management, transfers, and the phone network. Ship in an afternoon.

50
lines of Python to production
< 1.2s
typical AI response latency
1
pip package, zero glue code
$0.16
per minute, AI processing
The Problem

Voice AI Should Not Require Five Vendors

No Separate STT, TTS, or Telephony SDKs

One pip install replaces the STT provider SDK, TTS provider SDK, telephony SDK, and WebSocket library you would need to wire together yourself.

No Webhook State Reconstruction

Call state lives on the platform, not in your webhook handlers. Query it by UUID. Transfer calls with full context preserved.

No Glue Code Between Vendors

The AI kernel runs inside the media stack. It orchestrates speech recognition, language model inference, and speech synthesis with direct access to the audio stream, eliminating the overhead of bolt-on pipelines.

No 18-Month Build Timeline

Define your agent in Python, add tools that call your backend, and deploy as a standard HTTP microservice. Days, not months.

Build a Voice AI Agent

from signalwire_agents import AgentBase
from signalwire_agents.core.function_result import SwaigFunctionResult

class SupportAgent(AgentBase):
    def __init__(self):
        super().__init__(name="Support Agent", route="/support")
        self.prompt_add_section("Instructions",
            body="You are a customer support agent. "
                 "Greet the caller and resolve their issue.")
        self.add_language("English", "en-US", "rime.spore:mistv2")

    @AgentBase.tool(name="check_order")
    def check_order(self, order_id: str):
        """Check the status of a customer order.

        Args:
            order_id: The order ID to look up
        """
        return SwaigFunctionResult(f"Order {order_id}: shipped, ETA April 2nd")

agent = SupportAgent()
agent.run()

Multi-Vendor Pipeline vs. Single Platform

Bolt-On Stack

  • Separate STT, LLM, TTS, and telephony vendors
  • Glue code to route audio between services
  • Each hop adds latency and a failure mode
  • Five invoices, five escalation paths for one voice call
  • State lives in your webhooks; race conditions at scale

SignalWire

  • STT, LLM, TTS, and telephony in one platform
  • AI kernel runs inside the media stack
  • 800-1200ms typical latency, orchestration overhead eliminated
  • One invoice, one platform, $0.16/min AI processing
  • Platform owns call state; query by UUID

What You Build vs. What the Platform Handles

ConcernYour CodeSignalWire
Conversation logicDefine prompts and toolsOrchestrates STT, LLM, TTS pipeline
State managementTool handlers update business stateTracks call state, step state, context
TelephonyProvision numbers via APISIP, PSTN, routing, media
TransfersDefine transfer targetsExecutes with full context preservation
Barge-in handlingNothingDetects and handles caller interruptions
Error recoveryDefine fallback behaviorsRetries, logs, recovers automatically
ScalingScale your microserviceScales telephony and AI independently

From Zero to Production

1

Install the SDK

pip install signalwire-agents. One package, no additional dependencies for STT, TTS, or telephony.

2

Define your agent

Write a Python class with prompts and tool handlers. Your agent runs as a standard HTTP microservice.

3

Connect your backend

Wire up tool functions to your database, CRM, or scheduling system. The AI handles the conversation; your code handles the truth.

4

Deploy anywhere

Container, VM, or serverless. Point a phone number at your agent. Inbound calls route to your AI with sub-second latency.

💡
The team that created FreeSWITCH, the open-source telephony engine powering major carriers and contact centers worldwide, built this platform. Two decades of voice infrastructure engineering. 2.7 billion minutes processed.

FAQ

What does the SDK actually do?

You define agents in Python. The SDK generates declarative markup and serves it to the platform as a standard HTTP microservice. The platform handles STT, LLM orchestration, TTS, and telephony.

Can I use my own LLM provider?

Yes. The platform integrates with multiple LLM providers. Choose the model that fits your use case and budget.

How do tool calls work?

When the AI decides to call a tool, your Python function executes. Your code accesses your database, enforces your business rules, and returns the result. The AI communicates the result to the caller.

What about declarative YAML?

YAML configuration works for standard agents and rapid prototyping. The Python SDK adds full IDE support, testing, and programmatic tool definitions. Both target the same platform.

How do I handle real-time events during a call?

WebSocket control enables live call manipulation: inject prompts mid-call, transfer on external events, build supervisor dashboards. All three interfaces (YAML, SDK, WebSocket) compose together.

Trusted by 2,000+ companies

Build Your First Voice AI Agent Today

One pip install. One phone number. Production in an afternoon.