// Copyright (c) Microsoft. All rights reserved.
using System.Linq;
using System.Threading.Tasks;
using Microsoft.Extensions.AI.Agents;
namespace Microsoft.Agents.Orchestration.Concurrent;
///
/// An orchestration that broadcasts the input message to each agent.
///
public sealed class ConcurrentOrchestration : ConcurrentOrchestration
{
///
/// Initializes a new instance of the class.
///
/// The agents to be orchestrated.
public ConcurrentOrchestration(params Agent[] members)
: base(members)
{
this.ResultTransform =
(response, cancellationToken) =>
{
string[] result = [.. response.Select(r => r.Text)];
#if !NETCOREAPP
return new ValueTask(result);
#else
return ValueTask.FromResult(result);
#endif
};
}
}