Skip to content

Conversation

@lokitoth
Copy link
Member

@lokitoth lokitoth commented Oct 29, 2025

When we started introducing the different execution modes to solidify the concurrency model, we broke the WorkflowAsAgent Sample, which was not updated for either of IResettableExecutor or Cross-Run Shareable.

The fix is to make public and switch to using the ChatForwardingExecutor in place of a self-defined ConcurrentStartExecutor, and make the ConcurrentAggregationExecutor implement IResettableExecutor

Description

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.

@lokitoth lokitoth added .NET workflows Related to Workflows in agent-framework labels Oct 29, 2025
@lokitoth lokitoth force-pushed the dev/dotnet_workflow/fix_workflow_as_agent_sample branch from 6b9d132 to e429504 Compare October 29, 2025 19:20
@lokitoth lokitoth marked this pull request as ready for review October 29, 2025 19:20
Copilot AI review requested due to automatic review settings October 29, 2025 19:20
@lokitoth lokitoth enabled auto-merge October 29, 2025 19:26
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 refactors the ChatForwardingExecutor from an internal specialized component to a public reusable API, and updates the WorkflowAsAnAgent sample to use it instead of a custom implementation.

Key changes:

  • Made ChatForwardingExecutor public with comprehensive XML documentation
  • Moved it from Microsoft.Agents.AI.Workflows.Specialized to Microsoft.Agents.AI.Workflows namespace
  • Replaced custom ConcurrentStartExecutor in sample with ChatForwardingExecutor
  • Added IResettableExecutor implementation to ConcurrentAggregationExecutor for proper cleanup

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
dotnet/src/Microsoft.Agents.AI.Workflows/ChatForwardingExecutor.cs Promoted from internal to public, added comprehensive documentation, and marked ConfigureRoutes as sealed override
dotnet/samples/GettingStarted/Workflows/Agents/WorkflowAsAnAgent/WorkflowFactory.cs Replaced custom ConcurrentStartExecutor with ChatForwardingExecutor and added reset capability to ConcurrentAggregationExecutor
Comments suppressed due to low confidence (2)

dotnet/src/Microsoft.Agents.AI.Workflows/ChatForwardingExecutor.cs:20

  • The sealed modifier on an override method is redundant since the containing class is already sealed. Remove sealed from the method declaration.
    dotnet/src/Microsoft.Agents.AI.Workflows/ChatForwardingExecutor.cs:12
  • The newly public ChatForwardingExecutor class lacks unit test coverage. Consider adding tests to verify message forwarding behavior for all supported message types (string, ChatMessage, List, TurnToken).

@lokitoth lokitoth changed the title .NET WIP: fix: WorkflowAsAgent Sample .NET: fix: WorkflowAsAgent Sample Oct 30, 2025
@lokitoth lokitoth force-pushed the dev/dotnet_workflow/fix_workflow_as_agent_sample branch from e429504 to a2ed9d9 Compare November 3, 2025 14:27
@lokitoth lokitoth force-pushed the dev/dotnet_workflow/fix_workflow_as_agent_sample branch from b45909b to 52612b8 Compare November 3, 2025 15:52
@lokitoth lokitoth force-pushed the dev/dotnet_workflow/fix_workflow_as_agent_sample branch from 52612b8 to 184d3ea Compare November 3, 2025 17:15
@lokitoth
Copy link
Member Author

lokitoth commented Nov 3, 2025

Added one more fix to update for a change in how message aggregation happens in AIAgentHostExecutor post #1439

@lokitoth lokitoth force-pushed the dev/dotnet_workflow/fix_workflow_as_agent_sample branch from 184d3ea to f5a28fb Compare November 3, 2025 18:15
@lokitoth
Copy link
Member Author

lokitoth commented Nov 3, 2025

Pending #1612

@lokitoth lokitoth force-pushed the dev/dotnet_workflow/fix_workflow_as_agent_sample branch from f5a28fb to b7906b0 Compare November 5, 2025 14:54
* Also makes ChatForwardingExecutor public
Make ChatForwardingExecutor match the input types of ChatProtocolExecutor.
AIAgent always sends out List<ChatMessage> now.
@lokitoth lokitoth force-pushed the dev/dotnet_workflow/fix_workflow_as_agent_sample branch from b7906b0 to d62975a Compare November 5, 2025 18:38
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

None yet

Development

Successfully merging this pull request may close these issues.

.NET: Cannot reuse Workflow with shared Executor instances that do not implement IResettableExecutor

5 participants