Skip to content

.NET: Add Foundry Agents Tool Sample - Web Search - #4040

Merged
Roger Barreto (rogerbarreto) merged 7 commits into
microsoft:mainfrom
rogerbarreto:feature/3674-web-search
Feb 23, 2026
Merged

.NET: Add Foundry Agents Tool Sample - Web Search#4040
Roger Barreto (rogerbarreto) merged 7 commits into
microsoft:mainfrom
rogerbarreto:feature/3674-web-search

Conversation

@rogerbarreto

Copy link
Copy Markdown
Member

Motivation and Context

Adds a new FoundryAgents_Step25_WebSearch sample demonstrating how to use the Responses API built-in web search tool with AI Agents.

Description

  • Create agents with web search capabilities using two approaches:
    • Option 1: HostedWebSearchTool (MEAI + AgentFramework abstraction)
    • Option 2: ResponseTool.CreateWebSearchTool() (Native SDK / Responses API)
  • Extract text responses and URL citations from agent responses
  • Manage agent lifecycle (create and cleanup)

Note: The web search tool uses the built-in Responses API web search capability. No Bing Grounding connection is required.

Changes

  • New sample: FoundryAgents_Step25_WebSearch with Program.cs and README.md

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.

Remove incorrect Bing Grounding connection ID requirement from the
WebSearch sample. The web search tool uses the OpenAI Responses API
built-in capability and does not need a connection ID.
- Remove AZURE_FOUNDRY_BING_CONNECTION_ID env var requirement
- Use HostedWebSearchTool() without connectionId properties
- Refactor creation options into local functions (MEAI + NativeSDK)
- Switch from AzureCliCredential to DefaultAzureCredential
- Update README to reflect correct prerequisites
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
CopilotAI review requested due to automatic review settings February 18, 2026 17:28
@rogerbarretoRoger Barreto (rogerbarreto) added documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs .NET Usage: [Issues, PRs], Target: .Net labels Feb 18, 2026

CopilotAI 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.

Pull request overview

Adds a new .NET GettingStarted FoundryAgents_Step25_WebSearch sample demonstrating how to enable the Responses API built-in web search tool on Foundry Agents, run a query, and extract text + URL citation annotations.

Changes:

  • New console sample project (net10.0) that creates a Foundry agent with web search tooling (MEAI hosted tool, with a native SDK option shown).
  • Adds output processing to print text responses and URL citation annotations.
  • Adds a README with prerequisites and run instructions for the new step.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

FileDescription
dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step25_WebSearch/README.mdDocuments purpose, prerequisites, env vars, and execution steps for the web search sample.
dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step25_WebSearch/Program.csImplements agent creation (web search enabled), execution, citation extraction, and cleanup.
dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step25_WebSearch/FoundryAgents_Step25_WebSearch.csprojNew sample project definition and dependencies.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add FoundryAgents_Step25_WebSearch to agent-framework-dotnet.slnx
- Add web search sample entry to parent FoundryAgents README.md
- Simplify text response extraction to use response.Text directly
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants

@rogerbarreto@SergeyMenshykh@westey-m