.NET: Add observer for OpenAIWebSearch#5894
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the .NET Harness “Step01_Research” console sample to display richer streaming details for the OpenAI Responses web_search tool via a dedicated observer.
Changes:
- Register a new
OpenAIResponsesWebSearchDisplayObserverin the Step01 Research sample’s observer pipeline. - Add
OpenAIResponsesWebSearchDisplayObserverimplementation to render search/query/open/find-in-page activity (and optionally sources) in the console. - Special-case
WebSearchToolCallContentinToolCallDisplayObserverto avoid duplicate tool-call output.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| dotnet/samples/02-agents/Harness/Harness_Step01_Research/Program.cs | Adds the new web-search display observer to the sample’s observer list. |
| dotnet/samples/02-agents/Harness/Harness_Step01_Research/OpenAIResponsesWebSearchDisplayObserver.cs | Implements detailed console rendering for OpenAI Responses web search activity. |
| dotnet/samples/02-agents/Harness/Harness_Shared_Console/Observers/ToolCallDisplayObserver.cs | Attempts to suppress web search tool-call messages to prevent duplication. |
Comments suppressed due to low confidence (1)
dotnet/samples/02-agents/Harness/Harness_Step01_Research/OpenAIResponsesWebSearchDisplayObserver.cs:178
- Same issue here:
JsonDocument.Parse(data)is being passed theBinaryDatareturned byModelReaderWriter.Write(wscri), which isn’t a supported overload and will fail to compile. Convertdatato string/bytes first.
var data = System.ClientModel.Primitives.ModelReaderWriter.Write(wscri);
using var doc = System.Text.Json.JsonDocument.Parse(data);
SergeyMenshykh
approved these changes
May 15, 2026
lokitoth
approved these changes
May 15, 2026
This was referenced Jun 4, 2026
This was referenced Jun 4, 2026
Open
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
Description
Updating the console samples with an observer that allows displaying more detail of calls to the OpenAIResponses web_search tool.
Contribution Checklist