Skip to content

.NET: Workflow Host-as-Agent can improperly reorder messages in history and when running non-streaming #5720

@lokitoth

Description

@lokitoth

When using a Workflow with tool calls and responses wrapped in .AsAgent(), outgoing messages are topologically sorted and merged using the MessageMerger. This does not behave correctly in the presence of ToolCalls/Responses in Handoff workflows, resulting in unexpected message ordering.

This is somewhat hidden when running using WorkflowHostAgent.RunStreamingAsync() because the outgoing enumeration yields the events in raw order, rather than in merged order. History still uses merged order, and this is directly visible when running using WorkflowHostAgent.RunAsync()

Metadata

Metadata

Assignees

Labels

.NETworkflowsRelated to Workflows in agent-framework

Type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions