.NET: Add Foundry Agents Tool Sample - Web Search#4040
Open
rogerbarreto wants to merge 4 commits intomicrosoft:mainfrom
Open
.NET: Add Foundry Agents Tool Sample - Web Search#4040rogerbarreto wants to merge 4 commits intomicrosoft:mainfrom
rogerbarreto wants to merge 4 commits intomicrosoft:mainfrom
Conversation
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>
Contributor
There was a problem hiding this comment.
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.
| File | Description |
|---|---|
| dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step25_WebSearch/README.md | Documents purpose, prerequisites, env vars, and execution steps for the web search sample. |
| dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step25_WebSearch/Program.cs | Implements agent creation (web search enabled), execution, citation extraction, and cleanup. |
| dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step25_WebSearch/FoundryAgents_Step25_WebSearch.csproj | New sample project definition and dependencies. |
dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step25_WebSearch/Program.cs
Show resolved
Hide resolved
dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step25_WebSearch/Program.cs
Show resolved
Hide resolved
...ngStarted/FoundryAgents/FoundryAgents_Step25_WebSearch/FoundryAgents_Step25_WebSearch.csproj
Show resolved
Hide resolved
dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step25_WebSearch/README.md
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
westey-m
reviewed
Feb 18, 2026
| @@ -0,0 +1,22 @@ | |||
| <Project Sdk="Microsoft.NET.Sdk"> | |||
Contributor
There was a problem hiding this comment.
This needs to be added to the solution and the sample should be added to the parent folder readme.
westey-m
reviewed
Feb 18, 2026
Comment on lines
+30
to
+39
| foreach (ChatMessage message in response.Messages) | ||
| { | ||
| foreach (AIContent content in message.Contents) | ||
| { | ||
| if (content is TextContent textContent) | ||
| { | ||
| Console.WriteLine($"Response: {textContent.Text}"); | ||
| } | ||
| } | ||
| } |
Contributor
There was a problem hiding this comment.
This should jut be Console.WriteLine($"Response: {response.Text}")
westey-m
approved these changes
Feb 18, 2026
SergeyMenshykh
approved these changes
Feb 18, 2026
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
Adds a new FoundryAgents_Step25_WebSearch sample demonstrating how to use the Responses API built-in web search tool with AI Agents.
Description
HostedWebSearchTool(MEAI + AgentFramework abstraction)ResponseTool.CreateWebSearchTool()(Native SDK / Responses API)Note: The web search tool uses the built-in Responses API web search capability. No Bing Grounding connection is required.
Changes
FoundryAgents_Step25_WebSearchwithProgram.csandREADME.mdContribution Checklist