Skip to content

relax websockets upper bound from <16 to <17#3013

Merged
seratch merged 1 commit intoopenai:mainfrom
mathisobadia:relax-websockets-v16-upper-bound
Apr 23, 2026
Merged

relax websockets upper bound from <16 to <17#3013
seratch merged 1 commit intoopenai:mainfrom
mathisobadia:relax-websockets-v16-upper-bound

Conversation

@mathisobadia
Copy link
Copy Markdown
Contributor

@mathisobadia mathisobadia commented Apr 23, 2026

Summary

The `websockets<16` upper bound introduced in 0.14.0 is overly conservative. websockets 16.0 has no breaking changes that affect this SDK, and the cap is creating unnecessary dependency conflicts for projects already on `websockets==16.x`.

Analysis

APIs used by this SDK

All websockets usage is in `src/agents/realtime/openai_realtime.py` and `src/agents/voice/`:

API Import path
`connect()` `websockets.connect` and `websockets.asyncio.client`
`ClientConnection` `websockets.ClientConnection` and `websockets.asyncio.client.ClientConnection`
`ConnectionClosed` `websockets.exceptions.ConnectionClosed` and `websockets.ConnectionClosed`
`ConnectionClosedOK` `websockets.exceptions.ConnectionClosedOK`
`ConnectionClosedError` `websockets.exceptions.ConnectionClosedError`

websockets 16.0 breaking changes

From the official changelog, websockets 16.0 has one backwards-incompatible change:

websockets 16.0 requires Python ≥ 3.10. websockets 15.0 is the last version supporting Python 3.9.

`openai-agents` already declares `requires-python = ">=3.10"`, so this does not apply.

Every API listed above is present in websockets 16.0 with identical module paths and method signatures — confirmed against the 16.0 source.

Test compatibility

The existing test suite requires zero changes to run against websockets 16.0:

  • The mock-based tests (`patch("websockets.connect", ...)`) are duck-typed and don't rely on any websockets internals
  • The real integration tests in `TestTransportIntegration` (which spin up a real local WebSocket server via `websockets.serve`) use only APIs that are identical in 16.x
  • The `ClientConnection.close_code` attribute used in integration test assertions is present and unchanged in 16.0

Changes

  • 3 lines in `pyproject.toml` (`dependencies`, `voice` extra, `realtime` extra): `<16` → `<17`
  • Regenerated `uv.lock`
  • New CI job `tests-websockets-v16` that explicitly installs `websockets==16.0` and runs the full `tests/realtime/` and `tests/voice/` suites to prove compatibility

Impact

Projects pinned to `websockets==16.x` currently cannot adopt `openai-agents>=0.14.0` without a global websockets downgrade. This change unblocks them.

websockets 16.0 introduces no breaking changes affecting this SDK.
The only backwards-incompatible change in 16.0 is dropping Python 3.9
support, which this project already doesn't support (requires-python>=3.10).

All APIs used by the SDK — websockets.connect, ClientConnection,
ConnectionClosed/OK/Error, websockets.asyncio.client — are present in
websockets 16.x with identical interfaces and module paths.

The <16 cap currently prevents projects already pinned to websockets==16.x
from adopting openai-agents>=0.14.0 without a global websockets downgrade.
Comment thread .github/workflows/tests.yml Outdated
if: steps.changes.outputs.run != 'true'
run: echo "Skipping tests for non-code changes."

tests-websockets-v16:
Copy link
Copy Markdown
Member

@seratch seratch Apr 23, 2026

Choose a reason for hiding this comment

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

We don't want to add this additional test just for this dependency version range

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes that make total sense, will remove the commit, I wanted to have a way to "prove" it works with version 16

@seratch seratch added this to the 0.14.x milestone Apr 23, 2026
@mathisobadia mathisobadia force-pushed the relax-websockets-v16-upper-bound branch from e72c314 to 3091ba4 Compare April 23, 2026 12:53
@mathisobadia mathisobadia requested a review from seratch April 23, 2026 15:38
@seratch seratch merged commit 5ffc1ec into openai:main Apr 23, 2026
20 checks passed
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.

2 participants