-
Couldn't load subscription status.
- Fork 615
.NET Workflows - Add support for tool approval #1685
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this 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 support for tool approval in .NET workflows by introducing new event types that distinguish between different kinds of user input requests (messages vs. tool approvals) and separates function tool calls from general user input handling.
Key changes:
- Renamed and refactored event classes to better distinguish between user messages (
UserMessageRequest/UserMessageResponse) and tool-related events (AgentFunctionToolRequest/AgentFunctionToolResponse) - Added new
UserInputRequest/UserInputResponseclasses to handle tool approval scenarios for both function and MCP tools - Updated workflow execution logic to handle separate request ports for function calling and user input approval
Reviewed Changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
Events/UserMessageRequest.cs |
Replaces InputRequest with simplified user message request |
Events/UserMessageResponse.cs |
Renames InputResponse to UserMessageResponse |
Events/UserInputRequest.cs |
New class for tool approval requests |
Events/UserInputResponse.cs |
New class for tool approval responses |
Events/AgentFunctionToolRequest.cs |
Renames AgentToolRequest to clarify function-specific nature |
Events/AgentFunctionToolResponse.cs |
Renames AgentToolResponse to match request naming |
Events/InputRequest.cs |
Removed (replaced by UserMessageRequest) |
Events/AgentToolRequest.cs |
Removed (replaced by AgentFunctionToolRequest) |
Events/AgentToolResponse.cs |
Removed (replaced by AgentFunctionToolResponse) |
ObjectModel/QuestionExecutor.cs |
Updated to use UserMessageRequest/UserMessageResponse |
ObjectModel/InvokeAzureAgentExecutor.cs |
Added user input handling logic and separated function call handling |
Interpreter/WorkflowActionVisitor.cs |
Added separate request ports for function calling and user input |
WorkflowAgentProvider.cs |
Updated documentation to reference renamed classes |
Microsoft.Agents.AI.Workflows.Declarative.csproj |
Suppressed MEAI001 warning |
| Test files | Updated tests to use renamed classes and added new tests for UserInputRequest/UserInputResponse |
samples/.../ExecuteWorkflow/Program.cs |
Updated sample to handle new event types including tool approval |
dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Events/UserInputRequestTest.cs
Outdated
Show resolved
Hide resolved
.../Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Events/AgentFunctionToolResponseTest.cs
Outdated
Show resolved
Hide resolved
...s/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Events/AgentFunctionToolRequestTest.cs
Outdated
Show resolved
Hide resolved
...et/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Events/UserInputResponseTest.cs
Outdated
Show resolved
Hide resolved
dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/ObjectModel/InvokeAzureAgentExecutor.cs
Outdated
Show resolved
Hide resolved
dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Interpreter/WorkflowActionVisitor.cs
Outdated
Show resolved
Hide resolved
dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Events/AgentFunctionToolResponse.cs
Outdated
Show resolved
Hide resolved
dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Events/UserInputResponse.cs
Outdated
Show resolved
Hide resolved
dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Events/UserInputResponse.cs
Outdated
Show resolved
Hide resolved
dotnet/samples/GettingStarted/Workflows/Declarative/ExecuteWorkflow/Program.cs
Outdated
Show resolved
Hide resolved
…//github.com/microsoft/agent-framework into crickman/workflows-declarative-tool-approval
dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Events/UserInputResponse.cs
Outdated
Show resolved
Hide resolved
dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Events/AnswerRequest.cs
Show resolved
Hide resolved
dotnet/samples/GettingStarted/Workflows/Declarative/ExecuteWorkflow/Program.cs
Show resolved
Hide resolved
…//github.com/microsoft/agent-framework into crickman/workflows-declarative-tool-approval
Motivation and Context
Support tool approval for function and mcp tools.
Description
UserInputRequestandUserInputResponseto handle approval requestsContribution Checklist