VoiceAgentRealtimeClientConnectOptions interface

Options for connecting the realtime client to a voice agent.

Extends

Properties

abortSignal

Cancels the connection attempt.

agentSessionId

Identifier used to correlate the voice session.

agentVersionOverride

Selects a specific immutable agent version.

connectionTimeoutInMs

Overrides the client connection timeout in milliseconds.

onConnectionStateChange

Receives connection-state transitions.

query

Additional query parameters for this connection's WebSocket upgrade URL. Provide a plain object, including a null-prototype object. Values override matching endpoint query parameters; undefined removes a parameter. Values are URL-encoded automatically. Numbers must be finite. SDK-managed parameters, authentication parameters, and names starting with h- are reserved (case-insensitively) and cause a TypeError. Use the corresponding typed options for session, version, storage, transport, and structured prompt inputs instead. Both structured_input and structured_inputs are reserved. Do not include secrets: query parameters can appear in server or proxy logs.

store

Overrides whether the conversation created by this session is persisted.

structuredInputs

Values used to render the agent's structured prompt inputs. Serialized when connect() is called, before authentication.

transport

Selects the transport used for the realtime connection. Defaults to "websocket". Set to "webrtc" to negotiate a WebRTC peer connection instead; the caller is responsible for completing the SDP offer/answer exchange using the rtc.call.sdp.create and rtc.call.sdp.created events (see VoiceAgentRealtimeEvent).

Inherited Properties

onResponse

A function to be called each time a response is received from the server while performing the requested operation. May be called multiple times.

requestOptions

Options used when creating and sending HTTP requests for this operation.

tracingOptions

Options used when tracing is enabled.

Property Details

abortSignal

Cancels the connection attempt.

abortSignal?: AbortSignalLike

Property Value

agentSessionId

Identifier used to correlate the voice session.

agentSessionId?: string

Property Value

string

agentVersionOverride

Selects a specific immutable agent version.

agentVersionOverride?: string

Property Value

string

connectionTimeoutInMs

Overrides the client connection timeout in milliseconds.

connectionTimeoutInMs?: number

Property Value

number

onConnectionStateChange

Receives connection-state transitions.

onConnectionStateChange?: VoiceAgentConnectionStateChangedHandler

Property Value

query

Additional query parameters for this connection's WebSocket upgrade URL. Provide a plain object, including a null-prototype object. Values override matching endpoint query parameters; undefined removes a parameter. Values are URL-encoded automatically. Numbers must be finite. SDK-managed parameters, authentication parameters, and names starting with h- are reserved (case-insensitively) and cause a TypeError. Use the corresponding typed options for session, version, storage, transport, and structured prompt inputs instead. Both structured_input and structured_inputs are reserved. Do not include secrets: query parameters can appear in server or proxy logs.

query?: Readonly<Record<string, string | number | boolean | undefined>>

Property Value

Readonly<Record<string, string | number | boolean | undefined>>

store

Overrides whether the conversation created by this session is persisted.

store?: boolean

Property Value

boolean

structuredInputs

Values used to render the agent's structured prompt inputs. Serialized when connect() is called, before authentication.

structuredInputs?: Record<string, unknown>

Property Value

Record<string, unknown>

transport

Selects the transport used for the realtime connection. Defaults to "websocket". Set to "webrtc" to negotiate a WebRTC peer connection instead; the caller is responsible for completing the SDP offer/answer exchange using the rtc.call.sdp.create and rtc.call.sdp.created events (see VoiceAgentRealtimeEvent).

transport?: VoiceAgentTransport

Property Value

Inherited Property Details

onResponse

A function to be called each time a response is received from the server while performing the requested operation. May be called multiple times.

onResponse?: RawResponseCallback

Property Value

Inherited From OperationOptions.onResponse

requestOptions

Options used when creating and sending HTTP requests for this operation.

requestOptions?: OperationRequestOptions

Property Value

Inherited From OperationOptions.requestOptions

tracingOptions

Options used when tracing is enabled.

tracingOptions?: OperationTracingOptions

Property Value

Inherited From OperationOptions.tracingOptions