Skip to content

ResponseFunctionWebSearch doesn't match returned payload #3179

Closed as duplicate

Description

@davidgilbertson

Confirm this is an issue with the Python library and not an underlying OpenAI API

  • This is an issue with the Python library

Describe the bug

The ResponseFunctionWebSearch suggests that action can't be None but I get a response where it is (via the agents SDK, but the type is defined in this package)

Image

In text form, the payload of interest I get looks like this:

ResponseFunctionWebSearch(
    id='ws_...264', 
    action=None, 
    status='completed', 
    type='web_search_call'
)

There were four web searches, the first two had an action, the second two didn't.

To Reproduce

I have code like this parsing a response that did a web search:

search_count = sum(
    1
    for raw_response in response.raw_responses
    for item in raw_response.output
    if item.type == "web_search_call" and item.action.type == "search"
)

Which should have been a safe assumption based on the types, but raises an error.

Code snippets

OS

Windows 11

Python version

3.14

Library version

2.32

Activity

  1. anishesg commented on Apr 30, 2026

    @anishesg

    PR up at #3181.

  2. Xsidz commented on Aug 16, 2026

    @Xsidz

    Working on this in PR #3626.

  3. marcuswood-oai commented on Sep 15, 2026

    @marcuswood-oai
    Contributor

    Thanks for sharing the example—it makes the mismatch clear. The generated type promises an action, but the None value you observed makes accessing .type fail. As a workaround, check item.action is not None before accessing it; that avoids this attribute error while the contract is corrected.

    We’re closing this report to keep the work together in openai/openai-openapi#572; please follow that issue for progress. It preserves your example and tracks the distinction between an omitted action and explicit JSON null, which the Python representation alone cannot establish.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingupstream

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions