.NET: Workflow.AsAIAgent drops a terminal executor's ChatMessage output unless includeWorkflowOutputsInResponse is set
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 66/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- csharp
- Área
- backend-api-design
Línea de trabajo
Empieza en WorkflowSession.cs, en el caso WorkflowOutputEvent, y compara cómo se reenvían updateContents y updateMessages para las salidas del terminal. Reproduce el comportamiento con la aplicación basada en archivos de .NET 1.25.0 proporcionada y comprueba después que un ejecutor de terminal que devuelve List<ChatMessage> transmite su respuesta cuando includeWorkflowOutputsInResponse es false, como ya ocurre en el caso de string.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Description
When a workflow is hosted with Workflow.AsAIAgent(...) and includeWorkflowOutputsInResponse is left at its default (false), an executor designated with WithOutputFrom(...) reaches the agent response only if its output is a string or AIContent. The same executor yielding a ChatMessage or IEnumerable<ChatMessage> produces no update at all: the stream carries only an observability update for the WorkflowOutputEvent.
In WorkflowSession.cs (1.25.0, unchanged on main as of 2026-10-26), the WorkflowOutputEvent case computes includeTerminalOutput = this._workflow.IsTerminalOutput(output.ExecutorId) and then:
- forwards
updateContentswhen_includeWorkflowOutputsInResponse || includeTerminalOutput; - forwards
updateMessagesonly when_includeWorkflowOutputsInResponse.
The comment above that block says response-compatible payloads are forwarded "when the host requests all workflow outputs, or when this executor is an explicit output source for the workflow", so the two branches disagree with it. The same gap was pointed out in an automated review comment on #6212, which introduced the terminal-output path.
Since #8020 the hosted AddAsAIAgent() sets includeWorkflowOutputsInResponse: true, so this shows up only when Workflow.AsAIAgent is called directly, for example to pass an execution environment (#9370).
Steps to reproduce
File-based app (dotnet run repro.cs), Microsoft.Agents.AI.Workflows 1.25.0. The same terminal executor is bound twice, once returning List<ChatMessage> and once returning string, each marked with WithOutputFrom:
#:package [email protected]
#pragma warning disable MAAIW001, MAAI001
using Microsoft.Agents.AI;
using Microsoft.Agents.AI.Workflows;
using Microsoft.Extensions.AI;
static string Last(List<ChatMessage> m) => m.LastOrDefault(x => x.Role == ChatRole.User)?.Text ?? "";
Func<List<ChatMessage>, List<ChatMessage>> asMessages = m => [new(ChatRole.Assistant, $"echo: {Last(m)}")];
Func<List<ChatMessage>, string> asString = m => $"echo: {Last(m)}";
foreach (var (label, answer) in new (string, ExecutorBinding)[]
{
("List<ChatMessage>", asMessages.BindAsExecutor("Answer", threadsafe: true)),
("string", asString.BindAsExecutor("Answer", threadsafe: true)),
})
{
ExecutorBinding start = new Start();
var workflow = new WorkflowBuilder(start).AddEdge(start, answer).WithOutputFrom(answer).Build();
var agent = workflow.AsAIAgent(name: "repro");
var text = "";
await foreach (var u in agent.RunStreamingAsync("hi")) text += u.Text;
Console.WriteLine($"{label,-18} streamed text: \"{text}\"");
}
sealed class Start() : ChatProtocolExecutor("Start", new ChatProtocolExecutorOptions { AutoSendTurnToken = false })
{
protected override ValueTask TakeTurnAsync(List<ChatMessage> messages, IWorkflowContext context, bool? emitEvents, CancellationToken cancellationToken = default)
=> context.SendMessageAsync(messages, cancellationToken);
}
Actual behavior
List<ChatMessage> streamed text: ""
string streamed text: "echo: hi"
In our app (behind the AG-UI server) a branch that answered with a List<ChatMessage> reached the client as RUN_STARTED followed directly by RUN_FINISHED, with no text message, so the user saw an empty reply.
Expected behavior
An executor designated with WithOutputFrom(...) reaches the agent response whatever its payload type, a ChatMessage or a list of them included, as its string and AIContent outputs already do.
Versions
- Microsoft.Agents.AI.Workflows 1.25.0 (.NET 10)
- Same code path on
main(commit at time of writing)
- Lenguaje dominante
- Python
- Estrellas
- 14.3k
- Forks
- 2.5k
- Merge medio
- 2 d 16 h
- PR fusionados (30 d)
- 383
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de microsoft/agent-framework
-
Python: [Bug]: native Windows --files paths skip changed-package tasksPosiblemente ocupada @leilei3167 la tomó hace 1 día. Abiertoneeds-maintainer-triage python triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
microsoft/agent-framework#9742 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
Python: FileSessionStore.set fails on Windows for long session IDs because its temp file name is 38 characters longer than the snapshotPosiblemente ocupada @Sonica-B la tomó hace 2 días. Abiertopython ready-for-implementation
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
microsoft/agent-framework#9682 · 2 asignados ·
Los mantenedores suelen responder en 1 día
-
Python: foundry-hosting drops request `metadata` from the stored response — `_create_response_event_stream` never passes `request` to `ResponseEventStream`Posiblemente ocupada @its-amann la tomó hace 2 días. Abiertopython triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
microsoft/agent-framework#9529 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
.NET: Proposal: add an llms.txtAbierto.NET python triage
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
microsoft/agent-framework#9092 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Python: raw-data content mappings lose annotations and attachment metadataQuizá libre de nuevo @moonbox3 la tomó hace 28 días y no hay ningún pull request abierto. Abiertopython triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
microsoft/agent-framework#8632 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
Todos los issues de microsoft/agent-framework
Issues similares
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 72/100
521xueweihan/HelloGitHub#4150 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
aws-samples/sample-per-model-bedrock#595 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día
-
bug connectors
Dificultad 1/5 Menos de una hora Aptitud para principiantes 67/100
pyinfra-dev/pyinfra#2036 ·
Los mantenedores suelen responder en 9 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día