-
Notifications
You must be signed in to change notification settings - Fork 642
.NET: Fix Concurrency Support for Orchestrations #1689
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
.NET: Fix Concurrency Support for Orchestrations #1689
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 fixes concurrency support for orchestration workflows by addressing gaps in cross-run shareability declarations and correcting the reset logic. The key changes ensure that stateless executors are properly marked as cross-run shareable, and workflows can correctly reset when needed.
Key Changes
- Marks multiple stateless specialized executors as cross-run shareable (CollectChatMessagesExecutor, HandoffStartExecutor, HandoffAgentExecutor, HandoffEndExecutor, OutputMessagesExecutor)
- Switches ConcurrentEndExecutor from shared instance to factory-based registration to enable cross-run shareability
- Fixes reset logic to properly handle workflows with only cross-run shareable executors
Reviewed Changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| TestEchoAgent.cs | New test helper agent that echoes messages with optional prefix |
| SampleSmokeTest.cs | Adds tests for new orchestration patterns (Steps 10-12) and updates existing tests to support multiple execution environments |
| 12_HandOff_HostAsAgent.cs | New sample demonstrating handoff workflow with host agent pattern |
| 11_Concurrent_HostAsAgent.cs | New sample demonstrating concurrent workflow with host agent pattern |
| 10_Sequential_HostAsAgent.cs | New sample demonstrating sequential workflow with host agent pattern |
| 07_GroupChat_Workflow_HostAsAgent.cs | Updated to use new execution environment parameter |
| 06_GroupChat_Workflow.cs | Refactored to use TestEchoAgent and removed EchoAgent implementation |
| AgentWorkflowBuilderTests.cs | Updated to parameterize execution environment in workflow tests |
| Workflow.cs | Fixed reset logic to check for resettable executors instead of non-resettable ones |
| OutputMessagesExecutor.cs | Marked as cross-run shareable |
| HandoffsStartExecutor.cs | Marked as cross-run shareable and added executor ID constant |
| HandoffsEndExecutor.cs | Marked as cross-run shareable |
| HandoffAgentExecutor.cs | Marked as cross-run shareable |
| ConcurrentEndExecutor.cs | Added executor ID constant for factory-based registration |
| CollectChatMessagesExecutor.cs | Marked as cross-run shareable |
| ExecutorRegistration.cs | Refactored reset/concurrent support logic and improved documentation |
| AgentWorkflowBuilder.cs | Changed ConcurrentEndExecutor to factory-based registration |
dotnet/src/Microsoft.Agents.AI.Workflows/AgentWorkflowBuilder.cs
Outdated
Show resolved
Hide resolved
af282c9 to
9b8fb7f
Compare
dotnet/src/Microsoft.Agents.AI.Workflows/Specialized/HandoffsEndExecutor.cs
Outdated
Show resolved
Hide resolved
Concurrent run support was recently added to workflows, but Orchestrations did not fully update to support it. A few executors were missing Cross-Run Shareable annotations, and the ConcurrentEnd executor needed to be factory-instantiated. This also ports the fix for #1613 from #1637, to avoid waiting on that PR.
9b8fb7f to
607a678
Compare
Concurrent run support was recently added to workflows, but Orchestrations did not fully update to support it. A few executors were missing Cross-Run Shareable annotations, and the ConcurrentEnd executor needed to be factory-instantiated. This also ports the fix for microsoft#1613 from microsoft#1637, to avoid waiting on that PR.
Motivation and Context
Concurrent-Shared run support was recently added to workflows, but Orchestrations did not fully update to support it. As well, the logic around resetting was flawed, causing workflows consisting only of Cross-Run Shareable executor registrations to fail to reset properly.
Description
Contribution Checklist