docs/realtime/transport.md
Use this page to decide how realtime agents fit into your Python application.
!!! note "Python SDK boundary"
The Python SDK does **not** include a browser WebRTC transport. This page is only about Python SDK transport choices: server-side WebSockets and SIP attach flows. Browser WebRTC is a separate platform topic, documented in the official [Realtime API with WebRTC](https://developers.openai.com/api/docs/guides/realtime-webrtc/) guide.
| Goal | Start with | Why |
|---|---|---|
| Build a server-managed realtime app | Quickstart | The default Python path is a server-side WebSocket session managed by RealtimeRunner. |
| Understand which transport and deployment shape to choose | This page | Use this before you commit to a transport or deployment shape. |
| Attach agents to phone or SIP calls | Realtime guide and examples/realtime/twilio_sip | The repo ships a SIP attach flow driven by call_id. |
RealtimeRunner uses OpenAIRealtimeWebSocketModel unless you pass a custom RealtimeModel.
That means the standard Python topology looks like this:
RealtimeRunner.await runner.run() returns a RealtimeSession.RealtimeSessionEvent items and forward audio or transcripts to your application.This is the topology used by the core demo app, the CLI example, and the Twilio Media Streams example:
Use this path when your server owns the audio pipeline, tool execution, approval flow, and history handling.
For the telephony flow documented in this repository, the Python SDK attaches to an existing realtime call via call_id.
This topology looks like:
realtime.call.incoming.RealtimeRunner(..., model=OpenAIRealtimeSIPModel()).model_config={"call_id": ...} and then processes events like any other realtime session.This is the topology shown in examples/realtime/twilio_sip.
The broader Realtime API also uses call_id for some server-side control patterns, but this repository's shipped attach example is SIP.
If your app's primary client is a browser using Realtime WebRTC:
RTCPeerConnection abstraction or a ready-made browser WebRTC sample.This repository also does not currently ship a browser WebRTC plus Python sideband example.
The transport configuration surface in [RealtimeModelConfig][agents.realtime.model.RealtimeModelConfig] lets you adapt the default paths:
url: Override the WebSocket endpointheaders: Provide explicit headers such as Azure auth headersapi_key: Pass an API key directly or via callbackcall_id: Attach to an existing realtime call. In this repository, the documented example is SIP.playback_tracker: Report actual playback progress for interruption handlingSee the Realtime agents guide for the detailed lifecycle and capability surface once you've chosen a topology.