.NET: AIAgentHostExecutor to use ToAgentRunResponse#1439
.NET: AIAgentHostExecutor to use ToAgentRunResponse#1439TaoChenOSU merged 3 commits intomicrosoft:mainfrom
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the AIAgentHostExecutor to use the ToAgentRunResponse extension method for processing streaming agent updates. The change simplifies the complex manual aggregation logic that was previously used to assemble streaming updates into complete messages.
- Replaces manual message aggregation with a standardized extension method approach
- Simplifies streaming update processing by collecting all updates before transforming them
- Updates corresponding unit tests to reflect the simplified message handling structure
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| AIAgentHostExecutor.cs | Refactored streaming message processing to use ToAgentRunResponse extension method, removing complex manual aggregation logic |
| SpecializedExecutorSmokeTests.cs | Updated test structure to match simplified message handling, removing detailed content splitting verification |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
dotnet/src/Microsoft.Agents.AI.Workflows/Specialized/AIAgentHostExecutor.cs
Outdated
Show resolved
Hide resolved
|
This changes the logic of the resulting joined messages - they lose the initial splits as sent out by the agent in individual updates. We were keeping them around deliberately: I recall that fixing a bug that @crickman had with Declarative Workflows at one point (though the details elude me now). Are we sure this behaviour change will not cause problems? |
Can you elaborate on this? |
Looks like I had outdated info - it used to be that when the AgentRunResponses were merged using the existing method in the AgentFramework they would merge the multiple updates into a single ChatMessage. But it looks like now that is no longer the logic going on. |
dotnet/src/Microsoft.Agents.AI.Workflows/Specialized/AIAgentHostExecutor.cs
Outdated
Show resolved
Hide resolved
dotnet/src/Microsoft.Agents.AI.Workflows/Specialized/AIAgentHostExecutor.cs
Outdated
Show resolved
Hide resolved
* AIAgentHostExecutor to use ToAgentRunResponse * Only run agent in stream mode when emit event is true
* AIAgentHostExecutor to use ToAgentRunResponse * Only run agent in stream mode when emit event is true
Motivation and Context
Addressed #1137
Description
Use the
ToAgentRunResponseextension method to assemble streaming updates into fully-formed updates. This will avoid unintended bugs caused by differences between underlying clients/services driving the agents.Contribution Checklist