WEBSOCKET STREAMING AUDIO PROTOCOL & SDKS

Build Autonomous Voice Agents with Code

Build Autonomous Voice Agents with Code

Build Autonomous Voice Agents with Code

Integrate low-latency bi-directional voice streams into iOS, Android, Web, or SIP backends with Python, TypeScript, and Go SDKs.

Read the API Reference

agent_server.py (Sonara Python SDK v3.8)

pip install sonara-voice

import os
from sonara import VoiceAgent, TelephonyGateway, Tool

# Initialize agent with sub-180ms neural speech model
agent = VoiceAgent(
name=’ClinicIntakeAgent’,
voice_id=’neural-elena-v3’,
interruption_threshold_ms=12,
api_key=os.environ[‘SONARA_API_KEY’]
)

@agent.tool
async def book_appointment(caller_id: str, slot_iso: str) -> dict:
‘’’Synchronous function call dispatched during live phone conversation’’’
confirmation = await calendar_db.reserve_slot(caller_id, slot_iso)
return {‘status’: ‘confirmed’, ‘confirmation_code’: confirmation.id}

gateway = TelephonyGateway(agent=agent, port=5060)
gateway.listen()

from sonara import VoiceAgent, TelephonyGateway, Tool

# Initialize agent with sub-180ms neural speech model

agent = VoiceAgent(

name=’ClinicIntakeAgent’,

voice_id=’neural-elena-v3’,

interruption_threshold_ms=12,

api_key=os.environ[‘SONARA_API_KEY’]

)

@agent.tool

async def book_appointment(caller_id: str, slot_iso: str) -> dict:

‘’’Synchronous function call dispatched during live phone conversation’’’

confirmation = await calendar_db.reserve_slot(caller_id, slot_iso)

return {‘status’: ‘confirmed’, ‘confirmation_code’: confirmation.id}

# Bind to inbound Twilio or Genesys SIP trunk

gateway = TelephonyGateway(agent=agent, port=5060)

gateway.listen()

Create a free website with Framer, the website builder loved by startups, designers and agencies.