Python: Add search tool content for OpenAI responses - #5302
Merged
Eduard van Valkenburg (eavanvalkenburg) merged 5 commits intoApr 20, 2026
Merged
Conversation
Copilot started reviewing on behalf of
Eduard van Valkenburg (eavanvalkenburg)
April 16, 2026 09:38
View session
Contributor
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Python OpenAI Responses chat client and the core content model to preserve OpenAI built-in web/file search tool activity (calls/results) in the framework’s unified Content representation, including streaming support and reasoning-done de-duplication.
Changes:
- Add new unified content types:
search_tool_callandsearch_tool_resultin core. - Parse OpenAI non-streaming
web_search_call/file_search_calloutput items into those new content types. - Parse OpenAI streaming search output items (
response.output_item.added/response.output_item.done), explicitly ignore search progress events, and forwardseen_reasoning_delta_item_idsconsistently across both streaming paths.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
python/packages/openai/agent_framework_openai/_chat_client.py |
Maps Responses API search output items into unified Content objects; ignores search progress events; forwards reasoning delta tracking through both streaming paths. |
python/packages/core/agent_framework/_types.py |
Extends ContentType and adds Content.from_search_tool_call() / Content.from_search_tool_result() constructors; updates argument parsing docstring. |
python/packages/openai/tests/openai/test_openai_chat_client.py |
Adds unit tests for non-streaming + streaming search parsing and for reasoning done suppression after deltas across both streaming implementations. |
Comments suppressed due to low confidence (1)
python/packages/core/agent_framework/_types.py:1543
Content.parse_arguments()docstring states it raisesContentErrorwhen the content type doesn't support arguments, but the implementation doesn't checkself.typeand will never raise that error. Please either add an explicit type guard (e.g., allow only function_call/mcp_server_tool_call/search_tool_call) or update the docstring to reflect the actual behavior.
def parse_arguments(self) -> dict[str, Any | None] | None:
"""Parse arguments from function_call, mcp_server_tool_call, or search_tool_call content.
If arguments cannot be parsed as JSON or the result is not a dict,
they are returned as a dictionary with a single key "raw".
Returns:
Parsed arguments as a dictionary, or None if no arguments.
Raises:
ContentError: If the content type doesn't support arguments.
Giles Odigwe (giles17)
approved these changes
Apr 16, 2026
Evan Mattson (moonbox3)
approved these changes
Apr 20, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Apr 20, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Apr 20, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Apr 20, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Apr 20, 2026
Eduard van Valkenburg (eavanvalkenburg)
enabled auto-merge
April 20, 2026 06:27
Evan Mattson (moonbox3)
approved these changes
Apr 20, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Eduard van Valkenburg (eavanvalkenburg)
force-pushed
the
copilot/search-tool-content
branch
from
April 20, 2026 06:32
0b41788 to
4d07f4f
Compare
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Apr 20, 2026
Eduard van Valkenburg (eavanvalkenburg)
enabled auto-merge
April 20, 2026 06:45
Evan Mattson (moonbox3)
approved these changes
Apr 20, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Apr 20, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Apr 20, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Apr 20, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Apr 20, 2026
Eduard van Valkenburg (eavanvalkenburg)
enabled auto-merge
April 20, 2026 13:34
westey (westey-m)
approved these changes
Apr 20, 2026
Eduard van Valkenburg (eavanvalkenburg)
deleted the
copilot/search-tool-content
branch
June 30, 2026 09:01
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation and Context
OpenAI Responses web and file search built-in tools currently show up in raw provider output, but the Python OpenAI chat client drops them from the framework content model. This change preserves those built-in tool calls/results so downstream surfaces can observe them the same way they already can for code interpreter, shell, image generation, and MCP tool activity.
Description
search_tool_callandsearch_tool_resultcontent types in coreweb_search_callandfile_search_calloutput items into those content typesresponse.output_item.added/response.output_item.donesearch items into those content types and explicitly ignore search progress events instead of leaving them as unparsed noiseseen_reasoning_delta_item_idsthrough both OpenAI streaming paths so reasoning done events are suppressed after deltas consistentlyContribution Checklist