Skip to content

.NET: Add Message Delivery Callback Overloads to Executor#5081

Merged
lokitoth merged 3 commits intomainfrom
dev/dotnet_workflow/executor_step_events
Apr 3, 2026
Merged

.NET: Add Message Delivery Callback Overloads to Executor#5081
lokitoth merged 3 commits intomainfrom
dev/dotnet_workflow/executor_step_events

Conversation

@lokitoth
Copy link
Copy Markdown
Member

@lokitoth lokitoth commented Apr 3, 2026

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 OnMessageDeliveryStarting and OnMessageDeliveryFinished overloads on Executor, 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

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • [ ] Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.

Copilot AI review requested due to automatic review settings April 3, 2026 15:28
@markwallace-microsoft markwallace-microsoft added .NET workflows Related to Workflows in agent-framework labels Apr 3, 2026
@github-actions github-actions bot changed the title Dev/dotnet workflow/executor step events .NET: Dev/dotnet workflow/executor step events Apr 3, 2026
@lokitoth lokitoth changed the title .NET: Dev/dotnet workflow/executor step events .NET: Add Message Delivery Callback Overloads to Executor Apr 3, 2026
Copy link
Copy Markdown
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 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.OnMessageDeliveryFinishedAsync virtual 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.

Comment thread dotnet/src/Microsoft.Agents.AI.Workflows/InProc/InProcessExecutionEnvironment.cs Outdated
Comment thread dotnet/src/Microsoft.Agents.AI.Workflows/InProc/InProcessRunner.cs Outdated
@lokitoth lokitoth force-pushed the dev/dotnet_workflow/executor_step_events branch from f7f0ee0 to dada178 Compare April 3, 2026 16:23
Comment thread dotnet/src/Microsoft.Agents.AI.Workflows/InProc/InProcessRunner.cs Outdated
Comment thread dotnet/src/Microsoft.Agents.AI.Workflows/InProc/InProcessExecutionEnvironment.cs Outdated
Comment thread dotnet/src/Microsoft.Agents.AI.Workflows/InProc/InProcessRunner.cs Outdated
@lokitoth lokitoth force-pushed the dev/dotnet_workflow/executor_step_events branch from 299a0cf to 45166cd Compare April 3, 2026 17:56
@lokitoth lokitoth added this pull request to the merge queue Apr 3, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 3, 2026
@lokitoth lokitoth added this pull request to the merge queue Apr 3, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 3, 2026
@lokitoth lokitoth added this pull request to the merge queue Apr 3, 2026
@lokitoth lokitoth moved this to In Review in Agent Framework Apr 3, 2026
@lokitoth lokitoth self-assigned this Apr 3, 2026
Merged via the queue into main with commit 55ae57c Apr 3, 2026
21 checks passed
@github-project-automation github-project-automation bot moved this from In Review to Done in Agent Framework Apr 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

.NET workflows Related to Workflows in agent-framework

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

.NET: Consider a method for knowing when all edges going to your executor have finished

6 participants