From a1c19b90cd0bbc6f3cd9d51dcf59a77e3b9837d3 Mon Sep 17 00:00:00 2001 From: alliscode Date: Thu, 2 Apr 2026 13:31:58 -0700 Subject: [PATCH] Move Foundry Responses hosting into Microsoft.Agents.AI.Foundry package Move source and test files from the standalone Hosting.AzureAIResponses project into the Foundry package under a Hosting/ subfolder. This consolidates the Foundry-specific hosting adapter into the main Foundry package. - Source: Microsoft.Agents.AI.Foundry.Hosting namespace - Tests: merged into Foundry.UnitTests/Hosting/ - Conditionally compiled for .NETCoreApp TFMs only (net8.0+) - Deleted standalone Hosting.AzureAIResponses project and test project - Updated sample and solution references Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- dotnet/agent-framework-dotnet.slnx | 2 - .../FoundryResponsesHosting.csproj | 2 +- .../FoundryResponsesHosting/Program.cs | 4 +- .../Hosting}/AgentFrameworkResponseHandler.cs | 8 +++- .../Hosting}/InputConverter.cs | 7 +++- .../Hosting}/OutputConverter.cs | 8 +++- .../Hosting}/ServiceCollectionExtensions.cs | 5 ++- .../Microsoft.Agents.AI.Foundry.csproj | 22 +++++++++- ....Agents.AI.Hosting.AzureAIResponses.csproj | 40 ------------------- .../AgentFrameworkResponseHandlerTests.cs | 5 ++- .../Hosting}/InputConverterTests.cs | 5 ++- .../Hosting}/OutputConverterTests.cs | 5 ++- .../ServiceCollectionExtensionsTests.cs | 5 ++- .../Hosting}/WorkflowIntegrationTests.cs | 5 ++- ...crosoft.Agents.AI.Foundry.UnitTests.csproj | 14 +++++++ ....Hosting.AzureAIResponses.UnitTests.csproj | 17 -------- 16 files changed, 73 insertions(+), 81 deletions(-) rename dotnet/src/{Microsoft.Agents.AI.Hosting.AzureAIResponses => Microsoft.Agents.AI.Foundry/Hosting}/AgentFrameworkResponseHandler.cs (97%) rename dotnet/src/{Microsoft.Agents.AI.Hosting.AzureAIResponses => Microsoft.Agents.AI.Foundry/Hosting}/InputConverter.cs (98%) rename dotnet/src/{Microsoft.Agents.AI.Hosting.AzureAIResponses => Microsoft.Agents.AI.Foundry/Hosting}/OutputConverter.cs (98%) rename dotnet/src/{Microsoft.Agents.AI.Hosting.AzureAIResponses => Microsoft.Agents.AI.Foundry/Hosting}/ServiceCollectionExtensions.cs (96%) delete mode 100644 dotnet/src/Microsoft.Agents.AI.Hosting.AzureAIResponses/Microsoft.Agents.AI.Hosting.AzureAIResponses.csproj rename dotnet/tests/{Microsoft.Agents.AI.Hosting.AzureAIResponses.UnitTests => Microsoft.Agents.AI.Foundry.UnitTests/Hosting}/AgentFrameworkResponseHandlerTests.cs (99%) rename dotnet/tests/{Microsoft.Agents.AI.Hosting.AzureAIResponses.UnitTests => Microsoft.Agents.AI.Foundry.UnitTests/Hosting}/InputConverterTests.cs (99%) rename dotnet/tests/{Microsoft.Agents.AI.Hosting.AzureAIResponses.UnitTests => Microsoft.Agents.AI.Foundry.UnitTests/Hosting}/OutputConverterTests.cs (99%) rename dotnet/tests/{Microsoft.Agents.AI.Hosting.AzureAIResponses.UnitTests => Microsoft.Agents.AI.Foundry.UnitTests/Hosting}/ServiceCollectionExtensionsTests.cs (93%) rename dotnet/tests/{Microsoft.Agents.AI.Hosting.AzureAIResponses.UnitTests => Microsoft.Agents.AI.Foundry.UnitTests/Hosting}/WorkflowIntegrationTests.cs (99%) delete mode 100644 dotnet/tests/Microsoft.Agents.AI.Hosting.AzureAIResponses.UnitTests/Microsoft.Agents.AI.Hosting.AzureAIResponses.UnitTests.csproj diff --git a/dotnet/agent-framework-dotnet.slnx b/dotnet/agent-framework-dotnet.slnx index 3d0465763f..ab74c2650a 100644 --- a/dotnet/agent-framework-dotnet.slnx +++ b/dotnet/agent-framework-dotnet.slnx @@ -494,7 +494,6 @@ - @@ -541,7 +540,6 @@ - diff --git a/dotnet/samples/04-hosting/FoundryResponsesHosting/FoundryResponsesHosting.csproj b/dotnet/samples/04-hosting/FoundryResponsesHosting/FoundryResponsesHosting.csproj index 6725ef8d3b..3dfab4ad48 100644 --- a/dotnet/samples/04-hosting/FoundryResponsesHosting/FoundryResponsesHosting.csproj +++ b/dotnet/samples/04-hosting/FoundryResponsesHosting/FoundryResponsesHosting.csproj @@ -18,8 +18,8 @@ + - diff --git a/dotnet/samples/04-hosting/FoundryResponsesHosting/Program.cs b/dotnet/samples/04-hosting/FoundryResponsesHosting/Program.cs index 88af464ac7..10a82d1b87 100644 --- a/dotnet/samples/04-hosting/FoundryResponsesHosting/Program.cs +++ b/dotnet/samples/04-hosting/FoundryResponsesHosting/Program.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft. All rights reserved. +// Copyright (c) Microsoft. All rights reserved. // This sample demonstrates hosting agent-framework agents as Foundry Hosted Agents // using the Azure AI Responses Server SDK. @@ -21,7 +21,7 @@ using Azure.AI.OpenAI; using Azure.Identity; using Microsoft.Agents.AI; using Microsoft.Agents.AI.Hosting; -using Microsoft.Agents.AI.Hosting.AzureAIResponses; +using Microsoft.Agents.AI.Foundry.Hosting; using Microsoft.Agents.AI.Workflows; using Microsoft.Extensions.AI; using ModelContextProtocol.Client; diff --git a/dotnet/src/Microsoft.Agents.AI.Hosting.AzureAIResponses/AgentFrameworkResponseHandler.cs b/dotnet/src/Microsoft.Agents.AI.Foundry/Hosting/AgentFrameworkResponseHandler.cs similarity index 97% rename from dotnet/src/Microsoft.Agents.AI.Hosting.AzureAIResponses/AgentFrameworkResponseHandler.cs rename to dotnet/src/Microsoft.Agents.AI.Foundry/Hosting/AgentFrameworkResponseHandler.cs index 5f07cd4530..acb8e9c556 100644 --- a/dotnet/src/Microsoft.Agents.AI.Hosting.AzureAIResponses/AgentFrameworkResponseHandler.cs +++ b/dotnet/src/Microsoft.Agents.AI.Foundry/Hosting/AgentFrameworkResponseHandler.cs @@ -1,13 +1,17 @@ -// Copyright (c) Microsoft. All rights reserved. +// Copyright (c) Microsoft. All rights reserved. +using System; +using System.Collections.Generic; using System.Runtime.CompilerServices; +using System.Threading; +using System.Threading.Tasks; using Azure.AI.AgentServer.Responses; using Azure.AI.AgentServer.Responses.Models; using Microsoft.Extensions.AI; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; -namespace Microsoft.Agents.AI.Hosting.AzureAIResponses; +namespace Microsoft.Agents.AI.Foundry.Hosting; /// /// A implementation that bridges the Azure AI Responses Server SDK diff --git a/dotnet/src/Microsoft.Agents.AI.Hosting.AzureAIResponses/InputConverter.cs b/dotnet/src/Microsoft.Agents.AI.Foundry/Hosting/InputConverter.cs similarity index 98% rename from dotnet/src/Microsoft.Agents.AI.Hosting.AzureAIResponses/InputConverter.cs rename to dotnet/src/Microsoft.Agents.AI.Foundry/Hosting/InputConverter.cs index a35c8cd5b8..49bd216a90 100644 --- a/dotnet/src/Microsoft.Agents.AI.Hosting.AzureAIResponses/InputConverter.cs +++ b/dotnet/src/Microsoft.Agents.AI.Foundry/Hosting/InputConverter.cs @@ -1,12 +1,15 @@ -// Copyright (c) Microsoft. All rights reserved. +// Copyright (c) Microsoft. All rights reserved. +using System; +using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; +using System.Linq; using System.Text.Json; using Azure.AI.AgentServer.Responses.Models; using Microsoft.Extensions.AI; using MeaiTextContent = Microsoft.Extensions.AI.TextContent; -namespace Microsoft.Agents.AI.Hosting.AzureAIResponses; +namespace Microsoft.Agents.AI.Foundry.Hosting; /// /// Converts Responses Server SDK input types to agent-framework types. diff --git a/dotnet/src/Microsoft.Agents.AI.Hosting.AzureAIResponses/OutputConverter.cs b/dotnet/src/Microsoft.Agents.AI.Foundry/Hosting/OutputConverter.cs similarity index 98% rename from dotnet/src/Microsoft.Agents.AI.Hosting.AzureAIResponses/OutputConverter.cs rename to dotnet/src/Microsoft.Agents.AI.Foundry/Hosting/OutputConverter.cs index f6b9aed006..1fd6672c83 100644 --- a/dotnet/src/Microsoft.Agents.AI.Hosting.AzureAIResponses/OutputConverter.cs +++ b/dotnet/src/Microsoft.Agents.AI.Foundry/Hosting/OutputConverter.cs @@ -1,17 +1,21 @@ -// Copyright (c) Microsoft. All rights reserved. +// Copyright (c) Microsoft. All rights reserved. +using System; +using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Runtime.CompilerServices; using System.Security.Cryptography; using System.Text; using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; using Azure.AI.AgentServer.Responses; using Azure.AI.AgentServer.Responses.Models; using Microsoft.Agents.AI.Workflows; using Microsoft.Extensions.AI; using MeaiTextContent = Microsoft.Extensions.AI.TextContent; -namespace Microsoft.Agents.AI.Hosting.AzureAIResponses; +namespace Microsoft.Agents.AI.Foundry.Hosting; /// /// Converts agent-framework streams into diff --git a/dotnet/src/Microsoft.Agents.AI.Hosting.AzureAIResponses/ServiceCollectionExtensions.cs b/dotnet/src/Microsoft.Agents.AI.Foundry/Hosting/ServiceCollectionExtensions.cs similarity index 96% rename from dotnet/src/Microsoft.Agents.AI.Hosting.AzureAIResponses/ServiceCollectionExtensions.cs rename to dotnet/src/Microsoft.Agents.AI.Foundry/Hosting/ServiceCollectionExtensions.cs index c06353a8ec..bae8821745 100644 --- a/dotnet/src/Microsoft.Agents.AI.Hosting.AzureAIResponses/ServiceCollectionExtensions.cs +++ b/dotnet/src/Microsoft.Agents.AI.Foundry/Hosting/ServiceCollectionExtensions.cs @@ -1,10 +1,11 @@ -// Copyright (c) Microsoft. All rights reserved. +// Copyright (c) Microsoft. All rights reserved. +using System; using Azure.AI.AgentServer.Responses; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; -namespace Microsoft.Agents.AI.Hosting.AzureAIResponses; +namespace Microsoft.Agents.AI.Foundry.Hosting; /// /// Extension methods for to register the agent-framework diff --git a/dotnet/src/Microsoft.Agents.AI.Foundry/Microsoft.Agents.AI.Foundry.csproj b/dotnet/src/Microsoft.Agents.AI.Foundry/Microsoft.Agents.AI.Foundry.csproj index 670d140043..e3c1773941 100644 --- a/dotnet/src/Microsoft.Agents.AI.Foundry/Microsoft.Agents.AI.Foundry.csproj +++ b/dotnet/src/Microsoft.Agents.AI.Foundry/Microsoft.Agents.AI.Foundry.csproj @@ -3,7 +3,8 @@ true true - $(NoWarn);OPENAI001 + $(NoWarn);OPENAI001;MEAI001;NU1903 + false @@ -20,18 +21,32 @@ true + + + + + + + + + + + + + + Microsoft Agent Framework for Foundry Agents @@ -43,4 +58,9 @@ + + + + + diff --git a/dotnet/src/Microsoft.Agents.AI.Hosting.AzureAIResponses/Microsoft.Agents.AI.Hosting.AzureAIResponses.csproj b/dotnet/src/Microsoft.Agents.AI.Hosting.AzureAIResponses/Microsoft.Agents.AI.Hosting.AzureAIResponses.csproj deleted file mode 100644 index b881e287cc..0000000000 --- a/dotnet/src/Microsoft.Agents.AI.Hosting.AzureAIResponses/Microsoft.Agents.AI.Hosting.AzureAIResponses.csproj +++ /dev/null @@ -1,40 +0,0 @@ - - - - $(TargetFrameworksCore) - enable - Microsoft.Agents.AI.Hosting.AzureAIResponses - alpha - $(NoWarn);MEAI001;NU1903 - false - - - - - - true - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dotnet/tests/Microsoft.Agents.AI.Hosting.AzureAIResponses.UnitTests/AgentFrameworkResponseHandlerTests.cs b/dotnet/tests/Microsoft.Agents.AI.Foundry.UnitTests/Hosting/AgentFrameworkResponseHandlerTests.cs similarity index 99% rename from dotnet/tests/Microsoft.Agents.AI.Hosting.AzureAIResponses.UnitTests/AgentFrameworkResponseHandlerTests.cs rename to dotnet/tests/Microsoft.Agents.AI.Foundry.UnitTests/Hosting/AgentFrameworkResponseHandlerTests.cs index 10d1271d10..dc38c42739 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Hosting.AzureAIResponses.UnitTests/AgentFrameworkResponseHandlerTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Foundry.UnitTests/Hosting/AgentFrameworkResponseHandlerTests.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft. All rights reserved. +// Copyright (c) Microsoft. All rights reserved. using System; using System.Collections.Generic; @@ -7,6 +7,7 @@ using System.Runtime.CompilerServices; using System.Text.Json; using System.Threading; using System.Threading.Tasks; +using Microsoft.Agents.AI.Foundry.Hosting; using Azure.AI.AgentServer.Responses; using Azure.AI.AgentServer.Responses.Models; using Microsoft.Extensions.AI; @@ -16,7 +17,7 @@ using Microsoft.Extensions.Logging.Abstractions; using Moq; using MeaiTextContent = Microsoft.Extensions.AI.TextContent; -namespace Microsoft.Agents.AI.Hosting.AzureAIResponses.UnitTests; +namespace Microsoft.Agents.AI.Foundry.UnitTests.Hosting; public class AgentFrameworkResponseHandlerTests { diff --git a/dotnet/tests/Microsoft.Agents.AI.Hosting.AzureAIResponses.UnitTests/InputConverterTests.cs b/dotnet/tests/Microsoft.Agents.AI.Foundry.UnitTests/Hosting/InputConverterTests.cs similarity index 99% rename from dotnet/tests/Microsoft.Agents.AI.Hosting.AzureAIResponses.UnitTests/InputConverterTests.cs rename to dotnet/tests/Microsoft.Agents.AI.Foundry.UnitTests/Hosting/InputConverterTests.cs index 85748214f1..7f36fd10d7 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Hosting.AzureAIResponses.UnitTests/InputConverterTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Foundry.UnitTests/Hosting/InputConverterTests.cs @@ -1,13 +1,14 @@ -// Copyright (c) Microsoft. All rights reserved. +// Copyright (c) Microsoft. All rights reserved. using System; using System.Linq; +using Microsoft.Agents.AI.Foundry.Hosting; using Azure.AI.AgentServer.Responses; using Azure.AI.AgentServer.Responses.Models; using Microsoft.Extensions.AI; using MeaiTextContent = Microsoft.Extensions.AI.TextContent; -namespace Microsoft.Agents.AI.Hosting.AzureAIResponses.UnitTests; +namespace Microsoft.Agents.AI.Foundry.UnitTests.Hosting; public class InputConverterTests { diff --git a/dotnet/tests/Microsoft.Agents.AI.Hosting.AzureAIResponses.UnitTests/OutputConverterTests.cs b/dotnet/tests/Microsoft.Agents.AI.Foundry.UnitTests/Hosting/OutputConverterTests.cs similarity index 99% rename from dotnet/tests/Microsoft.Agents.AI.Hosting.AzureAIResponses.UnitTests/OutputConverterTests.cs rename to dotnet/tests/Microsoft.Agents.AI.Foundry.UnitTests/Hosting/OutputConverterTests.cs index f139e3bf71..330312d2b4 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Hosting.AzureAIResponses.UnitTests/OutputConverterTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Foundry.UnitTests/Hosting/OutputConverterTests.cs @@ -1,10 +1,11 @@ -// Copyright (c) Microsoft. All rights reserved. +// Copyright (c) Microsoft. All rights reserved. using System; using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; +using Microsoft.Agents.AI.Foundry.Hosting; using Azure.AI.AgentServer.Responses; using Azure.AI.AgentServer.Responses.Models; using Microsoft.Agents.AI.Workflows; @@ -12,7 +13,7 @@ using Microsoft.Extensions.AI; using Moq; using MeaiTextContent = Microsoft.Extensions.AI.TextContent; -namespace Microsoft.Agents.AI.Hosting.AzureAIResponses.UnitTests; +namespace Microsoft.Agents.AI.Foundry.UnitTests.Hosting; public class OutputConverterTests { diff --git a/dotnet/tests/Microsoft.Agents.AI.Hosting.AzureAIResponses.UnitTests/ServiceCollectionExtensionsTests.cs b/dotnet/tests/Microsoft.Agents.AI.Foundry.UnitTests/Hosting/ServiceCollectionExtensionsTests.cs similarity index 93% rename from dotnet/tests/Microsoft.Agents.AI.Hosting.AzureAIResponses.UnitTests/ServiceCollectionExtensionsTests.cs rename to dotnet/tests/Microsoft.Agents.AI.Foundry.UnitTests/Hosting/ServiceCollectionExtensionsTests.cs index 2be9dc0bc8..ee61cef71a 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Hosting.AzureAIResponses.UnitTests/ServiceCollectionExtensionsTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Foundry.UnitTests/Hosting/ServiceCollectionExtensionsTests.cs @@ -1,12 +1,13 @@ -// Copyright (c) Microsoft. All rights reserved. +// Copyright (c) Microsoft. All rights reserved. using System; using System.Linq; +using Microsoft.Agents.AI.Foundry.Hosting; using Azure.AI.AgentServer.Responses; using Microsoft.Extensions.DependencyInjection; using Moq; -namespace Microsoft.Agents.AI.Hosting.AzureAIResponses.UnitTests; +namespace Microsoft.Agents.AI.Foundry.UnitTests.Hosting; public class ServiceCollectionExtensionsTests { diff --git a/dotnet/tests/Microsoft.Agents.AI.Hosting.AzureAIResponses.UnitTests/WorkflowIntegrationTests.cs b/dotnet/tests/Microsoft.Agents.AI.Foundry.UnitTests/Hosting/WorkflowIntegrationTests.cs similarity index 99% rename from dotnet/tests/Microsoft.Agents.AI.Hosting.AzureAIResponses.UnitTests/WorkflowIntegrationTests.cs rename to dotnet/tests/Microsoft.Agents.AI.Foundry.UnitTests/Hosting/WorkflowIntegrationTests.cs index e8f035ba85..66924bdcba 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Hosting.AzureAIResponses.UnitTests/WorkflowIntegrationTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Foundry.UnitTests/Hosting/WorkflowIntegrationTests.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft. All rights reserved. +// Copyright (c) Microsoft. All rights reserved. using System; using System.Collections.Generic; @@ -9,6 +9,7 @@ using System.Threading; using System.Threading.Tasks; using Azure.AI.AgentServer.Responses; using Azure.AI.AgentServer.Responses.Models; +using Microsoft.Agents.AI.Foundry.Hosting; using Microsoft.Agents.AI.Workflows; using Microsoft.Extensions.AI; using Microsoft.Extensions.DependencyInjection; @@ -17,7 +18,7 @@ using Microsoft.Extensions.Logging.Abstractions; using Moq; using MeaiTextContent = Microsoft.Extensions.AI.TextContent; -namespace Microsoft.Agents.AI.Hosting.AzureAIResponses.UnitTests; +namespace Microsoft.Agents.AI.Foundry.UnitTests.Hosting; /// /// Integration tests that verify workflow execution through the diff --git a/dotnet/tests/Microsoft.Agents.AI.Foundry.UnitTests/Microsoft.Agents.AI.Foundry.UnitTests.csproj b/dotnet/tests/Microsoft.Agents.AI.Foundry.UnitTests/Microsoft.Agents.AI.Foundry.UnitTests.csproj index 7b85de0384..6473b799bf 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Foundry.UnitTests/Microsoft.Agents.AI.Foundry.UnitTests.csproj +++ b/dotnet/tests/Microsoft.Agents.AI.Foundry.UnitTests/Microsoft.Agents.AI.Foundry.UnitTests.csproj @@ -1,10 +1,24 @@ + + false + $(NoWarn);NU1903;NU1605 + + + + + + + + + + + diff --git a/dotnet/tests/Microsoft.Agents.AI.Hosting.AzureAIResponses.UnitTests/Microsoft.Agents.AI.Hosting.AzureAIResponses.UnitTests.csproj b/dotnet/tests/Microsoft.Agents.AI.Hosting.AzureAIResponses.UnitTests/Microsoft.Agents.AI.Hosting.AzureAIResponses.UnitTests.csproj deleted file mode 100644 index 09c3ba24c1..0000000000 --- a/dotnet/tests/Microsoft.Agents.AI.Hosting.AzureAIResponses.UnitTests/Microsoft.Agents.AI.Hosting.AzureAIResponses.UnitTests.csproj +++ /dev/null @@ -1,17 +0,0 @@ - - - - $(TargetFrameworksCore) - false - $(NoWarn);NU1903;NU1605 - - - - - - - - - - -