Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/basic/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def get_weather(city: Annotated[str, "The city to get the weather for"]) -> Weat
print("[debug] get_weather called")
return Weather(city=city, temperature_range="14-20C", conditions="Sunny with wind.")


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

agent = Agent(
name="Hello world",
instructions="You are a helpful agent.",
Expand Down
26 changes: 25 additions & 1 deletion src/agents/realtime/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,29 @@ class RealtimeModelTracingConfig(TypedDict):
"""Additional metadata to include with the trace."""


class RealtimeAudioStorageConfig(TypedDict):
"""Configuration for audio storage in realtime sessions."""

enabled: NotRequired[bool]
"""Whether audio storage is enabled. Defaults to False."""

storage_path: NotRequired[str]
"""The path where audio files should be stored. If not provided, uses a
default temp directory."""

max_duration_seconds: NotRequired[int]
"""Maximum duration in seconds for stored audio clips. Defaults to 300 (5 minutes)."""

audio_format: NotRequired[RealtimeAudioFormat]
"""The format to store audio in. Defaults to 'pcm16'."""

compression_enabled: NotRequired[bool]
"""Whether to compress stored audio files. Defaults to True."""

retention_days: NotRequired[int]
"""Number of days to retain stored audio files. Defaults to 7."""


class RealtimeRunConfig(TypedDict):
"""Configuration for running a realtime agent session."""

Expand All @@ -184,7 +207,8 @@ class RealtimeRunConfig(TypedDict):
tracing_disabled: NotRequired[bool]
"""Whether tracing is disabled for this run."""

# TODO (rm) Add history audio storage config
audio_storage_config: NotRequired[RealtimeAudioStorageConfig]
"""Configuration for audio storage in realtime sessions."""


class RealtimeUserInputText(TypedDict):
Expand Down
2 changes: 1 addition & 1 deletion src/agents/realtime/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ def _get_new_history(
)
return new_history

# TODO (rm) Add support for audio storage config
# Audio storage config is now available in RealtimeRunConfig.audio_storage_config

Comment on lines +515 to 516
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Audio storage config is now available in RealtimeRunConfig.audio_storage_config

# If the item already exists, update it
existing_index = next(
Expand Down