diff --git a/dotnet/samples/03-workflows/Observability/WorkflowAsAnAgent/WorkflowHelper.cs b/dotnet/samples/03-workflows/Observability/WorkflowAsAnAgent/WorkflowHelper.cs
index 54e3eb40f2..4db325b658 100644
--- a/dotnet/samples/03-workflows/Observability/WorkflowAsAnAgent/WorkflowHelper.cs
+++ b/dotnet/samples/03-workflows/Observability/WorkflowAsAnAgent/WorkflowHelper.cs
@@ -50,12 +50,16 @@ internal static partial class WorkflowHelper
///
/// Executor that starts the concurrent processing by sending messages to the agents.
///
- private sealed partial class ConcurrentStartExecutor() : Executor("ConcurrentStartExecutor")
+ [SendsMessage(typeof(List))]
+ [SendsMessage(typeof(TurnToken))]
+ private sealed partial class ConcurrentStartExecutor()
+ : Executor("ConcurrentStartExecutor", declareCrossRunShareable: true), IResettableExecutor
{
[MessageHandler]
- internal ValueTask RouteMessages(List messages, IWorkflowContext context, CancellationToken cancellationToken)
+ internal ValueTask RouteMessages(IEnumerable messages, IWorkflowContext context, CancellationToken cancellationToken)
{
- return context.SendMessageAsync(messages, cancellationToken: cancellationToken);
+ List payload = messages as List ?? messages.ToList();
+ return context.SendMessageAsync(payload, cancellationToken: cancellationToken);
}
[MessageHandler]
@@ -63,13 +67,16 @@ internal static partial class WorkflowHelper
{
return context.SendMessageAsync(token, cancellationToken: cancellationToken);
}
+
+ public ValueTask ResetAsync() => default;
}
///
/// Executor that aggregates the results from the concurrent agents.
///
- [YieldsOutput(typeof(List))]
- private sealed partial class ConcurrentAggregationExecutor() : Executor>("ConcurrentAggregationExecutor")
+ [YieldsOutput(typeof(string))]
+ private sealed partial class ConcurrentAggregationExecutor() :
+ Executor>("ConcurrentAggregationExecutor"), IResettableExecutor
{
private readonly List _messages = [];
@@ -90,5 +97,11 @@ internal static partial class WorkflowHelper
await context.YieldOutputAsync(formattedMessages, cancellationToken);
}
}
+
+ public ValueTask ResetAsync()
+ {
+ this._messages.Clear();
+ return default;
+ }
}
}