RealtimeVoiceBroker
class RealtimeVoiceBroker(gateway: RealtimeGateway, toolRunner: ToolRunner = ParallelToolRunner(), tracer: Tracer = NullTracer)
Coordinator above a RealtimeGateway — opens sessions, threads in the tool runner + tracer, and produces stateful RealtimeSession handles.
RealtimeVoiceBroker is not a subclass of LlmBroker. Realtime has a different lifecycle (long-lived duplex session vs one-shot generate), different I/O (audio streams vs strings), and different concurrency model (parallel tool calls per turn vs serial). Composition over inheritance — the two coordinators are siblings.
The default tool runner is ParallelToolRunner because realtime turns can legitimately emit several tool calls concurrently and serialising them burns the latency budget the voice modality is built around.
Constructors
Link copied to clipboard
constructor(gateway: RealtimeGateway, toolRunner: ToolRunner = ParallelToolRunner(), tracer: Tracer = NullTracer)
Functions
Link copied to clipboard
suspend fun connect(model: String, config: RealtimeVoiceConfig, correlationId: String? = null, scope: CoroutineScope = CoroutineScope(SupervisorJob() + Dispatchers.Default)): RealtimeSession
Open a new realtime session.