Skip to content

.NET: Add AgentWithApproval hosted agent sample with HITL [WIP]#4077

Draft
rogerbarreto wants to merge 1 commit intomicrosoft:mainfrom
rogerbarreto:feature/hostedagents-hitl-entra
Draft

.NET: Add AgentWithApproval hosted agent sample with HITL [WIP]#4077
rogerbarreto wants to merge 1 commit intomicrosoft:mainfrom
rogerbarreto:feature/hostedagents-hitl-entra

Conversation

@rogerbarreto
Copy link
Member

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.

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>
Copilot AI review requested due to automatic review settings February 19, 2026 10:43
@markwallace-microsoft markwallace-microsoft added documentation Improvements or additions to documentation .NET labels Feb 19, 2026
@github-actions github-actions bot changed the title .Net: Add AgentWithApproval hosted agent sample with HITL .NET: Add AgentWithApproval hosted agent sample with HITL Feb 19, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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

@rogerbarreto rogerbarreto marked this pull request as draft February 19, 2026 15:08
@rogerbarreto rogerbarreto changed the title .NET: Add AgentWithApproval hosted agent sample with HITL .NET: Add AgentWithApproval hosted agent sample with HITL [WIP] Feb 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation .NET

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments