-
Notifications
You must be signed in to change notification settings - Fork 1.1k
.NET: BREAKING: Unify AgentResponse[Update] events as WorkflowOutputEvents
#3441
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
base: main
Are you sure you want to change the base?
.NET: BREAKING: Unify AgentResponse[Update] events as WorkflowOutputEvents
#3441
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 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.SourceIdtoExecutorIdwith obsolete forwarding property for backward compatibility - Changed
AgentResponseUpdateEventandAgentResponseEventto inherit fromWorkflowOutputEventinstead ofExecutorEvent - Updated executors to use
YieldOutputAsync()instead of directly callingAddEventAsync()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 |
2332d2e to
3fe658a
Compare
3fe658a to
42a9908
Compare
42a9908 to
a8f2e72
Compare
a8f2e72 to
f2093fe
Compare
- 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
f2093fe to
ecc489a
Compare
Motivation and Context
The streaming
AgentResponseUpdateand fullAgentResponseevents were added before theWorkflowOutputEventmechanism 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
WorkflowOutputEvent.SourceIdtoWorkflowOutputEvent.ExecutorIdSourceIdforwarding toExecutorIdonWorkflowOutputEventAgentResponseUpdateEventandAgentResponseEventto derive fromWorkflowOutputEventto unify handlingBREAKING CHANGES:
WorkflowOutputEvent.SourceIdtoWorkflowOutputEvent.ExecutorIdContribution Checklist