Commit Graph

4 Commits

  • .NET: Add dedicated Foundry.Hosting UnitTest project (#5592)
    * Foundry.Hosting.UnitTests: extract project from Foundry.UnitTests
    
    Move all Hosting/* tests, three toolbox TestData JSONs, and the FakeAuthenticationTokenProvider/HttpHandlerAssert/TestDataUtil helpers (trimmed to toolbox getters) into a new Microsoft.Agents.AI.Foundry.Hosting.UnitTests project. Add it to the slnx and grant the new assembly InternalsVisibleTo from Microsoft.Agents.AI.Foundry and Microsoft.Agents.AI.Foundry.Hosting.
    
    * Foundry.Hosting.UnitTests: align namespaces to assembly name
    
    Rename namespaces from Microsoft.Agents.AI.Foundry.UnitTests(.Hosting) to Microsoft.Agents.AI.Foundry.Hosting.UnitTests across all moved tests, the duplicated helpers, and the trimmed TestDataUtil. Also fixes the prior namespace inconsistency in FoundryToolboxTests.
    
    * Foundry.Hosting.UnitTests: split WorkflowIntegrationTests by SUT
    
    Replace the WorkflowIntegrationTests file (an IT-named file inside a UT project) with two SUT-focused files plus a shared test-doubles file:
    
    - AgentFrameworkResponseHandlerWorkflowTests.cs - the 5 handler-driven tests that exercise AgentFrameworkResponseHandler with a real workflow agent.
    - OutputConverterWorkflowTests.cs - the 5 OutputConverter tests driven by hand-crafted update sequences mirroring real workflow patterns.
    - WorkflowTestAgents.cs - StreamingTextAgent and ThrowingStreamingAgent extracted as internal types used by both files.
    
    * Foundry.UnitTests: trim Hosting-related conditionals and dead testdata
    
    Now that Hosting tests live in their own project:
    - drop the Compile Remove guard for the Hosting subfolder,
    - drop the .NETCoreApp-only PackageReferences (Azure.AI.AgentServer.Responses, Microsoft.AspNetCore.TestHost, OpenTelemetry, OpenTelemetry.Exporter.InMemory),
    - drop the conditional ProjectReference to Microsoft.Agents.AI.Foundry.Hosting,
    - delete the three Toolbox JSON files and the matching Toolbox getters in TestDataUtil.
    
    * Foundry.Hosting.UnitTests: drop redundant 'using Microsoft.Agents.AI.Foundry.Hosting'
    
    The new project namespace is Microsoft.Agents.AI.Foundry.Hosting.UnitTests, which already brings the parent Microsoft.Agents.AI.Foundry.Hosting namespace into scope. The explicit using statement is therefore redundant (IDE0005). Caught by 'dotnet format --verify-no-changes' running on Linux against the .NET 10 SDK.
    
    * Foundry.Hosting: drop InternalsVisibleTo to Foundry.UnitTests
    
    The non-hosting Foundry.UnitTests project no longer holds any Hosting tests after the split, so it doesn't need access to internal types in Microsoft.Agents.AI.Foundry.Hosting. Only Microsoft.Agents.AI.Foundry.Hosting.UnitTests needs it.
    
    * Foundry.Hosting: rename DelegatingResponsesClient to UserAgentResponsesClient
    
    Address westey-m's review feedback on PR #5453: `Delegating*` is conventionally reserved for inheritable base classes (mirroring `DelegatingHandler`) where consumers override one or two members. This polyfill is sealed and only injects the User-Agent supplement, so the new name reflects its actual purpose.
    
    Renamed via `git mv` to preserve history:
    * `src/Microsoft.Agents.AI.Foundry.Hosting/DelegatingResponsesClient.cs` to `UserAgentResponsesClient.cs`
    * `tests/Microsoft.Agents.AI.Foundry.Hosting.UnitTests/DelegatingResponsesClientTests.cs` to `UserAgentResponsesClientTests.cs`
    
    Class, constructor, and all references updated across:
    * `src/.../UserAgentResponsesClient.cs` (class + constructor + internal log message)
    * `src/.../ServiceCollectionExtensions.cs` (cref + type check + instantiation)
    * `src/.../HostedAgentUserAgentPolicy.cs` (cref)
    * `tests/Foundry.UnitTests/RequestOptionsExtensionsTests.cs` (comment)
    * `tests/Foundry.Hosting.UnitTests/UserAgentResponsesClientTests.cs` (class + cref + instantiations)
  • .NET: dotnet: Add server-side Foundry Toolbox support and fix SDK beta.4 br… (#5450)
    * dotnet: Add server-side Foundry Toolbox support and fix SDK beta.4 breaking changes
    
    Add FoundryToolbox and AIProjectClient extensions to Microsoft.Agents.AI.Foundry.Hosting
    for server-side toolbox tool integration matching Python's FoundryChatClient.get_toolbox()
    pattern. Tools are fetched from the Foundry project SDK and passed as server-side tools
    in the Responses API request.
    
    New files:
    - FoundryToolbox.cs: Core implementation using AgentAdministrationClient SDK
    - AIProjectClientToolboxExtensions.cs: Extension methods on AIProjectClient
    - Agent_Step25_ToolboxServerSideTools sample with create helper and combine flow
    - 19 unit tests covering param validation, conversion, sanitization, and extensions
    
    SDK breaking changes (Azure.AI.AgentServer.Responses beta.3 -> beta.4):
    - FunctionToolCallOutputResource renamed to OutputItemFunctionToolCallOutput
    - AzureAIAgentServerResponsesModelFactory made internal, replaced with direct constructors
    - ResponseUsage constructor now requires non-null token details parameters
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * fix: reuse endpoint variable in CreateSampleToolboxAsync
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * fix: pass endpoint through static local functions to avoid capture
    
    Static local functions cannot capture top-level variables. Thread the
    endpoint parameter through Main, CombineToolboxes, and CreateSampleToolboxAsync.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * refactor: remove unused projectClient param from CreateSampleToolboxAsync
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Update dotnet/samples/02-agents/AgentsWithFoundry/Agent_Step25_ToolboxServerSideTools/README.md
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    
    * Update dotnet/samples/02-agents/AgentsWithFoundry/Agent_Step25_ToolboxServerSideTools/Program.cs
    
    Co-authored-by: westey <164392973+westey-m@users.noreply.github.com>
    
    * Update dotnet/samples/02-agents/AgentsWithFoundry/Agent_Step25_ToolboxServerSideTools/Program.cs
    
    Co-authored-by: westey <164392973+westey-m@users.noreply.github.com>
    
    * Removing GetToolbocVersion.
    
    * Removing tests for GetToolboxVersion
    
    * fix: map cached/reasoning token counts in ConvertUsage instead of hardcoding zeros
    
    Extract InputTokenDetails.CachedTokenCount and OutputTokenDetails.ReasoningTokenCount
    from UsageDetails.AdditionalCounts, matching the pattern in AgentResponseExtensions.
    Also accumulate detail counts when merging with existing usage.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: alliscode <bentho@microsoft.com>
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    Co-authored-by: westey <164392973+westey-m@users.noreply.github.com>
  • .NET: Bump Azure.AI.Projects to 2.0.0 GA (#5060)
    * Bump Azure.AI.Projects to 2.0.0 GA
    
    - Update Azure.AI.Projects from 2.0.0-beta.2 to 2.0.0 in CPM
    - Update Azure.Identity from 1.19.0 to 1.20.0 (transitive dep)
    - Update System.ClientModel from 1.9.0 to 1.10.0 (transitive dep)
    - Rename types per Azure.AI.Projects.Agents 2.0.0 breaking changes:
      - AgentVersion -> ProjectsAgentVersion
      - AgentRecord -> ProjectsAgentRecord
      - AgentDefinition -> ProjectsAgentDefinition
      - AgentVersionCreationOptions -> ProjectsAgentVersionCreationOptions
      - PromptAgentDefinition -> DeclarativeAgentDefinition
      - AgentTool -> ProjectsAgentTool
      - AgentsClient -> AgentAdministrationClient
      - .Agents property -> .AgentAdministrationClient
    - Add using Azure.AI.Projects.Memory namespace (types moved)
    - Update AGENTS.md with BOM and output capture conventions
    
    * Address PR review feedback
    
    - Rename AIProjectClient parameter to aiProjectClient in AsChatClientAgent overloads
    - Fix XML doc: ProjectsAgentTool namespace from Azure.AI.Projects.OpenAI to Azure.AI.Projects.Agents
    - Rename test method to reflect DeclarativeAgentDefinition terminology
  • .NET: Rename Microsoft.Agents.AI.AzureAI to Microsoft.Agents.AI.Foundry and consolidate FoundryMemory (#5042)
    * Update Foundry Responses as ChatClientAgent
    
    * Migrate obsolete AzureAI integration tests to versioned agent pattern
    
    Replace obsolete CreateAIAgentAsync/GetAIAgentAsync calls with
    Agents.CreateAgentVersionAsync() + AsAIAgent(AgentVersion) in all
    AzureAI integration tests.
    
    - Rename AIProjectClient* test files to FoundryVersionedAgent*
    - Register AIFunction tools in PromptAgentDefinition.Tools for
      server-side visibility via AsOpenAIResponseTool()
    - Skip structured output tests (AzureAIProjectChatClient clears
      ResponseFormat for versioned agents)
    - Remove all [Obsolete] attributes and #pragma warning disable CS0618
    
    * Merge FoundryMemory package into AzureAI under Memory/ folder
    
    Move all FoundryMemory source, unit tests, and integration tests into
    the Microsoft.Agents.AI.AzureAI package. Change namespace from
    Microsoft.Agents.AI.FoundryMemory to Microsoft.Agents.AI.AzureAI.
    
    - Add [Experimental] to FoundryMemoryProviderOptions and Scope
    - Rename internal AIProjectClientExtensions to MemoryStoreExtensions
    - Update AzureAI .csproj with Compliance.Abstractions, Redaction
    - Remove FoundryMemory from solution and release filter
    - Update sample to reference AzureAI instead of FoundryMemory
    - Delete old Microsoft.Agents.AI.FoundryMemory project and tests
    
    * Add EnsureMemoryStoreCreatedAsync and memory existence checks to integration tests
    
    - Ensure memory store is created before testing memory operations
    - Add AZURE_AI_EMBEDDING_DEPLOYMENT_NAME config setting
    - Assert memories exist in store via SearchMemoriesAsync before cleanup
    - Verify scope isolation with direct memory store queries
    
    * Fix and rename AzureAI unit tests for RAPI vs Versioned clarity
    
    - Rename AsAIAgentAsync_* to AsAIAgent_* (drop Async from method group)
    - Add _Rapi_ prefix to non-versioned (Responses API) tests
    - Add _Versioned_ prefix to versioned agent tests where needed
    - Fix RAPI tests: assert GetService<AIProjectClient>() is null
    - Fix Versioned tests: assert IsType<FoundryAgent> and
      GetService<AIProjectClient>() returns the client instance
    - Fix UserAgent header tests: proper HTTP handler routing
    - Fix ChatClient_UsesDefaultConversationIdAsync test setup
    - All 153 unit tests pass with 0 failures
    
    * Rename Microsoft.Agents.AI.AzureAI to Microsoft.Agents.AI.Foundry
    
    Rename the project, namespace, folder, and all references from
    Microsoft.Agents.AI.AzureAI to Microsoft.Agents.AI.Foundry.
    Also rename Workflows.Declarative.AzureAI to .Foundry.
    
    - Rename src, unit test, integration test, and workflow folders
    - Update namespaces in all source and test .cs files
    - Update ProjectReferences in ~47 sample and test .csproj files
    - Update solution files (.slnx, .slnf)
    - Update sample using statements
    - Update READMEs, SKILL.md, ADRs in docs/
    - Disable package validation baseline for renamed packages
    - Fix UTF-8 BOM encoding on all affected .cs files
    - AzureAI.Persistent left completely unchanged
    
    * Fix format: remove ImplicitUsings, add explicit usings, fix BOM encoding
    
    - Remove ImplicitUsings=enable from Foundry csproj to resolve IDE0005
      on shared ReplacingRedactor.cs
    - Add explicit System usings to all source files that relied on them
    - Sort usings alphabetically per editorconfig rules
    - Fix UTF-8 BOM on 12 sample Program.cs files
    - Rename Azure AI Foundry Agents to Microsoft Foundry Agents in docs