Description
In the .NET workflow host, Workflow.AsAIAgent().RunAsync(...) currently merges intermediate agent response updates into the outer AgentResponse.Text even when the workflow explicitly designates a terminal output executor via WithOutputFrom(...).
This makes .NET differ from the Python workflow agent behavior: Python surfaces the designated workflow output as the final agent response, while .NET can return the concatenated text of upstream agents and ignore a terminal non-chat executor output such as string.
Repro shape
ExecutorBinding first = firstAgent.BindAsExecutor(new AIAgentHostOptions { ForwardIncomingMessages = false });
ExecutorBinding second = secondAgent.BindAsExecutor(new AIAgentHostOptions { ForwardIncomingMessages = false });
UppercaseStringExecutor uppercase = new();
Workflow workflow = new WorkflowBuilder(first)
.AddEdge(first, second)
.AddEdge(second, uppercase)
.WithOutputFrom(uppercase)
.Build();
AgentResponse response = await workflow
.AsAIAgent("WorkflowAgent")
.RunAsync(new ChatMessage(ChatRole.User, "hello"));
Expected
The outer agent response should be produced from the designated terminal workflow output, e.g. SECOND ANSWER.
Actual
The outer response can be formed from intermediate agent updates, e.g. first answer\nsecond answer, while the terminal string output is not represented as the final agent response.
Notes
I have a PR that adds a regression test and changes the .NET host response aggregation so terminal workflow outputs win when present, while preserving legacy streaming updates for observers.
Description
In the .NET workflow host,
Workflow.AsAIAgent().RunAsync(...)currently merges intermediate agent response updates into the outerAgentResponse.Texteven when the workflow explicitly designates a terminal output executor viaWithOutputFrom(...).This makes .NET differ from the Python workflow agent behavior: Python surfaces the designated workflow output as the final agent response, while .NET can return the concatenated text of upstream agents and ignore a terminal non-chat executor output such as
string.Repro shape
Expected
The outer agent response should be produced from the designated terminal workflow output, e.g.
SECOND ANSWER.Actual
The outer response can be formed from intermediate agent updates, e.g.
first answer\nsecond answer, while the terminal string output is not represented as the final agent response.Notes
I have a PR that adds a regression test and changes the .NET host response aggregation so terminal workflow outputs win when present, while preserving legacy streaming updates for observers.