Skip to content

.NET: Use Responses API for hosted web search in AG-UI - #7843

Merged
Roger Barreto (rogerbarreto) merged 5 commits into
mainfrom
copilot/fix-web-search-parameter-error
Aug 25, 2026
Merged

.NET: Use Responses API for hosted web search in AG-UI#7843
Roger Barreto (rogerbarreto) merged 5 commits into
mainfrom
copilot/fix-web-search-parameter-error

Conversation

Copilot AI commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Motivation & Context

HostedWebSearchTool uses web_search_options with Chat Completions. Azure OpenAI deployments can reject that parameter with HTTP 400. The AG-UI server sample needs the Responses API wire format, where web search appears in the tools array.

Description & Review Guide

  • What are the major changes? The AG-UI server now uses the OpenAI SDK directly with BearerTokenPolicy and a Responses client. The sample no longer depends on Azure.AI.OpenAI. Documentation now explains the Azure OpenAI v1 endpoint and distinguishes direct inference from a Foundry project. Unit coverage captures the outbound request and confirms tools[].type is web_search while web_search_options is absent.
  • What is the impact of these changes? Hosted web search uses the Azure OpenAI Responses API wire format and avoids the unsupported parameter reported in issue .NET: [Bug]: Request processing fails when web search is enabled because of an unsupported web_search_options parameter #7578.
  • What do you want reviewers to focus on? Review the direct OpenAI SDK authentication, Responses client selection, and outbound request shape.
IChatClient chatClient = new OpenAIClient(
        new BearerTokenPolicy(new DefaultAzureCredential(), "https://ai.azure.com/.default"),
        new OpenAIClientOptions { Endpoint = new Uri(endpoint) })
    .GetResponsesClient()
    .AsIChatClient(deploymentName);

Related Issue

Fixes #7578

Contribution Checklist

  • The code builds clean without any errors or warnings
  • All unit tests pass, and I have added new tests where possible
  • The PR follows the Contribution Guidelines
  • This PR is linked to an issue and there is no other open PR for this issue (see Related Issue above).
  • This is not a breaking change.

Copilot AI balanced review requested due to automatic review settings August 24, 2026 12:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot wasn't able to review any files in this pull request.


💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Co-authored-by: rogerbarreto <19890735+rogerbarreto@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix request processing failure for web search parameter Use Responses API for hosted web search in AG-UI Aug 24, 2026
Copilot-Session: 2b346dcb-1702-4296-bf22-b434b73fd26c
@rogerbarreto
Roger Barreto (rogerbarreto) marked this pull request as ready for review August 24, 2026 20:56
@rogerbarreto Roger Barreto (rogerbarreto) changed the title Use Responses API for hosted web search in AG-UI .NET: Use Responses API for hosted web search in AG-UI Aug 24, 2026
@agent-framework-automation agent-framework-automation Bot added documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs .NET Usage: [Issues, PRs], Target: .Net labels Aug 24, 2026
@rogerbarreto

Copy link
Copy Markdown
Member

/review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

MAF Automated Review — Iteration 1

Result: Findings reported
Scope: full PR (4 commit(s)): c0a5259a3ec2, 011496904bb2, 3f197c8c812a, 9dfa3afdfcc9
Model: gpt-5.6-sol

Overview

The PR correctly moves hosted web search to the Responses API, and the new transport-level test verifies the /v1/responses route and web_search tool shape while excluding the unsupported Chat Completions parameter. The Azure endpoint and bearer-token setup are documented clearly. However, the default stored-output Responses client makes the sample's session continuity depend on service-side response retention rather than the configured session store.

Reviewed the supplied pull-request change set across correctness, security/reliability, architecture, and failure behavior.
1 verified finding remained after source verification (1 medium) across 1 file. Details are attached to the affected lines below.

Affected areas: dotnet/samples/05-end-to-end/AGUIClientServer/AGUIServer/Program.cs

Comment thread dotnet/samples/05-end-to-end/AGUIClientServer/AGUIServer/Program.cs Outdated
Copilot-Session: 2b346dcb-1702-4296-bf22-b434b73fd26c
@rogerbarreto
Roger Barreto (rogerbarreto) added this pull request to the merge queue Aug 25, 2026
Merged via the queue into main with commit 7683b0e Aug 25, 2026
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs .NET Usage: [Issues, PRs], Target: .Net

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.NET: [Bug]: Request processing fails when web search is enabled because of an unsupported web_search_options parameter

5 participants