Skip to main content
Open a managed session, send audio in one task, and receive in another. The context manager sends authentication and waits for session.ready automatically.
wav_chunks validates mono, 16 kHz, PCM16 WAV files and emits raw samples without headers. Its default chunk is 100 ms. It neither resamples nor paces audio; the example adds microphone-speed pacing. In chunk mode, session.ready.max_turn_audio_ms is None and no periodic commits are required. If the server returns a numeric limit, divide recordings into turns within it. Sending faster can fill the pending audio buffer and does not guarantee lower latency. The default audio_scope="chunk" evaluates new audio only; its final event covers the last window. Set audio_scope="turn" explicitly to evaluate cumulative audio. evaluation_interval_ms accepts an integer from 250 to 30000; omission uses the 1,000 ms server default. Values such as 510 are valid; 240 is rejected. Each evaluation shares the account’s inference allowance. Only one task may receive. Bounded websocket queues apply backpressure; there is no unbounded SDK audio queue. Normal errors appear as ErrorEvent; fatal errors raise StreamingError. Unknown future events are preserved as UnknownEvent. Unexpected disconnects are never automatically reconnected or replayed. The synchronous client offers the same session methods without await; use a sender thread while the main thread iterates. Propagate producer failures and close the session to unblock its receiver. Close streaming contexts before their parent client. Context exit closes immediately and does not cancel accepted work. See the protocol reference.