Skip to content

Conversation

@lokitoth
Copy link
Member

Motivation and Context

The streaming AgentResponseUpdate and full AgentResponse events were added before the WorkflowOutputEvent mechanism was formalized, leading to a pair of vestigial events that cause confusion for users.

Reconciling the two will make it clearer how to listen to Workflow outputs, though we special-case it to continue avoiding the output filtering logic, via WithOutputFrom().

Description

  • Python-parity: Breaking: Renames WorkflowOutputEvent.SourceId to WorkflowOutputEvent.ExecutorId
  • Adds [Obsolete] SourceId forwarding to ExecutorId on WorkflowOutputEvent
  • Changes AgentResponseUpdateEvent and AgentResponseEvent to derive from WorkflowOutputEvent to unify handling
  • Fixes .NET : Agents in Workflow. WorkflowOutputEvent not triggered #2938

BREAKING CHANGES:

  • Rename WorkflowOutputEvent.SourceId to WorkflowOutputEvent.ExecutorId

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 the .NET label Jan 26, 2026
Copilot AI review requested due to automatic review settings January 26, 2026 16:33
@lokitoth lokitoth added workflows Related to Workflows in agent-framework breaking change Introduces changes that are not backward compatible and may require updates to dependent code. labels Jan 26, 2026
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 unifies agent response events under the WorkflowOutputEvent hierarchy to address confusion about how to listen to workflow outputs from agents. The change makes AgentResponseUpdateEvent and AgentResponseEvent derive from WorkflowOutputEvent instead of ExecutorEvent, and renames WorkflowOutputEvent.SourceId to ExecutorId for Python parity.

Changes:

  • Renamed WorkflowOutputEvent.SourceId to ExecutorId with obsolete forwarding property for backward compatibility
  • Changed AgentResponseUpdateEvent and AgentResponseEvent to inherit from WorkflowOutputEvent instead of ExecutorEvent
  • Updated executors to use YieldOutputAsync() instead of directly calling AddEventAsync() for agent events, ensuring consistent special-case handling

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.

Show a summary per file
File Description
WorkflowOutputEvent.cs Changed class from sealed to non-sealed, renamed property SourceId to ExecutorId with obsolete forwarding, made constructor public, added JSON derived type attributes
AgentResponseUpdateEvent.cs Changed base class from ExecutorEvent to WorkflowOutputEvent
AgentResponseEvent.cs Changed base class from ExecutorEvent to WorkflowOutputEvent
AIAgentHostExecutor.cs Updated to call YieldOutputAsync() instead of AddEventAsync() for agent events
HandoffAgentExecutor.cs Updated to call YieldOutputAsync() instead of AddEventAsync() for agent events
InProcessRunnerContext.cs Added special-case handling for AgentResponse and AgentResponseUpdate to create their specific event types
TestWorkflowContext.cs Added special-case handling consistent with InProcessRunnerContext
TestRunContext.cs Added special-case handling consistent with InProcessRunnerContext
AgentEventsTests.cs New test file verifying the inheritance changes and regression test for issue #2938
Sample test files Updated references from SourceId to ExecutorId

@lokitoth lokitoth force-pushed the dev/dotnet_workflow/unify_agent_response_event_in_output branch from 2332d2e to 3fe658a Compare January 26, 2026 16:58
@lokitoth lokitoth force-pushed the dev/dotnet_workflow/unify_agent_response_event_in_output branch from 3fe658a to 42a9908 Compare January 26, 2026 17:15
@lokitoth lokitoth force-pushed the dev/dotnet_workflow/unify_agent_response_event_in_output branch from 42a9908 to a8f2e72 Compare January 26, 2026 18:55
@lokitoth lokitoth force-pushed the dev/dotnet_workflow/unify_agent_response_event_in_output branch from a8f2e72 to f2093fe Compare January 27, 2026 21:41
- Rename SourceId property to ExecutorId in WorkflowOutputEvent
- Add [Obsolete] SourceId property for backward compatibility
- Update all test usages to use ExecutorId

Resolves part of #2938
- Change AgentResponseEvent and AgentResponseUpdateEvent to inherit from
  WorkflowOutputEvent instead of ExecutorEvent
- Update AIAgentHostExecutor and HandoffAgentExecutor to use YieldOutputAsync()
  instead of AddEventAsync() for agent outputs
- Add special-casing in InProcessRunnerContext.YieldOutputAsync() to create
  specific event types for AgentResponse and AgentResponseUpdate, bypassing
  OutputFilter for backwards compatibility
- Update TestRunContext and TestWorkflowContext with same special-casing
- Add regression tests in AgentEventsTests
@lokitoth lokitoth force-pushed the dev/dotnet_workflow/unify_agent_response_event_in_output branch from f2093fe to ecc489a Compare January 27, 2026 23:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change Introduces changes that are not backward compatible and may require updates to dependent code. .NET workflows Related to Workflows in agent-framework

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.NET : Agents in Workflow. WorkflowOutputEvent not triggered

2 participants