.NET: Add AgentWithApproval hosted agent sample with HITL [WIP]#4077
Draft
rogerbarreto wants to merge 1 commit intomicrosoft:mainfrom
Draft
.NET: Add AgentWithApproval hosted agent sample with HITL [WIP]#4077rogerbarreto wants to merge 1 commit intomicrosoft:mainfrom
rogerbarreto wants to merge 1 commit intomicrosoft:mainfrom
Conversation
Add a new HostedAgents sample demonstrating human-in-the-loop (HITL) approval for MCP tool calls. The agent uses the Microsoft Learn MCP server with AlwaysRequire approval mode, requiring explicit user approval before any tool invocation. This is a companion to the AgentWithHostedMCP sample, showing the same use case but with approval-gated tool execution. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a new HostedAgents sample (AgentWithApproval) demonstrating human-in-the-loop (HITL) approval for MCP tool calls. The sample is a companion to the existing AgentWithHostedMCP sample, showing the same Microsoft Learn MCP server integration but with AlwaysRequire approval mode instead of NeverRequire mode, requiring explicit user approval before each tool invocation.
Changes:
- Added AgentWithApproval sample with Program.cs, README.md, agent.yaml, Dockerfile, and .csproj files
- Integrated the new sample into the solution file
- Includes HTTP request examples for testing the approval workflow
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
Program.cs |
Creates an agent with HostedMcpServerTool configured for AlwaysRequire approval mode using Azure OpenAI Responses |
README.md |
Documents the HITL approval pattern, prerequisites, environment setup, and comparison with AgentWithHostedMCP |
agent.yaml |
Configures the hosted agent metadata, protocols, environment variables, and resource requirements |
Dockerfile |
Multi-stage build configuration for containerizing the sample |
AgentWithApproval.csproj |
Project configuration with explicit package references and analyzer settings for Docker compatibility |
run-requests.http |
HTTP requests for testing health check and agent invocation scenarios |
agent-framework-dotnet.slnx |
Adds the new project to the solution file structure |
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 a new HostedAgents sample demonstrating human-in-the-loop (HITL) approval for MCP tool calls. The agent uses the Microsoft Learn MCP server with AlwaysRequire approval mode, requiring explicit user approval before any tool invocation.
This is a companion to the AgentWithHostedMCP sample, showing the same use case but with approval-gated tool execution.