fix: migrate http clients to httpx2 - #6826
Conversation
1e5741e to
07f9b59
Compare
|
the plugins still depend on the httpx, should we add httpx to the agent instead? |
07f9b59 to
ab17e67
Compare
good point. Now it's upgrading the whole repo with deprecation warning and backward compatibility until 2.0. |
ab17e67 to
08806a4
Compare
08806a4 to
e6f7134
Compare
| def warn_on_legacy_timeout(timeout: HTTPXTimeout | None) -> None: | ||
| if isinstance(timeout, httpx.Timeout): | ||
| warnings.warn(_DEPRECATION_MESSAGE, DeprecationWarning, stacklevel=3) | ||
|
|
||
|
|
||
| def to_httpx2_timeout(timeout: HTTPXTimeout | None) -> httpx2.Timeout | None: |
There was a problem hiding this comment.
🟡 New public helper functions ship without the documentation the project requires
The newly added HTTP-client compatibility helpers are published without any documentation (livekit-agents/livekit/agents/utils/httpx_compat.py:21-71), so the auto-generated API reference will list them with no explanation of what they do.
Impact: Users and maintainers reading the generated docs get undocumented public API surface.
Repository documentation rule and affected additions
CONTRIBUTING.md states: "If writing new methods/enums/classes, document them. This project uses pdoc3 for automatic API documentation generation, and every new addition has to be properly documented." AGENTS.md additionally requires Google-style docstrings.
The new module livekit-agents/livekit/agents/utils/httpx_compat.py adds four public functions with no docstrings: warn_on_legacy_timeout (line 21), to_httpx2_timeout (line 26), to_legacy_timeout (line 38) and legacy_async_client (line 50). The same applies to the new create_http_client helper exported from livekit-plugins/livekit-plugins-openai/livekit/plugins/openai/utils.py:13-22, which is added to __all__.
Prompt for agents
CONTRIBUTING.md requires every new public method/class to be documented (pdoc3 generates the API reference from docstrings) and AGENTS.md asks for Google-style docstrings. The new module livekit-agents/livekit/agents/utils/httpx_compat.py adds four public functions (warn_on_legacy_timeout, to_httpx2_timeout, to_legacy_timeout, legacy_async_client) with no docstrings, and livekit-plugins/livekit-plugins-openai/livekit/plugins/openai/utils.py adds create_http_client (exported in __all__) also without a docstring. Add Google-style docstrings explaining the httpx -> httpx2 migration semantics, when each helper should be used, the deprecation policy (legacy httpx.Timeout support removed in 2.0) and the return values.
Was this helpful? React with 👍 or 👎 to provide feedback.
Behavior: Upgrade OpenAI to 3, MCP to 2, and repository-owned HTTP transports to HTTPX2. Use one OpenAI client policy and test real MCP SSE and streamable HTTP requests.
Compatibility: Keep legacy
httpx.Timeoutinputs working through 1.x. Warnings point to application call sites. Remove support in 2.0. Keep HTTPX 1 adapters only for upstream SDKs that still require them.Addresses AGT-3286
Initial prompt and agent context
Model: GPT-5.6