Skip to content

.NET: Pass through external input request and handle response conversion for workflow as agent scenario#4361

Open
peibekwe wants to merge 6 commits intomainfrom
peibekwe/workflow-asagent-fix
Open

.NET: Pass through external input request and handle response conversion for workflow as agent scenario#4361
peibekwe wants to merge 6 commits intomainfrom
peibekwe/workflow-asagent-fix

Conversation

@peibekwe
Copy link
Contributor

Description

This PR handles external input request for non-Function call contents the right way and also fixes issue with external input response conversion from checkpoints.

Fixes #3029

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.

@peibekwe peibekwe self-assigned this Feb 27, 2026
@markwallace-microsoft markwallace-microsoft added .NET workflows Related to Workflows in agent-framework labels Feb 27, 2026
@github-actions github-actions bot changed the title Pass through external input request and handle response conversion for workflow as agent scenario .NET: Pass through external input request and handle response conversion for workflow as agent scenario Feb 27, 2026
@peibekwe peibekwe requested review from alliscode and lokitoth March 2, 2026 20:47
@peibekwe peibekwe marked this pull request as ready for review March 2, 2026 21:24
Copilot AI review requested due to automatic review settings March 2, 2026 21:24
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 improves the “workflow as agent” experience in the .NET workflows layer by preserving the original external-request content types (instead of always converting to FunctionCallContent) and enabling inbound external responses to be correctly converted back into ExternalResponse during workflow resume from checkpoints.

Changes:

  • Preserve original FunctionCallContent / UserInputRequestContent when emitting RequestInfoEvent updates to callers.
  • Track pending external requests in WorkflowSession.StateBag and convert inbound FunctionResultContent / UserInputResponseContent into ExternalResponse when resuming a run.
  • Add unit tests covering preservation of request content types and basic request/response roundtrip acceptance.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
dotnet/src/Microsoft.Agents.AI.Workflows/WorkflowSession.cs Tracks pending requests and converts inbound response contents into ExternalResponse on resume; preserves original request content type in streamed updates.
dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/WorkflowHostSmokeTests.cs Adds tests to validate content-type preservation and roundtrip response processing behavior.

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

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

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 Workflows - Workflow as Agent how to respond to external input requests

3 participants