Realtime Configuration
Run Configuration
Bases: TypedDict
Configuration for running a realtime agent session.
Source code in src/agents/realtime/config.py
model_settings
instance-attribute
model_settings: NotRequired[RealtimeSessionModelSettings]
Settings for the realtime model session.
output_guardrails
instance-attribute
output_guardrails: NotRequired[list[OutputGuardrail[Any]]]
List of output guardrails to run on the agent's responses.
guardrails_settings
instance-attribute
guardrails_settings: NotRequired[RealtimeGuardrailsSettings]
Settings for guardrail execution.
Model Settings
Bases: TypedDict
Model settings for a realtime model session.
Source code in src/agents/realtime/config.py
model_name
instance-attribute
model_name: NotRequired[RealtimeModelName]
The name of the realtime model to use.
modalities
instance-attribute
The modalities the model should support.
input_audio_format
instance-attribute
input_audio_format: NotRequired[RealtimeAudioFormat]
The format for input audio streams.
output_audio_format
instance-attribute
output_audio_format: NotRequired[RealtimeAudioFormat]
The format for output audio streams.
input_audio_transcription
instance-attribute
input_audio_transcription: NotRequired[
RealtimeInputAudioTranscriptionConfig
]
Configuration for transcribing input audio.
turn_detection
instance-attribute
turn_detection: NotRequired[RealtimeTurnDetectionConfig]
Configuration for detecting conversation turns.
tool_choice
instance-attribute
How the model should choose which tools to call.
tracing
instance-attribute
tracing: NotRequired[RealtimeModelTracingConfig | None]
Configuration for request tracing.
Audio Configuration
Bases: TypedDict
Configuration for audio transcription in realtime sessions.
Source code in src/agents/realtime/config.py
model
instance-attribute
The transcription model to use.
Bases: TypedDict
Turn detection config. Allows extra vendor keys if needed.
Source code in src/agents/realtime/config.py
type
instance-attribute
The type of voice activity detection to use.
create_response
instance-attribute
Whether to create a response when a turn is detected.
eagerness
instance-attribute
How eagerly to detect turn boundaries.
interrupt_response
instance-attribute
Whether to allow interrupting the assistant's response.
prefix_padding_ms
instance-attribute
Padding time in milliseconds before turn detection.
silence_duration_ms
instance-attribute
Duration of silence in milliseconds to trigger turn detection.
Guardrails Settings
Bases: TypedDict
Settings for output guardrails in realtime sessions.
Source code in src/agents/realtime/config.py
Model Configuration
Bases: TypedDict
Options for connecting to a realtime model.
Source code in src/agents/realtime/model.py
api_key
instance-attribute
The API key (or function that returns a key) to use when connecting. If unset, the model will
try to use a sane default. For example, the OpenAI Realtime model will try to use the
OPENAI_API_KEY
environment variable.
url
instance-attribute
The URL to use when connecting. If unset, the model will use a sane default. For example, the OpenAI Realtime model will use the default OpenAI WebSocket URL.
initial_model_settings
instance-attribute
initial_model_settings: NotRequired[
RealtimeSessionModelSettings
]
The initial model settings to use when connecting.
playback_tracker
instance-attribute
playback_tracker: NotRequired[RealtimePlaybackTracker]
The playback tracker to use when tracking audio playback progress. If not set, the model will use a default implementation that assumes audio is played immediately, at realtime speed.
A playback tracker is useful for interruptions. The model generates audio much faster than realtime playback speed. So if there's an interruption, its useful for the model to know how much of the audio has been played by the user. In low-latency scenarios, it's fine to assume that audio is played back immediately at realtime speed. But in scenarios like phone calls or other remote interactions, you can set a playback tracker that lets the model know when audio is played to the user.
Tracing Configuration
Bases: TypedDict
Configuration for tracing in realtime model sessions.
Source code in src/agents/realtime/config.py
workflow_name
instance-attribute
The workflow name to use for tracing.
group_id
instance-attribute
A group identifier to use for tracing, to link multiple traces together.
User Input Types
Bases: TypedDict
A message input from the user.
Source code in src/agents/realtime/config.py
content
instance-attribute
content: list[RealtimeUserInputText]
List of text content items in the message.
Client Messages
Bases: TypedDict
A raw message to be sent to the model.