Skip to content

RealtimeSessionOptions

type RealtimeSessionOptions<TContext> = object;
Type Parameter Default type

TContext

unknown

apiKey: ApiKey;

The API key to use for the connection. Pass a function to lazily load the API key


automaticallyTriggerResponseForMcpToolCalls?

Section titled “automaticallyTriggerResponseForMcpToolCalls?”
automaticallyTriggerResponseForMcpToolCalls?: boolean;

Whether to automatically trigger a response for MCP tool calls.


config?: Partial<RealtimeSessionConfig>;

Additional session config options. Overrides default client options.


context?: TContext;

Additional context to pass to the agent


groupId?: string;

A group identifier to use for tracing, to link multiple traces together. For example, if you want to connect your RealtimeSession traces with those of a backend text-based agent run.


historyStoreAudio?: boolean;

Whether the history copy should include a local copy of the audio data. By default it is not included in the history to save runtime memory on the client. If you wish to keep this data you can enable this option.


model?:
| OpenAIRealtimeModels
| string & object;

The model to use.


outputGuardrails?: RealtimeOutputGuardrail[];

Any output guardrails to apply to agent output in parallel


outputGuardrailSettings?: RealtimeOutputGuardrailSettings;

Configure the behavior of your guardrails


toolErrorFormatter?: ToolErrorFormatter<RealtimeContextData<TContext>>;

Formats tool error messages that are returned to the model. Returning undefined falls back to the SDK default message.


toolExecution?: RealtimeToolExecutionConfig;

SDK-side execution settings for local realtime tool calls.


traceMetadata?: Record<string, any>;

An optional dictionary of additional metadata to include with the trace.


tracingDisabled?: boolean;

Whether tracing is disabled for this session. If disabled, we will not trace the agent run.


transport:
| "webrtc"
| "websocket"
| RealtimeTransportLayer;

The transport layer to use.


workflowName?: string;

The workflow name to use for tracing.