mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
Concurrent run support was recently added to workflows, but Orchestrations did not fully update to support it. A few executors were missing Cross-Run Shareable annotations, and the ConcurrentEnd executor needed to be factory-instantiated. This also ports the fix for #1613 from #1637, to avoid waiting on that PR.
24 lines
924 B
C#
24 lines
924 B
C#
// Copyright (c) Microsoft. All rights reserved.
|
|
|
|
using System.Collections.Generic;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.Extensions.AI;
|
|
|
|
namespace Microsoft.Agents.AI.Workflows;
|
|
|
|
public static partial class AgentWorkflowBuilder
|
|
{
|
|
/// <summary>
|
|
/// Provides an executor that batches received chat messages that it then publishes as the final result
|
|
/// when receiving a <see cref="TurnToken"/>.
|
|
/// </summary>
|
|
internal sealed class OutputMessagesExecutor() : ChatProtocolExecutor("OutputMessages", declareCrossRunShareable: true), IResettableExecutor
|
|
{
|
|
protected override ValueTask TakeTurnAsync(List<ChatMessage> messages, IWorkflowContext context, bool? emitEvents, CancellationToken cancellationToken = default)
|
|
=> context.YieldOutputAsync(messages, cancellationToken);
|
|
|
|
ValueTask IResettableExecutor.ResetAsync() => default;
|
|
}
|
|
}
|