Skip to content

ResponseFunctionWebSearch doesn't match returned payload #3179

@davidgilbertson

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions