Skip to content

feat: support OpenAI Python 3 and HTTPX2 - #4380

Merged
seratch merged 1 commit into
mainfrom
feat/openai-3-httpx2
Aug 13, 2026
Merged

feat: support OpenAI Python 3 and HTTPX2#4380
seratch merged 1 commit into
mainfrom
feat/openai-3-httpx2

Conversation

@seratch

@seratch seratch commented Aug 13, 2026

Copy link
Copy Markdown
Member

This pull request updates the 0.21.0 development line to require openai>=3.0.0,<4 and completes the migration to the HTTPX2 transport introduced by OpenAI Python 3.

Changes

  • Migrates the default OpenAI provider and voice provider to shared httpx2.AsyncClient instances.
  • Updates Responses WebSocket URL and timeout handling to use HTTPX2-native types.
  • Migrates OpenAI request, response, exception, timeout, URL, mock transport, and custom-client test fixtures to HTTPX2.
  • Moves the tracing exporter to httpx2.Client while preserving connection pooling, retry, deadline, shutdown, and cleanup behavior.
  • Updates retry normalization to recognize HTTPX2 errors and response metadata by default.
  • Continues to recognize legacy HTTPX errors when httpx is installed, without making it a core dependency.
  • Selects the MCP HTTP transport based on the installed MCP major version:
    • MCP v1 uses the legacy httpx dependency supplied by MCP.
    • MCP v2 uses HTTPX2.
  • Aligns the Twilio SIP example's direct OpenAI dependency with the new OpenAI 3 requirement.
  • Removes legacy httpx from the required openai-agents dependency set.

Dependency ownership

A clean core installation now contains OpenAI Python 3 and HTTPX2 without installing legacy httpx.

Legacy HTTPX remains available where another dependency owns it:

  • MCP v1 declares and installs httpx>=0.27.1.
  • The optional Vercel integration continues to receive HTTPX from Vercel. The latest checked Vercel release, 0.8.1, still declares httpx>=0.27.0,<1, so upgrading Vercel would not currently migrate that integration to HTTPX2.
  • Users who intentionally rely on OpenAI Python's temporary legacy-client compatibility path must install httpx explicitly.

User migration

Most users do not need to change application code beyond accepting the OpenAI Python 3 dependency upgrade.

Users who configure the OpenAI HTTP layer directly should migrate custom clients, transports, authentication, event hooks, mock transports, timeout values, URLs, requests, responses, and exception handling from httpx to httpx2. OpenAI's DefaultHttpx2Client and DefaultAsyncHttpx2Client helpers are the preferred client implementations.

The Agents SDK does not attempt to convert arbitrary legacy HTTPX objects to HTTPX2. OpenAI Python's temporary legacy-client compatibility path remains usable when the application explicitly installs httpx, but applications should treat that as a migration bridge rather than a permanent API.

MCP v1 and Vercel users do not need an additional httpx declaration because those integrations provide their own dependency.

Compatibility and validation

Existing Agents SDK public provider, model, voice, tracing, and retry APIs retain their signatures and behavior. Retry and replay authority, streaming and non-streaming behavior, WebSocket timeout handling, tracing shutdown semantics, and MCP v1/v2 compatibility remain unchanged apart from the underlying transport ownership.

The migration was validated with:

  • A clean wheel installation containing OpenAI 3 and HTTPX2 with no importable legacy httpx.
  • MCP v1 installed separately and supplying its own legacy HTTPX client.
  • Focused provider, voice, WebSocket, retry, tracing, and MCP tests.
  • Authenticated default-client and custom-HTTPX2-client Responses requests.
  • The complete formatting, linting, type-checking, and test suite.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b50b32d743

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/agents/models/openai_responses.py Outdated
Comment thread src/agents/models/openai_responses.py Outdated
@seratch
seratch force-pushed the feat/openai-3-httpx2 branch from b50b32d to f8570e3 Compare August 13, 2026 03:00
@seratch
seratch merged commit fc461ee into main Aug 13, 2026
14 checks passed
@seratch
seratch deleted the feat/openai-3-httpx2 branch August 13, 2026 03:09
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.

1 participant