From 4fb7a427b1a4b37e9b2ea7fa5e179d9152e2e8ce Mon Sep 17 00:00:00 2001 From: Chris <66376200+crickman@users.noreply.github.com> Date: Tue, 11 Nov 2025 13:58:27 -0800 Subject: [PATCH] .NET Workflows - Separate Foundry/AzureAI Provider into its own package (#2078) --- dotnet/agent-framework-dotnet.slnx | 1 + .../ConfirmInput/ConfirmInput.csproj | 1 + .../DeepResearch/DeepResearch.csproj | 1 + .../ExecuteCode/ExecuteCode.csproj | 1 + .../ExecuteWorkflow/ExecuteWorkflow.csproj | 1 + .../FunctionTools/FunctionTools.csproj | 1 + .../InputArguments/InputArguments.csproj | 1 + .../Declarative/Marketing/Marketing.csproj | 1 + .../StudentTeacher/StudentTeacher.csproj | 1 + .../ToolApproval/ToolApproval.csproj | 1 + .../AzureAgentProvider.cs | 2 +- ...ts.AI.Workflows.Declarative.AzureAI.csproj | 41 +++++++++++++++++++ ...oft.Agents.AI.Workflows.Declarative.csproj | 2 - .../WorkflowAgentProvider.cs | 12 ++++++ ...kflows.Declarative.IntegrationTests.csproj | 2 + ....AI.Workflows.Declarative.UnitTests.csproj | 1 + 16 files changed, 67 insertions(+), 3 deletions(-) rename dotnet/src/{Microsoft.Agents.AI.Workflows.Declarative => Microsoft.Agents.AI.Workflows.Declarative.AzureAI}/AzureAgentProvider.cs (99%) create mode 100644 dotnet/src/Microsoft.Agents.AI.Workflows.Declarative.AzureAI/Microsoft.Agents.AI.Workflows.Declarative.AzureAI.csproj diff --git a/dotnet/agent-framework-dotnet.slnx b/dotnet/agent-framework-dotnet.slnx index 8f0f34093b..319333d5d8 100644 --- a/dotnet/agent-framework-dotnet.slnx +++ b/dotnet/agent-framework-dotnet.slnx @@ -305,6 +305,7 @@ + diff --git a/dotnet/samples/GettingStarted/Workflows/Declarative/ConfirmInput/ConfirmInput.csproj b/dotnet/samples/GettingStarted/Workflows/Declarative/ConfirmInput/ConfirmInput.csproj index a78fbddbd7..b7c6379101 100644 --- a/dotnet/samples/GettingStarted/Workflows/Declarative/ConfirmInput/ConfirmInput.csproj +++ b/dotnet/samples/GettingStarted/Workflows/Declarative/ConfirmInput/ConfirmInput.csproj @@ -28,6 +28,7 @@ + diff --git a/dotnet/samples/GettingStarted/Workflows/Declarative/DeepResearch/DeepResearch.csproj b/dotnet/samples/GettingStarted/Workflows/Declarative/DeepResearch/DeepResearch.csproj index c4d542056d..619c727b1b 100644 --- a/dotnet/samples/GettingStarted/Workflows/Declarative/DeepResearch/DeepResearch.csproj +++ b/dotnet/samples/GettingStarted/Workflows/Declarative/DeepResearch/DeepResearch.csproj @@ -28,6 +28,7 @@ + diff --git a/dotnet/samples/GettingStarted/Workflows/Declarative/ExecuteCode/ExecuteCode.csproj b/dotnet/samples/GettingStarted/Workflows/Declarative/ExecuteCode/ExecuteCode.csproj index 838f0f1e4f..ca7c10cde3 100644 --- a/dotnet/samples/GettingStarted/Workflows/Declarative/ExecuteCode/ExecuteCode.csproj +++ b/dotnet/samples/GettingStarted/Workflows/Declarative/ExecuteCode/ExecuteCode.csproj @@ -29,6 +29,7 @@ + diff --git a/dotnet/samples/GettingStarted/Workflows/Declarative/ExecuteWorkflow/ExecuteWorkflow.csproj b/dotnet/samples/GettingStarted/Workflows/Declarative/ExecuteWorkflow/ExecuteWorkflow.csproj index f5475b66f4..1fb6abe55d 100644 --- a/dotnet/samples/GettingStarted/Workflows/Declarative/ExecuteWorkflow/ExecuteWorkflow.csproj +++ b/dotnet/samples/GettingStarted/Workflows/Declarative/ExecuteWorkflow/ExecuteWorkflow.csproj @@ -28,6 +28,7 @@ + diff --git a/dotnet/samples/GettingStarted/Workflows/Declarative/FunctionTools/FunctionTools.csproj b/dotnet/samples/GettingStarted/Workflows/Declarative/FunctionTools/FunctionTools.csproj index 239df72098..888a48f5df 100644 --- a/dotnet/samples/GettingStarted/Workflows/Declarative/FunctionTools/FunctionTools.csproj +++ b/dotnet/samples/GettingStarted/Workflows/Declarative/FunctionTools/FunctionTools.csproj @@ -28,6 +28,7 @@ + diff --git a/dotnet/samples/GettingStarted/Workflows/Declarative/InputArguments/InputArguments.csproj b/dotnet/samples/GettingStarted/Workflows/Declarative/InputArguments/InputArguments.csproj index af04305c91..51582438eb 100644 --- a/dotnet/samples/GettingStarted/Workflows/Declarative/InputArguments/InputArguments.csproj +++ b/dotnet/samples/GettingStarted/Workflows/Declarative/InputArguments/InputArguments.csproj @@ -28,6 +28,7 @@ + diff --git a/dotnet/samples/GettingStarted/Workflows/Declarative/Marketing/Marketing.csproj b/dotnet/samples/GettingStarted/Workflows/Declarative/Marketing/Marketing.csproj index 76792809a9..12599a1b79 100644 --- a/dotnet/samples/GettingStarted/Workflows/Declarative/Marketing/Marketing.csproj +++ b/dotnet/samples/GettingStarted/Workflows/Declarative/Marketing/Marketing.csproj @@ -28,6 +28,7 @@ + diff --git a/dotnet/samples/GettingStarted/Workflows/Declarative/StudentTeacher/StudentTeacher.csproj b/dotnet/samples/GettingStarted/Workflows/Declarative/StudentTeacher/StudentTeacher.csproj index dae5bbef1f..7c210d6f96 100644 --- a/dotnet/samples/GettingStarted/Workflows/Declarative/StudentTeacher/StudentTeacher.csproj +++ b/dotnet/samples/GettingStarted/Workflows/Declarative/StudentTeacher/StudentTeacher.csproj @@ -28,6 +28,7 @@ + diff --git a/dotnet/samples/GettingStarted/Workflows/Declarative/ToolApproval/ToolApproval.csproj b/dotnet/samples/GettingStarted/Workflows/Declarative/ToolApproval/ToolApproval.csproj index 5d5a013a33..6fa1cf12d9 100644 --- a/dotnet/samples/GettingStarted/Workflows/Declarative/ToolApproval/ToolApproval.csproj +++ b/dotnet/samples/GettingStarted/Workflows/Declarative/ToolApproval/ToolApproval.csproj @@ -28,6 +28,7 @@ + diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/AzureAgentProvider.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative.AzureAI/AzureAgentProvider.cs similarity index 99% rename from dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/AzureAgentProvider.cs rename to dotnet/src/Microsoft.Agents.AI.Workflows.Declarative.AzureAI/AzureAgentProvider.cs index de50e16922..9248a6583e 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/AzureAgentProvider.cs +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative.AzureAI/AzureAgentProvider.cs @@ -100,7 +100,7 @@ public sealed class AzureAgentProvider(Uri projectEndpoint, TokenCredential proj if (inputArguments is not null) { - JsonNode jsonNode = inputArguments.ToFormula().ToJson(); + JsonNode jsonNode = ConvertDictionaryToJson(inputArguments); ResponseCreationOptions responseCreationOptions = new(); responseCreationOptions.SetStructuredInputs(BinaryData.FromString(jsonNode.ToJsonString())); chatOptions.RawRepresentationFactory = (_) => responseCreationOptions; diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative.AzureAI/Microsoft.Agents.AI.Workflows.Declarative.AzureAI.csproj b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative.AzureAI/Microsoft.Agents.AI.Workflows.Declarative.AzureAI.csproj new file mode 100644 index 0000000000..c43c28aaf4 --- /dev/null +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative.AzureAI/Microsoft.Agents.AI.Workflows.Declarative.AzureAI.csproj @@ -0,0 +1,41 @@ + + + + $(ProjectsTargetFrameworks) + $(ProjectsDebugTargetFrameworks) + preview + $(NoWarn);MEAI001;OPENAI001 + + + + true + true + true + + + + + + + Microsoft Agent Framework Declarative Workflows Azure AI + Provides Microsoft Agent Framework support for declarative workflows for Azure AI Agents. + + + + + + + + + + + + + + + + + + + + diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Microsoft.Agents.AI.Workflows.Declarative.csproj b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Microsoft.Agents.AI.Workflows.Declarative.csproj index 17ce9f6c4f..1f466aac4e 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Microsoft.Agents.AI.Workflows.Declarative.csproj +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Microsoft.Agents.AI.Workflows.Declarative.csproj @@ -22,7 +22,6 @@ - @@ -34,7 +33,6 @@ - diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/WorkflowAgentProvider.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/WorkflowAgentProvider.cs index 34c327281a..e0967ab376 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/WorkflowAgentProvider.cs +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/WorkflowAgentProvider.cs @@ -1,9 +1,11 @@ // Copyright (c) Microsoft. All rights reserved. using System.Collections.Generic; +using System.Text.Json.Nodes; using System.Threading; using System.Threading.Tasks; using Microsoft.Agents.AI.Workflows.Declarative.Events; +using Microsoft.Agents.AI.Workflows.Declarative.Extensions; using Microsoft.Extensions.AI; namespace Microsoft.Agents.AI.Workflows.Declarative; @@ -115,4 +117,14 @@ public abstract class WorkflowAgentProvider string? before = null, bool newestFirst = false, CancellationToken cancellationToken = default); + + /// + /// Utility method to convert a dictionary of input arguments to a JsonNode. + /// + /// The dictionary of input arguments. + /// A JsonNode representing the input arguments. + protected static JsonNode ConvertDictionaryToJson(IDictionary inputArguments) + { + return inputArguments.ToFormula().ToJson(); + } } diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests.csproj b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests.csproj index 1563b88719..9e86f4250a 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests.csproj +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests.csproj @@ -5,6 +5,7 @@ + true true true true @@ -12,6 +13,7 @@ + diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests.csproj b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests.csproj index 4eca981e33..491ec95778 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests.csproj +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests.csproj @@ -14,6 +14,7 @@ +