Skip to content

.NET: [.NET] Unclear how to return Workflow Output as Agent Response #8013

Description

When using the following code

var workflowAsAgent = builder
    .AddWorkflow("science-workflow", (sp, key) => { ... })
    .AddAsAIAgent();  // Now the workflow can be used as an agent

from https://learn.microsoft.com/en-us/agent-framework/get-started/hosting?pivots=programming-language-csharp#expose-workflow-as-aiagent, then the workflow output is not sent back to the user.

E.g. when using it with app.MapOpenAIResponses(); / app.MapOpenAIConversations(); for DevUI, then the final non-streaming/response.completed JSON still has "output": [] even though the SSE stream carries a WorkflowOutputEvent with the full text. That's because AddAsAIAgent() defaults includeWorkflowOutputsInResponse: false; the WorkflowHostAgent only forwards content (not full chat messages) for terminal outputs in that mode, and the OpenAI-Responses mapping in Microsoft.Agents.AI.Hosting doesn't currently promote that content into response.output.

Metadata

Metadata

Assignees

No one assigned

    Labels

    .NETUsage: [Issues, PRs], Target: .NettriageUsage: [Issues], Target: All issues that still need to be triaged

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions