Skip to content

ActionFind.url is required but live find_in_page web_search_call items omit url #3788

Description

@SvenDH

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

  • This is an issue with the Python library

The live Responses API can omit url on web_search_call actions of type find_in_page. The generated SDK type still requires it, so strict validation fails even though the API accepted/produced the item.

This is the same class of API/SDK drift as #2620 (open_page.url was required, API returned null) and the leftover gap after #2621 (find_in_page type was added, but url stayed required). Those were closed as fixed in v2.17.0. ActionFind.url is still str (required) on current main / v3.7.0.

Describe the bug

A completed hosted web search item can look like:

{
  "id": "ws_0c54d33c372e53...",
  "type": "web_search_call",
  "status": "completed",
  "action": {
    "type": "find_in_page",
    "pattern": "og:image"
  }
}

ResponseFunctionWebSearch / ActionFind rejects this because url is missing.

This is easy to miss on the live streaming path (items can be constructed more loosely, then dumped with exclude_unset=True). It then blows up when the payload is re-validated, in particular openai-agents RunState.from_json()ModelResponse(...) on resume after a pause.

ActionOpenPage.url was correctly made optional. ActionFind.url was not.

To Reproduce

  1. Run a Responses API / Agents SDK turn that uses hosted web_search and performs a find_in_page action. The API may omit action.url.
  2. Serialize the run (RunState.to_json() / model_dump(exclude_unset=True)).
  3. Restore with RunState.from_json() or ResponseFunctionWebSearch.model_validate(...).
  4. Validation fails on action.ActionFind.url with Field required.

Minimal local reproduction below does not need a live API call.

Code snippets

from openai.types.responses.response_function_web_search import ResponseFunctionWebSearch

ResponseFunctionWebSearch.model_validate(
    {
        "id": "ws_redacted",
        "type": "web_search_call",
        "status": "completed",
        "action": {"type": "find_in_page", "pattern": "og:image"},
    }
)

Observed (openai 2.45.0; same required field on current main):

pydantic_core.ValidationError: ... validation errors for ResponseFunctionWebSearch
action.ActionFind.url
  Field required [type=missing, input_value={'type': 'find_in_page', 'pattern': 'og:image'}, input_type=dict]

Expected: either the API always includes url, or ActionFind.url is Optional[str] like ActionOpenPage.url.

OS

Linux

Python version

Python 3.13

Library version

openai v2.45.0 (also present on openai v3.7.0 / current main: ActionFind.url: str)
openai-agents v0.19.2 (restore path: RunState.from_jsonModelResponse)

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions