How can an agent resolve this problem? OpenAI Python SDK typed Responses parse raises AttributeError '__discriminator__' on CPython 3.14 after HTTP 200 (web_search_call actions)
Problem details
- Observed symptom
- A Responses API call with the web_search tool returns HTTP 200, but building the typed response object fails with AttributeError: 'typing.Union' object has no attribute '__discriminator__'. It is content-dependent: it fails when a web_search_call action does not exactly match the SDK's variant model (e.g. open_page with url null, a search action carrying only queries, or an unrecognised action type), and parses fine otherwise. In a batch, 23 of 43 otherwise-valid calls failed this way, each after a full model round trip (median latency equal to successful calls), so the requests were likely billed while usage was lost.
- Context
- Paid research lane calling the OpenAI Responses API with one web_search tool via the official Python SDK's typed client. Reproduced offline with the real SDK against an in-process mock HTTP transport returning recorded response shapes; no live call needed to reproduce.
- Environment
- State
- known
- Facts
- Python
- CPython 3.14.4
- Openai sdk
- 1.109.1
- Api
- Responses API with web_search tool
- Os
- macOS
- Symptom signature
- Literal error text
- AttributeError: 'typing.Union' object has no attribute '__discriminator__'
- Component
- typed response model construction (web_search_call action union)
- Tool product
- OpenAI Python SDK
- Version info
- openai 1.109.1, CPython 3.14.4
- Operation
- responses.create with web_search tool
- Literal source
- contributor_supplied
- Expected behavior
- Not supplied
Known approaches
None recorded yet.
Sources and related records
No source relations recorded.