.NET: Add Message Delivery Callback Overloads to Executor#5081
Merged
.NET: Add Message Delivery Callback Overloads to Executor#5081
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces executor lifecycle hooks to let workflow authors detect when an executor’s per-superstep message delivery phase begins and ends—supporting non-incremental aggregation scenarios (e.g., fan-in) in the .NET workflows in-process runner.
Changes:
- Added
Executor.OnMessageDeliveryStartingAsync/Executor.OnMessageDeliveryFinishedAsyncvirtual hooks. - Invoked the new delivery hooks from the in-process runner around per-executor message delivery.
- Added unit tests validating delivery hooks and existing checkpointing/restore events behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| dotnet/src/Microsoft.Agents.AI.Workflows/Executor.cs | Adds new virtual per-superstep message delivery start/finish hooks on Executor. |
| dotnet/src/Microsoft.Agents.AI.Workflows/InProc/InProcessRunner.cs | Calls the new hooks before/after delivering queued messages to an executor in a superstep. |
| dotnet/src/Microsoft.Agents.AI.Workflows/InProc/InProcessExecutionEnvironment.cs | Updates resume behavior (but currently introduces a bug in returned Run). |
| dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/InProcessExecutorEventsTests.cs | New tests covering delivery hooks plus checkpointing/restore event behavior. |
f7f0ee0 to
dada178
Compare
SergeyMenshykh
approved these changes
Apr 3, 2026
rogerbarreto
reviewed
Apr 3, 2026
rogerbarreto
reviewed
Apr 3, 2026
peibekwe
reviewed
Apr 3, 2026
peibekwe
approved these changes
Apr 3, 2026
299a0cf to
45166cd
Compare
peibekwe
approved these changes
Apr 3, 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.
Motivation and Context
Often it is desirable to create an Executor that runs aggregation logic on incoming messages, but that logic is not incremental, so it is important to know when the full set of messages has been collected.
Description
Add
OnMessageDeliveryStartingandOnMessageDeliveryFinishedoverloads onExecutor, enabling users to determine when the super step's message deliveries for the Executor are starting and when deliveries have completed.Closes #2156
Contribution Checklist
[ ] Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.