.Net: Add additional Hosted Agent Samples#4325
Open
rogerbarreto wants to merge 7 commits intomicrosoft:mainfrom
Open
.Net: Add additional Hosted Agent Samples#4325rogerbarreto wants to merge 7 commits intomicrosoft:mainfrom
rogerbarreto wants to merge 7 commits intomicrosoft:mainfrom
Conversation
…AgentThreadAndHITL - AgentWithTools: Foundry tools (MCP + code interpreter) via UseFoundryTools - AgentWithLocalTools: Local C# function tool (Seattle hotel search) with AIProjectClient - AgentThreadAndHITL: Human-in-the-loop with ApprovalRequiredAIFunction and thread persistence All samples follow agent-framework conventions (net10.0, AzureCliCredential, CPM disabled). AgentWithTools includes comprehensive README with setup guide and troubleshooting. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…date sample READMEs - Create root README.md with shared prerequisites, Azure AI Foundry setup, troubleshooting, and samples index - Replace test_requests.py with run-requests.http in AgentThreadAndHITL - Add pointer to root README in all 6 sample READMEs - Trim AgentWithTools README to concise style Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds three new hosted agent samples to the agent-framework repository, demonstrating different capabilities of the Azure AI AgentServer SDK. The samples follow the repository's conventions for Docker-based deployment with Central Package Management (CPM) disabled, .NET 10 targeting, and AzureCliCredential authentication.
Changes:
- Added three new hosted agent samples: AgentWithTools (Foundry tools with MCP and code interpreter), AgentWithLocalTools (local C# function tools with hotel search), and AgentThreadAndHITL (human-in-the-loop approval with thread persistence)
- Created a comprehensive shared README at
HostedAgents/README.mdconsolidating common setup, prerequisites, Azure AI Foundry configuration, and troubleshooting guidance - Updated existing sample READMEs to reference the shared documentation and added
.httptest files for all samples
Reviewed changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated 17 comments.
Show a summary per file
| File | Description |
|---|---|
| dotnet/samples/05-end-to-end/HostedAgents/README.md | New comprehensive shared documentation covering prerequisites, Azure AI Foundry setup, environment variables, deployment, and troubleshooting |
| dotnet/samples/05-end-to-end/HostedAgents/AgentWithTools/* | New sample demonstrating Foundry MCP tools and code interpreter with UseFoundryTools extension |
| dotnet/samples/05-end-to-end/HostedAgents/AgentWithLocalTools/* | New sample demonstrating local C# function execution with hotel search tool using AIProjectClient |
| dotnet/samples/05-end-to-end/HostedAgents/AgentThreadAndHITL/* | New sample demonstrating human-in-the-loop approval workflow with ApprovalRequiredAIFunction and thread persistence |
| dotnet/samples/05-end-to-end/HostedAgents/AgentsInWorkflows/README.md | Added reference to shared README for common setup instructions |
| dotnet/samples/05-end-to-end/HostedAgents/AgentWithTextSearchRag/README.md | Added reference to shared README for common setup instructions |
| dotnet/samples/05-end-to-end/HostedAgents/AgentWithHostedMCP/README.md | Added reference to shared README for common setup instructions |
dotnet/samples/05-end-to-end/HostedAgents/AgentWithTools/README.md
Outdated
Show resolved
Hide resolved
dotnet/samples/05-end-to-end/HostedAgents/AgentWithLocalTools/AgentWithLocalTools.csproj
Outdated
Show resolved
Hide resolved
dotnet/samples/05-end-to-end/HostedAgents/AgentWithLocalTools/Program.cs
Outdated
Show resolved
Hide resolved
dotnet/samples/05-end-to-end/HostedAgents/AgentWithLocalTools/AgentWithLocalTools.csproj
Show resolved
Hide resolved
dotnet/samples/05-end-to-end/HostedAgents/AgentWithLocalTools/AgentWithLocalTools.csproj
Outdated
Show resolved
Hide resolved
dotnet/samples/05-end-to-end/HostedAgents/AgentWithLocalTools/agent.yaml
Outdated
Show resolved
Hide resolved
dotnet/samples/05-end-to-end/HostedAgents/AgentWithLocalTools/README.md
Outdated
Show resolved
Hide resolved
dotnet/samples/05-end-to-end/HostedAgents/AgentWithLocalTools/Dockerfile
Show resolved
Hide resolved
- Add UTF-8 BOM (CHARSET) - Sort System.ClientModel.Primitives import alphabetically (IMPORTS) - Use target-typed new for AIProjectClient (IDE0090) - Add internal accessibility modifier to Hotel record (IDE0040) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Change default model from gpt-4.1-mini to gpt-4o-mini in AgentWithLocalTools (Program.cs, agent.yaml, README.md) to match existing samples - Change README example from gpt-5.2 to gpt-4o-mini in AgentWithTools and root README - Align AgentWithLocalTools package versions with other samples: Azure.AI.AgentServer.AgentFramework beta.6 -> beta.8 Azure.AI.OpenAI 2.8.0-beta.1 -> 2.7.0-beta.2 Microsoft.Extensions.AI.OpenAI 10.2.0-preview -> 10.1.1-preview Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Azure.AI.OpenAI: 2.7.0-beta.2 -> 2.8.0-beta.1 - Microsoft.Extensions.AI.OpenAI: 10.1.1-preview -> 10.3.0 Aligns with AgentWithHostedMCP which uses the latest versions. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Azure.AI.AgentServer.AgentFramework beta.8 was compiled against Microsoft.Extensions.AI.Abstractions with the single-param FunctionApprovalRequestContent.CreateResponse(bool). Version 10.3.0 changed the signature to include an optional reason parameter, causing a binary incompatibility at runtime. Pin to 10.1.1 until the framework is recompiled against the newer abstractions. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
westey-m
reviewed
Feb 27, 2026
dotnet/samples/05-end-to-end/HostedAgents/AgentThreadAndHITL/AgentThreadAndHITL.csproj
Show resolved
Hide resolved
westey-m
reviewed
Feb 27, 2026
dotnet/samples/05-end-to-end/HostedAgents/AgentWithLocalTools/Program.cs
Show resolved
Hide resolved
westey-m
approved these changes
Feb 27, 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.
Add 3 new Hosted Agent samples + documentation restructure
This PR brings three missing hosted agent samples from
microsoft-foundry/foundry-samplesinto the agent-framework repository, adapted to follow our conventions (net10.0,AzureCliCredential, CPM-disabled csproj pattern).New Samples
UseFoundryTools) with MCP and code interpreter. Connects to Microsoft Learn's public MCP endpoint for documentation search.AIProjectClient. Simulates a Seattle hotel search with availability, pricing, and ratings.ApprovalRequiredAIFunctionwith thread persistence viaInMemoryAgentThreadRepository.Documentation
HostedAgents/README.md— New shared documentation with common prerequisites, Azure AI Foundry setup (role assignment, MCP connection), running/deploying instructions, and troubleshooting guide..httpfiles — All samples now includerun-requests.httpfor testing with VS Code REST Client (replacedtest_requests.pyin AgentThreadAndHITL).All three samples have been tested end-to-end
microsoft_docs_searchtool invocationGetAvailableHotelsfunction execution