srtc) targets server-side AI scenarios: your Python service joins a channel like any other user, receives the voice of everyone in the channel, and pushes synthesized audio back.
Use cases
- AI voice assistants / voice bots: connect an ASR → LLM → TTS pipeline to a channel
- Server-side recording, quality inspection, and real-time transcription
- You already have a pipecat voice agent and want to connect it to an SRTC channel (see Integrating pipecat (Chinese))
Difference from the C SDK
Both share the same native core underneath and behave the same. The difference is the data format:
Model inputs and outputs are raw data, so with the Python SDK you rarely need to deal with codecs.
Installation
cffi, av (bundles ffmpeg and libopus, so you don’t need to install ffmpeg on the system separately), and numpy.
Supported platforms
Python 3.10 and above. The package for a given platform works with all Python 3.x minor versions.
Python packages for Alpine (musl) aren’t available yet. Contact us if you need them.
Threading model
The SDK is built onasyncio; call every API from within the event loop:
- Signaling, reconnection, and audio/video send and receive all run in the SDK’s built-in native library and don’t hold Python’s GIL, so they don’t slow down your Python code
- All event callbacks and the data frames you get from
async forare handed to you on the event loop thread, so no locking is needed - APIs that wait for server negotiation—joining, subscribing, publishing—are
asyncand don’t block the event loop while waiting
Deployment notes
Don’t fork in a process that has already used the SDK. The native core doesn’t work in forked child processes:- Fork after only
import srtc, before anyChannelis created: fine (works normally with gunicorn--preloadand similar setups) - Fork after a
Channelhas been created: using the SDK in the child raisesRuntimeErrorright away rather than hanging - When using
multiprocessing, setmultiprocessing.set_start_method("spawn")
Next steps
- Quickstart: get listening and speaking working
- Voice AI agent guide (Chinese): sentence segmentation, barge-in interruption, timeline
- API reference (Chinese)