diff --git a/dotnet/samples/GettingStarted/Workflows/Agents/FoundryAgent/Program.cs b/dotnet/samples/GettingStarted/Workflows/Agents/FoundryAgent/Program.cs index 9f1de87438..35809685ea 100644 --- a/dotnet/samples/GettingStarted/Workflows/Agents/FoundryAgent/Program.cs +++ b/dotnet/samples/GettingStarted/Workflows/Agents/FoundryAgent/Program.cs @@ -45,7 +45,7 @@ private static async Task Main() await run.TrySendMessageAsync(new TurnToken(emitEvents: true)); await foreach (WorkflowEvent evt in run.WatchStreamAsync()) { - if (evt is AgentRunUpdateEvent executorComplete) + if (evt is AgentResponseUpdateEvent executorComplete) { Console.WriteLine($"{executorComplete.ExecutorId}: {executorComplete.Data}"); } diff --git a/dotnet/samples/GettingStarted/Workflows/Declarative/ExecuteCode/Generated.cs b/dotnet/samples/GettingStarted/Workflows/Declarative/ExecuteCode/Generated.cs index 6b46ca1027..49a6ced2b7 100644 --- a/dotnet/samples/GettingStarted/Workflows/Declarative/ExecuteCode/Generated.cs +++ b/dotnet/samples/GettingStarted/Workflows/Declarative/ExecuteCode/Generated.cs @@ -76,7 +76,7 @@ await InvokeAgentAsync( if (autoSend) { - await context.AddEventAsync(new AgentRunResponseEvent(this.Id, agentResponse)).ConfigureAwait(false); + await context.AddEventAsync(new AgentResponseEvent(this.Id, agentResponse)).ConfigureAwait(false); } return default; @@ -113,7 +113,7 @@ await InvokeAgentAsync( if (autoSend) { - await context.AddEventAsync(new AgentRunResponseEvent(this.Id, agentResponse)).ConfigureAwait(false); + await context.AddEventAsync(new AgentResponseEvent(this.Id, agentResponse)).ConfigureAwait(false); } await context.QueueStateUpdateAsync(key: "TeacherResponse", value: agentResponse.Messages, scopeName: "Local").ConfigureAwait(false); @@ -176,7 +176,7 @@ GOLD STAR! """ ); AgentResponse response = new([new ChatMessage(ChatRole.Assistant, activityText)]); - await context.AddEventAsync(new AgentRunResponseEvent(this.Id, response)).ConfigureAwait(false); + await context.AddEventAsync(new AgentResponseEvent(this.Id, response)).ConfigureAwait(false); return default; } @@ -197,7 +197,7 @@ await context.FormatTemplateAsync( """ ); AgentResponse response = new([new ChatMessage(ChatRole.Assistant, activityText)]); - await context.AddEventAsync(new AgentRunResponseEvent(this.Id, response)).ConfigureAwait(false); + await context.AddEventAsync(new AgentResponseEvent(this.Id, response)).ConfigureAwait(false); return default; } diff --git a/dotnet/samples/GettingStarted/Workflows/_Foundational/03_AgentsInWorkflows/Program.cs b/dotnet/samples/GettingStarted/Workflows/_Foundational/03_AgentsInWorkflows/Program.cs index 0a8ee0d6ee..4e61b5def6 100644 --- a/dotnet/samples/GettingStarted/Workflows/_Foundational/03_AgentsInWorkflows/Program.cs +++ b/dotnet/samples/GettingStarted/Workflows/_Foundational/03_AgentsInWorkflows/Program.cs @@ -52,7 +52,7 @@ private static async Task Main() await run.TrySendMessageAsync(new TurnToken(emitEvents: true)); await foreach (WorkflowEvent evt in run.WatchStreamAsync()) { - if (evt is AgentRunUpdateEvent executorComplete) + if (evt is AgentResponseUpdateEvent executorComplete) { Console.WriteLine($"{executorComplete.ExecutorId}: {executorComplete.Data}"); } diff --git a/dotnet/samples/GettingStarted/Workflows/_Foundational/04_AgentWorkflowPatterns/Program.cs b/dotnet/samples/GettingStarted/Workflows/_Foundational/04_AgentWorkflowPatterns/Program.cs index 1fa3aabb5c..225f11b59a 100644 --- a/dotnet/samples/GettingStarted/Workflows/_Foundational/04_AgentWorkflowPatterns/Program.cs +++ b/dotnet/samples/GettingStarted/Workflows/_Foundational/04_AgentWorkflowPatterns/Program.cs @@ -88,7 +88,7 @@ static async Task> RunWorkflowAsync(Workflow workflow, ListExecutor(FormulaSession session, WorkflowA if (autoSend) { - await context.AddEventAsync(new AgentRunResponseEvent(this.Id, agentResponse)).ConfigureAwait(false); + await context.AddEventAsync(new AgentResponseEvent(this.Id, agentResponse)).ConfigureAwait(false); } <# AssignVariable(this.Messages, "agentResponse.Messages"); #> diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/SendActivityTemplate.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/SendActivityTemplate.cs index 6cc1cdb435..b7b6724069 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/SendActivityTemplate.cs +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/SendActivityTemplate.cs @@ -72,7 +72,7 @@ public override string TransformText() } this.Write("\n );\n AgentResponse response = new([new ChatMessage(ChatRole" + - ".Assistant, activityText)]);\n await context.AddEventAsync(new AgentRunRes" + + ".Assistant, activityText)]);\n await context.AddEventAsync(new AgentRes" + "ponseEvent(this.Id, response)).ConfigureAwait(false);"); } diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/SendActivityTemplate.tt b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/SendActivityTemplate.tt index 7d247faf44..f11d2181b4 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/SendActivityTemplate.tt +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/SendActivityTemplate.tt @@ -26,7 +26,7 @@ if (this.Model.Activity is MessageActivityTemplate messageActivity) #> ); AgentResponse response = new([new ChatMessage(ChatRole.Assistant, activityText)]); - await context.AddEventAsync(new AgentRunResponseEvent(this.Id, response)).ConfigureAwait(false);<# + await context.AddEventAsync(new AgentResponseEvent(this.Id, response)).ConfigureAwait(false);<# } #> return default; diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Extensions/AgentProviderExtensions.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Extensions/AgentProviderExtensions.cs index d82febb2a8..19dd4aae75 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Extensions/AgentProviderExtensions.cs +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Extensions/AgentProviderExtensions.cs @@ -36,7 +36,7 @@ public static async ValueTask InvokeAgentAsync( if (autoSend) { - await context.AddEventAsync(new AgentRunUpdateEvent(executorId, update), cancellationToken).ConfigureAwait(false); + await context.AddEventAsync(new AgentResponseUpdateEvent(executorId, update), cancellationToken).ConfigureAwait(false); } } @@ -44,7 +44,7 @@ public static async ValueTask InvokeAgentAsync( if (autoSend) { - await context.AddEventAsync(new AgentRunResponseEvent(executorId, response), cancellationToken).ConfigureAwait(false); + await context.AddEventAsync(new AgentResponseEvent(executorId, response), cancellationToken).ConfigureAwait(false); } // If autoSend is enabled and this is not the workflow conversation, copy messages to the workflow conversation. diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/ObjectModel/AddConversationMessageExecutor.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/ObjectModel/AddConversationMessageExecutor.cs index fa7d304454..922a3f61b1 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/ObjectModel/AddConversationMessageExecutor.cs +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/ObjectModel/AddConversationMessageExecutor.cs @@ -30,7 +30,7 @@ internal sealed class AddConversationMessageExecutor(AddConversationMessage mode if (isWorkflowConversation) { - await context.AddEventAsync(new AgentRunResponseEvent(this.Id, new AgentResponse(newMessage)), cancellationToken).ConfigureAwait(false); + await context.AddEventAsync(new AgentResponseEvent(this.Id, new AgentResponse(newMessage)), cancellationToken).ConfigureAwait(false); } return default; diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/ObjectModel/CopyConversationMessagesExecutor.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/ObjectModel/CopyConversationMessagesExecutor.cs index b43d388da8..2d27408645 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/ObjectModel/CopyConversationMessagesExecutor.cs +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/ObjectModel/CopyConversationMessagesExecutor.cs @@ -33,7 +33,7 @@ internal sealed class CopyConversationMessagesExecutor(CopyConversationMessages if (isWorkflowConversation) { - await context.AddEventAsync(new AgentRunResponseEvent(this.Id, new AgentResponse([.. inputMessages])), cancellationToken).ConfigureAwait(false); + await context.AddEventAsync(new AgentResponseEvent(this.Id, new AgentResponse([.. inputMessages])), cancellationToken).ConfigureAwait(false); } } diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows/AgentRunResponseEvent.cs b/dotnet/src/Microsoft.Agents.AI.Workflows/AgentResponseEvent.cs similarity index 51% rename from dotnet/src/Microsoft.Agents.AI.Workflows/AgentRunResponseEvent.cs rename to dotnet/src/Microsoft.Agents.AI.Workflows/AgentResponseEvent.cs index f3bc6834c2..a6c0b22525 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows/AgentRunResponseEvent.cs +++ b/dotnet/src/Microsoft.Agents.AI.Workflows/AgentResponseEvent.cs @@ -5,22 +5,22 @@ namespace Microsoft.Agents.AI.Workflows; /// -/// Represents an event triggered when an agent run produces an update. +/// Represents an event triggered when an agent produces a response. /// -public class AgentRunResponseEvent : ExecutorEvent +public class AgentResponseEvent : ExecutorEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The identifier of the executor that generated this event. - /// The agent run response. - public AgentRunResponseEvent(string executorId, AgentResponse response) : base(executorId, data: response) + /// The agent response. + public AgentResponseEvent(string executorId, AgentResponse response) : base(executorId, data: response) { this.Response = Throw.IfNull(response); } /// - /// Gets the agent run response. + /// Gets the agent response. /// public AgentResponse Response { get; } } diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows/AgentRunUpdateEvent.cs b/dotnet/src/Microsoft.Agents.AI.Workflows/AgentResponseUpdateEvent.cs similarity index 79% rename from dotnet/src/Microsoft.Agents.AI.Workflows/AgentRunUpdateEvent.cs rename to dotnet/src/Microsoft.Agents.AI.Workflows/AgentResponseUpdateEvent.cs index 34a8d52ab8..939e7a67e8 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows/AgentRunUpdateEvent.cs +++ b/dotnet/src/Microsoft.Agents.AI.Workflows/AgentResponseUpdateEvent.cs @@ -8,14 +8,14 @@ namespace Microsoft.Agents.AI.Workflows; /// /// Represents an event triggered when an agent run produces an update. /// -public class AgentRunUpdateEvent : ExecutorEvent +public class AgentResponseUpdateEvent : ExecutorEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The identifier of the executor that generated this event. /// The agent run response update. - public AgentRunUpdateEvent(string executorId, AgentResponseUpdate update) : base(executorId, data: update) + public AgentResponseUpdateEvent(string executorId, AgentResponseUpdate update) : base(executorId, data: update) { this.Update = Throw.IfNull(update); } diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows/Specialized/AIAgentHostExecutor.cs b/dotnet/src/Microsoft.Agents.AI.Workflows/Specialized/AIAgentHostExecutor.cs index 3a344933f9..42217ce7bc 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows/Specialized/AIAgentHostExecutor.cs +++ b/dotnet/src/Microsoft.Agents.AI.Workflows/Specialized/AIAgentHostExecutor.cs @@ -63,7 +63,7 @@ await this.EnsureThreadAsync(context, cancellationToken).ConfigureAwait(false), await foreach (AgentResponseUpdate update in agentStream.ConfigureAwait(false)) { - await context.AddEventAsync(new AgentRunUpdateEvent(this.Id, update), cancellationToken).ConfigureAwait(false); + await context.AddEventAsync(new AgentResponseUpdateEvent(this.Id, update), cancellationToken).ConfigureAwait(false); // TODO: FunctionCall request handling, and user info request handling. // In some sense: We should just let it be handled as a ChatMessage, though we should consider diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows/Specialized/AgentRunStreamingExecutor.cs b/dotnet/src/Microsoft.Agents.AI.Workflows/Specialized/AgentRunStreamingExecutor.cs index 03a3432ee0..e28870729c 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows/Specialized/AgentRunStreamingExecutor.cs +++ b/dotnet/src/Microsoft.Agents.AI.Workflows/Specialized/AgentRunStreamingExecutor.cs @@ -28,7 +28,7 @@ protected override async ValueTask TakeTurnAsync(List messages, IWo updates.Add(update); if (emitEvents is true) { - await context.AddEventAsync(new AgentRunUpdateEvent(this.Id, update), cancellationToken).ConfigureAwait(false); + await context.AddEventAsync(new AgentResponseUpdateEvent(this.Id, update), cancellationToken).ConfigureAwait(false); } } diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows/Specialized/HandoffAgentExecutor.cs b/dotnet/src/Microsoft.Agents.AI.Workflows/Specialized/HandoffAgentExecutor.cs index e703275972..8c608090f3 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows/Specialized/HandoffAgentExecutor.cs +++ b/dotnet/src/Microsoft.Agents.AI.Workflows/Specialized/HandoffAgentExecutor.cs @@ -109,7 +109,7 @@ async Task AddUpdateAsync(AgentResponseUpdate update, CancellationToken cancella updates.Add(update); if (handoffState.TurnToken.EmitEvents is true) { - await context.AddEventAsync(new AgentRunUpdateEvent(this.Id, update), cancellationToken).ConfigureAwait(false); + await context.AddEventAsync(new AgentResponseUpdateEvent(this.Id, update), cancellationToken).ConfigureAwait(false); } } }); diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows/WorkflowThread.cs b/dotnet/src/Microsoft.Agents.AI.Workflows/WorkflowThread.cs index 6bd41ecadb..6f00566b95 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows/WorkflowThread.cs +++ b/dotnet/src/Microsoft.Agents.AI.Workflows/WorkflowThread.cs @@ -151,7 +151,7 @@ IAsyncEnumerable InvokeStageAsync( { switch (evt) { - case AgentRunUpdateEvent agentUpdate: + case AgentResponseUpdateEvent agentUpdate: yield return agentUpdate.Update; break; diff --git a/dotnet/src/Shared/Workflows/Execution/WorkflowRunner.cs b/dotnet/src/Shared/Workflows/Execution/WorkflowRunner.cs index d82bc800bb..b8666451f6 100644 --- a/dotnet/src/Shared/Workflows/Execution/WorkflowRunner.cs +++ b/dotnet/src/Shared/Workflows/Execution/WorkflowRunner.cs @@ -177,7 +177,7 @@ public async Task ExecuteAsync(Func workflowProvider, string input) Console.ResetColor(); break; - case AgentRunUpdateEvent streamEvent: + case AgentResponseUpdateEvent streamEvent: if (!string.Equals(messageId, streamEvent.Update.MessageId, StringComparison.Ordinal)) { hasStreamed = false; @@ -230,7 +230,7 @@ public async Task ExecuteAsync(Func workflowProvider, string input) } break; - case AgentRunResponseEvent messageEvent: + case AgentResponseEvent messageEvent: try { if (hasStreamed) diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests/Framework/WorkflowEvents.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests/Framework/WorkflowEvents.cs index a9f1789449..0cf044e02e 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests/Framework/WorkflowEvents.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests/Framework/WorkflowEvents.cs @@ -18,7 +18,7 @@ public WorkflowEvents(IReadOnlyList workflowEvents) this.ExecutorInvokeEvents = workflowEvents.OfType().ToList(); this.ExecutorCompleteEvents = workflowEvents.OfType().ToList(); this.InputEvents = workflowEvents.OfType().ToList(); - this.AgentResponseEvents = workflowEvents.OfType().ToList(); + this.AgentResponseEvents = workflowEvents.OfType().ToList(); } public IReadOnlyList Events { get; } @@ -29,5 +29,5 @@ public WorkflowEvents(IReadOnlyList workflowEvents) public IReadOnlyList ExecutorInvokeEvents { get; } public IReadOnlyList ExecutorCompleteEvents { get; } public IReadOnlyList InputEvents { get; } - public IReadOnlyList AgentResponseEvents { get; } + public IReadOnlyList AgentResponseEvents { get; } } diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests/Framework/WorkflowHarness.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests/Framework/WorkflowHarness.cs index ed3e0367f7..afd9b18fb9 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests/Framework/WorkflowHarness.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests/Framework/WorkflowHarness.cs @@ -142,7 +142,7 @@ private static async IAsyncEnumerable MonitorAndDisposeWorkflowRu Console.WriteLine($"ACTION: {actionInvokeEvent.ActionId} [{actionInvokeEvent.ActionType}]"); break; - case AgentRunResponseEvent responseEvent: + case AgentResponseEvent responseEvent: if (!string.IsNullOrEmpty(responseEvent.Response.Text)) { Console.WriteLine($"AGENT: {responseEvent.Response.AgentId}: {responseEvent.Response.Text}"); diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests/Framework/WorkflowTest.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests/Framework/WorkflowTest.cs index 3649355182..20cc823553 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests/Framework/WorkflowTest.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests/Framework/WorkflowTest.cs @@ -124,7 +124,7 @@ public static void EventCounts(int actualCount, Testcase testcase, bool isComple } } - public static void Responses(IReadOnlyList responseEvents, Testcase testcase) + public static void Responses(IReadOnlyList responseEvents, Testcase testcase) { Assert.True(responseEvents.Count >= testcase.Validation.MinResponseCount, $"Response count less than expected: {testcase.Validation.MinResponseCount} (Actual: {responseEvents.Count})"); if (testcase.Validation.MaxResponseCount != -1) diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests/MediaInputTest.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests/MediaInputTest.cs index d5976a3174..ae3cdfd7a9 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests/MediaInputTest.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests/MediaInputTest.cs @@ -84,7 +84,7 @@ private async Task ValidateFileAsync(AIContent fileContent) WorkflowEvents workflowEvents = await harness.RunWorkflowAsync(inputMessage).ConfigureAwait(false); ConversationUpdateEvent conversationEvent = Assert.Single(workflowEvents.ConversationEvents); this.Output.WriteLine("CONVERSATION: " + conversationEvent.ConversationId); - AgentRunResponseEvent agentResponseEvent = Assert.Single(workflowEvents.AgentResponseEvents); + AgentResponseEvent agentResponseEvent = Assert.Single(workflowEvents.AgentResponseEvents); this.Output.WriteLine("RESPONSE: " + agentResponseEvent.Response.Text); Assert.NotEmpty(agentResponseEvent.Response.Text); } diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/DeclarativeWorkflowTest.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/DeclarativeWorkflowTest.cs index d606770ff8..cef0c7aeea 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/DeclarativeWorkflowTest.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/DeclarativeWorkflowTest.cs @@ -352,7 +352,7 @@ private async Task RunWorkflowAsync(string workflowPath, TInput workflow this.Output.WriteLine($"ACTIVITY: {activityEvent.Message}"); break; - case AgentRunResponseEvent messageEvent: + case AgentResponseEvent messageEvent: this.Output.WriteLine($"MESSAGE: {messageEvent.Response.Messages[0].Text.Trim()}"); break; diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/CancelWorkflow.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/CancelWorkflow.cs index 0bf1ce343a..d407be3ae1 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/CancelWorkflow.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/CancelWorkflow.cs @@ -61,7 +61,7 @@ NEVER 1! """ ); AgentResponse response = new([new ChatMessage(ChatRole.Assistant, activityText)]); - await context.AddEventAsync(new AgentRunResponseEvent(this.Id, response)).ConfigureAwait(false); + await context.AddEventAsync(new AgentResponseEvent(this.Id, response)).ConfigureAwait(false); return default; } diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/Condition.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/Condition.cs index 709dccc81e..3dfa7b4f68 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/Condition.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/Condition.cs @@ -1,4 +1,4 @@ -// ------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ // // This code was generated by a tool. // @@ -47,7 +47,7 @@ protected override async ValueTask ExecuteAsync(TInput message, IWorkflowContext await context.QueueStateUpdateAsync("TestValue", UnassignedValue.Instance, "Local").ConfigureAwait(false); } } - + /// /// Assigns an evaluated expression, other variable, or literal value to the "Local.TestValue" variable. /// @@ -58,11 +58,11 @@ internal sealed class SetvariableTestExecutor(FormulaSession session) : ActionEx { object? evaluatedValue = await context.EvaluateValueAsync("Value(System.LastMessageText)").ConfigureAwait(false); await context.QueueStateUpdateAsync(key: "TestValue", value: evaluatedValue, scopeName: "Local").ConfigureAwait(false); - + return default; } } - + /// /// Conditional branching similar to an if / elseif / elseif / else chain. /// @@ -76,17 +76,17 @@ internal sealed class ConditiongroupTestExecutor(FormulaSession session) : Actio { return "conditionItem_odd"; } - + bool condition1 = await context.EvaluateValueAsync("Mod(Local.TestValue, 2) = 0").ConfigureAwait(false); if (condition1) { return "conditionItem_even"; } - + return "conditionGroup_testElseActions"; } } - + /// /// Formats a message template and sends an activity event. /// @@ -102,12 +102,12 @@ await context.FormatTemplateAsync( """ ); AgentResponse response = new([new ChatMessage(ChatRole.Assistant, activityText)]); - await context.AddEventAsync(new AgentRunResponseEvent(this.Id, response)).ConfigureAwait(false); - + await context.AddEventAsync(new AgentResponseEvent(this.Id, response)).ConfigureAwait(false); + return default; } } - + /// /// Formats a message template and sends an activity event. /// @@ -123,12 +123,12 @@ await context.FormatTemplateAsync( """ ); AgentResponse response = new([new ChatMessage(ChatRole.Assistant, activityText)]); - await context.AddEventAsync(new AgentRunResponseEvent(this.Id, response)).ConfigureAwait(false); - + await context.AddEventAsync(new AgentResponseEvent(this.Id, response)).ConfigureAwait(false); + return default; } } - + /// /// Formats a message template and sends an activity event. /// @@ -144,15 +144,15 @@ All done! """ ); AgentResponse response = new([new ChatMessage(ChatRole.Assistant, activityText)]); - await context.AddEventAsync(new AgentRunResponseEvent(this.Id, response)).ConfigureAwait(false); - + await context.AddEventAsync(new AgentResponseEvent(this.Id, response)).ConfigureAwait(false); + return default; } } - + public static Workflow CreateWorkflow( DeclarativeWorkflowOptions options, - Func? inputTransform = null) + Func? inputTransform = null) where TInput : notnull { // Create root executor to initialize the workflow. @@ -198,4 +198,4 @@ public static Workflow CreateWorkflow( // Build the workflow return builder.Build(validateOrphans: false); } -} \ No newline at end of file +} diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/ConditionElse.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/ConditionElse.cs index 0abc378e5b..2f64bdd3e5 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/ConditionElse.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/ConditionElse.cs @@ -1,4 +1,4 @@ -// ------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ // // This code was generated by a tool. // @@ -47,7 +47,7 @@ protected override async ValueTask ExecuteAsync(TInput message, IWorkflowContext await context.QueueStateUpdateAsync("TestValue", UnassignedValue.Instance, "Local").ConfigureAwait(false); } } - + /// /// Assigns an evaluated expression, other variable, or literal value to the "Local.TestValue" variable. /// @@ -58,11 +58,11 @@ internal sealed class SetvariableTestExecutor(FormulaSession session) : ActionEx { object? evaluatedValue = await context.EvaluateValueAsync("Value(System.LastMessageText)").ConfigureAwait(false); await context.QueueStateUpdateAsync(key: "TestValue", value: evaluatedValue, scopeName: "Local").ConfigureAwait(false); - + return default; } } - + /// /// Conditional branching similar to an if / elseif / elseif / else chain. /// @@ -76,11 +76,11 @@ internal sealed class ConditiongroupTestExecutor(FormulaSession session) : Actio { return "conditionItem_odd"; } - + return "conditionGroup_testElseActions"; } } - + /// /// Formats a message template and sends an activity event. /// @@ -96,12 +96,12 @@ await context.FormatTemplateAsync( """ ); AgentResponse response = new([new ChatMessage(ChatRole.Assistant, activityText)]); - await context.AddEventAsync(new AgentRunResponseEvent(this.Id, response)).ConfigureAwait(false); - + await context.AddEventAsync(new AgentResponseEvent(this.Id, response)).ConfigureAwait(false); + return default; } } - + /// /// Formats a message template and sends an activity event. /// @@ -117,12 +117,12 @@ await context.FormatTemplateAsync( """ ); AgentResponse response = new([new ChatMessage(ChatRole.Assistant, activityText)]); - await context.AddEventAsync(new AgentRunResponseEvent(this.Id, response)).ConfigureAwait(false); - + await context.AddEventAsync(new AgentResponseEvent(this.Id, response)).ConfigureAwait(false); + return default; } } - + /// /// Formats a message template and sends an activity event. /// @@ -138,15 +138,15 @@ All done! """ ); AgentResponse response = new([new ChatMessage(ChatRole.Assistant, activityText)]); - await context.AddEventAsync(new AgentRunResponseEvent(this.Id, response)).ConfigureAwait(false); - + await context.AddEventAsync(new AgentResponseEvent(this.Id, response)).ConfigureAwait(false); + return default; } } - + public static Workflow CreateWorkflow( DeclarativeWorkflowOptions options, - Func? inputTransform = null) + Func? inputTransform = null) where TInput : notnull { // Create root executor to initialize the workflow. @@ -190,4 +190,4 @@ public static Workflow CreateWorkflow( // Build the workflow return builder.Build(validateOrphans: false); } -} \ No newline at end of file +} diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/EndConversation.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/EndConversation.cs index 0bf1ce343a..d407be3ae1 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/EndConversation.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/EndConversation.cs @@ -61,7 +61,7 @@ NEVER 1! """ ); AgentResponse response = new([new ChatMessage(ChatRole.Assistant, activityText)]); - await context.AddEventAsync(new AgentRunResponseEvent(this.Id, response)).ConfigureAwait(false); + await context.AddEventAsync(new AgentResponseEvent(this.Id, response)).ConfigureAwait(false); return default; } diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/EndWorkflow.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/EndWorkflow.cs index d4d89ccfa2..d407be3ae1 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/EndWorkflow.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/EndWorkflow.cs @@ -1,4 +1,4 @@ -// ------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ // // This code was generated by a tool. // @@ -61,7 +61,7 @@ NEVER 1! """ ); AgentResponse response = new([new ChatMessage(ChatRole.Assistant, activityText)]); - await context.AddEventAsync(new AgentRunResponseEvent(this.Id, response)).ConfigureAwait(false); + await context.AddEventAsync(new AgentResponseEvent(this.Id, response)).ConfigureAwait(false); return default; } @@ -91,4 +91,4 @@ public static Workflow CreateWorkflow( // Build the workflow return builder.Build(validateOrphans: false); } -} \ No newline at end of file +} diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/Goto.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/Goto.cs index 14e2145a43..d8413387c9 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/Goto.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/Goto.cs @@ -61,7 +61,7 @@ NEVER 1! """ ); AgentResponse response = new([new ChatMessage(ChatRole.Assistant, activityText)]); - await context.AddEventAsync(new AgentRunResponseEvent(this.Id, response)).ConfigureAwait(false); + await context.AddEventAsync(new AgentResponseEvent(this.Id, response)).ConfigureAwait(false); return default; } @@ -82,7 +82,7 @@ NEVER 2! """ ); AgentResponse response = new([new ChatMessage(ChatRole.Assistant, activityText)]); - await context.AddEventAsync(new AgentRunResponseEvent(this.Id, response)).ConfigureAwait(false); + await context.AddEventAsync(new AgentResponseEvent(this.Id, response)).ConfigureAwait(false); return default; } @@ -103,7 +103,7 @@ NEVER 3! """ ); AgentResponse response = new([new ChatMessage(ChatRole.Assistant, activityText)]); - await context.AddEventAsync(new AgentRunResponseEvent(this.Id, response)).ConfigureAwait(false); + await context.AddEventAsync(new AgentResponseEvent(this.Id, response)).ConfigureAwait(false); return default; } diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/InvokeAgent.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/InvokeAgent.cs index 5305c0643a..08002d16fb 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/InvokeAgent.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/InvokeAgent.cs @@ -81,7 +81,7 @@ await InvokeAgentAsync( if (autoSend) { - await context.AddEventAsync(new AgentRunResponseEvent(this.Id, agentResponse)).ConfigureAwait(false); + await context.AddEventAsync(new AgentResponseEvent(this.Id, agentResponse)).ConfigureAwait(false); } return default; diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/LoopBreak.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/LoopBreak.cs index 101d448746..f4ee656e0c 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/LoopBreak.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/LoopBreak.cs @@ -136,7 +136,7 @@ await context.FormatTemplateAsync( """ ); AgentResponse response = new([new ChatMessage(ChatRole.Assistant, activityText)]); - await context.AddEventAsync(new AgentRunResponseEvent(this.Id, response)).ConfigureAwait(false); + await context.AddEventAsync(new AgentResponseEvent(this.Id, response)).ConfigureAwait(false); return default; } diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/LoopContinue.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/LoopContinue.cs index 1cc056e647..474d69e7ed 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/LoopContinue.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/LoopContinue.cs @@ -136,7 +136,7 @@ await context.FormatTemplateAsync( """ ); AgentResponse response = new([new ChatMessage(ChatRole.Assistant, activityText)]); - await context.AddEventAsync(new AgentRunResponseEvent(this.Id, response)).ConfigureAwait(false); + await context.AddEventAsync(new AgentResponseEvent(this.Id, response)).ConfigureAwait(false); return default; } diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/LoopEach.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/LoopEach.cs index fba77afff5..06137f222d 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/LoopEach.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/LoopEach.cs @@ -136,7 +136,7 @@ await context.FormatTemplateAsync( """ ); AgentResponse response = new([new ChatMessage(ChatRole.Assistant, activityText)]); - await context.AddEventAsync(new AgentRunResponseEvent(this.Id, response)).ConfigureAwait(false); + await context.AddEventAsync(new AgentResponseEvent(this.Id, response)).ConfigureAwait(false); return default; } diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/SendActivity.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/SendActivity.cs index d065bcb3c8..05cd29c574 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/SendActivity.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Workflows/SendActivity.cs @@ -78,7 +78,7 @@ await context.FormatTemplateAsync( """ ); AgentResponse response = new([new ChatMessage(ChatRole.Assistant, activityText)]); - await context.AddEventAsync(new AgentRunResponseEvent(this.Id, response)).ConfigureAwait(false); + await context.AddEventAsync(new AgentResponseEvent(this.Id, response)).ConfigureAwait(false); return default; } diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/AgentWorkflowBuilderTests.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/AgentWorkflowBuilderTests.cs index da62a7a97c..4ed540c34d 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/AgentWorkflowBuilderTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/AgentWorkflowBuilderTests.cs @@ -393,7 +393,7 @@ public async Task BuildGroupChat_AgentsRunInOrderAsync(int maxIterations) WorkflowOutputEvent? output = null; await foreach (WorkflowEvent evt in run.WatchStreamAsync().ConfigureAwait(false)) { - if (evt is AgentRunUpdateEvent executorComplete) + if (evt is AgentResponseUpdateEvent executorComplete) { sb.Append(executorComplete.Data); } diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/InProcessExecutionTests.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/InProcessExecutionTests.cs index d7f4ef7f23..90b334ff01 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/InProcessExecutionTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/InProcessExecutionTests.cs @@ -39,7 +39,7 @@ public async Task RunAsyncShouldExecuteWorkflowAsync() run.OutgoingEvents.Should().NotBeEmpty("workflow should produce events during execution"); // Check that we have an agent execution event - var agentEvents = run.OutgoingEvents.OfType().ToList(); + var agentEvents = run.OutgoingEvents.OfType().ToList(); agentEvents.Should().NotBeEmpty("agent should have executed and produced update events"); // Check that we have output events @@ -79,7 +79,7 @@ public async Task StreamAsyncWithTurnTokenShouldExecuteWorkflowAsync() events.Should().NotBeEmpty("workflow should produce events during execution"); // Check that we have agent execution events - var agentEvents = events.OfType().ToList(); + var agentEvents = events.OfType().ToList(); agentEvents.Should().NotBeEmpty("agent should have executed and produced update events"); // Check that we have output events @@ -125,8 +125,8 @@ public async Task RunAsyncAndStreamAsyncShouldProduceSimilarResultsAsync() nonStreamingEvents.Should().NotBeEmpty("non-streaming version should also produce events"); // Both should have similar types of events - var streamingAgentEvents = streamingEvents.OfType().Count(); - var nonStreamingAgentEvents = nonStreamingEvents.OfType().Count(); + var streamingAgentEvents = streamingEvents.OfType().Count(); + var nonStreamingAgentEvents = nonStreamingEvents.OfType().Count(); nonStreamingAgentEvents.Should().Be(streamingAgentEvents, "both versions should produce the same number of agent events"); diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/Sample/06_GroupChat_Workflow.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/Sample/06_GroupChat_Workflow.cs index 611e61d5b8..772d56bbcc 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/Sample/06_GroupChat_Workflow.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/Sample/06_GroupChat_Workflow.cs @@ -39,7 +39,7 @@ public static async ValueTask RunAsync(TextWriter writer, IWorkflowExecutionEnvi { Debug.WriteLine($"{executorCompleted.ExecutorId}: {executorCompleted.Data}"); } - else if (evt is AgentRunUpdateEvent update) + else if (evt is AgentResponseUpdateEvent update) { AgentResponse response = update.AsResponse();