Skip to content

Conversation

@OiPunk
Copy link
Contributor

@OiPunk OiPunk commented Feb 10, 2026

Summary

Fixes #2308 by avoiding format: null in session.update payloads when attaching to an existing SIP call via call_id.

In call-attach mode, input_audio_format / output_audio_format can be intentionally omitted. The SDK was still serializing these as explicit null values, which can cause the Realtime API to reject the update with errors like:

  • Invalid type for 'session.audio.input.format': expected an object, but got null

What changed

  • In OpenAIRealtimeWebSocketModel._get_session_config:
    • only set audio.input.format if a non-null format can be converted.
    • only set audio.output.format if a non-null format can be converted.
  • Added regression tests to verify:
    • with call_id and no explicit formats, update payload omits both format fields.
    • with explicit formats, payload still includes normalized audio/pcmu fields.

Validation

  • uv run --with ruff ruff check src/agents/realtime/openai_realtime.py tests/realtime/test_realtime_model_settings.py
  • uv run --with mypy mypy src/agents/realtime/openai_realtime.py tests/realtime/test_realtime_model_settings.py
  • env -u ALL_PROXY -u all_proxy -u HTTPS_PROXY -u https_proxy -u HTTP_PROXY -u http_proxy -u NO_PROXY -u no_proxy uv run --with pytest pytest -q tests/realtime/test_realtime_model_settings.py
  • env -u ALL_PROXY -u all_proxy -u HTTPS_PROXY -u https_proxy -u HTTP_PROXY -u http_proxy -u NO_PROXY -u no_proxy uv run --with coverage --with pytest coverage run -m pytest -q tests/realtime/test_realtime_model_settings.py

Changed executable lines coverage (local):

  • src/agents/realtime/openai_realtime.py: 100% (6/6)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tool calling is not working with Realtime Agent

1 participant