Skip to content

Conversation

@TaoChenOSU
Copy link
Contributor

@TaoChenOSU TaoChenOSU commented Oct 13, 2025

Motivation and Context

Addressed #1137

Description

Use the ToAgentRunResponse extension 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

  • 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.

@TaoChenOSU TaoChenOSU self-assigned this Oct 13, 2025
Copilot AI review requested due to automatic review settings October 13, 2025 20:50
@TaoChenOSU TaoChenOSU added .NET workflows Related to Workflows in agent-framework labels Oct 13, 2025
@github-actions github-actions bot changed the title AIAgentHostExecutor to use ToAgentRunResponse .NET: AIAgentHostExecutor to use ToAgentRunResponse Oct 13, 2025
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 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.

@lokitoth
Copy link
Member

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?

@stephentoub
Copy link
Member

they lose the initial splits as sent out by the agent in individual updates.

Can you elaborate on this?

@lokitoth
Copy link
Member

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.

@TaoChenOSU TaoChenOSU enabled auto-merge October 20, 2025 17:47
@TaoChenOSU TaoChenOSU added this pull request to the merge queue Oct 20, 2025
Merged via the queue into microsoft:main with commit 7c1e3db Oct 20, 2025
13 checks passed
@TaoChenOSU TaoChenOSU deleted the taochen/dotnet-use-ToAgentRunResponse branch October 20, 2025 18:04
ReubenBond pushed a commit to ReubenBond/agent-framework that referenced this pull request Oct 28, 2025
* AIAgentHostExecutor to use ToAgentRunResponse

* Only run agent in stream mode when emit event is true
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.

4 participants