Skip to content

OpenAI Responses API fileSearch - sending repeated tool messages #8479

@itscharliecowan

Description

@itscharliecowan

Description

I switched from a custom file search tool to the native file_search: openai.tools.fileSearch one as part of my migration to SDK v5.

When it runs I get an assistant response in the UI, and then immediately see the tool called again, with a slightly different response coming back (ie its not showing a duplicate of the same message).

Then in OpenAI logs I see multiple tool messages (up to my stopWhen limit) with all of the following ones (after the correct initial tool call) showing invalid input.

This only happened for the File Search tool, not the OpenAI web search tool. When I switched back to my custom file search tool, all worked as expected.

Is there anything in the AI SDK implementation of fileSearch that might be causing the additional messages?

First image shows an assistant message completing and then immediately a tool call being made without any further user input.

The second image shows opening i logs with one completed message and then four following all with errors.

Image Image

AI SDK Version

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions