Skip to content

.NET: Add observer for OpenAIWebSearch#5894

Merged
westey-m merged 3 commits into
microsoft:mainfrom
westey-m:websearch-observer
May 15, 2026
Merged

.NET: Add observer for OpenAIWebSearch#5894
westey-m merged 3 commits into
microsoft:mainfrom
westey-m:websearch-observer

Conversation

@westey-m
Copy link
Copy Markdown
Contributor

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

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.

Copilot AI review requested due to automatic review settings May 15, 2026 13:02
@moonbox3 moonbox3 added the .NET label May 15, 2026
@github-actions github-actions Bot changed the title Add observer for OpenAIWebSearch .NET: Add observer for OpenAIWebSearch May 15, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 OpenAIResponsesWebSearchDisplayObserver in the Step01 Research sample’s observer pipeline.
  • Add OpenAIResponsesWebSearchDisplayObserver implementation to render search/query/open/find-in-page activity (and optionally sources) in the console.
  • Special-case WebSearchToolCallContent in ToolCallDisplayObserver to 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 the BinaryData returned by ModelReaderWriter.Write(wscri), which isn’t a supported overload and will fail to compile. Convert data to string/bytes first.
            var data = System.ClientModel.Primitives.ModelReaderWriter.Write(wscri);
            using var doc = System.Text.Json.JsonDocument.Parse(data);

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated Code Review

Reviewers: 4 | Confidence: 91% | Result: All clear

Reviewed: Correctness, Security Reliability, Test Coverage, Design Approach


Automated review by westey-m's agents

@westey-m westey-m added this pull request to the merge queue May 15, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 15, 2026
@westey-m westey-m added this pull request to the merge queue May 15, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 15, 2026
@westey-m westey-m added this pull request to the merge queue May 15, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 15, 2026
@westey-m westey-m added this pull request to the merge queue May 15, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 15, 2026
@westey-m westey-m added this pull request to the merge queue May 15, 2026
Merged via the queue into microsoft:main with commit 9b772f3 May 15, 2026
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants