From 551b44f04f2f8f112df290e882b8a9ada01eaebe Mon Sep 17 00:00:00 2001 From: Roger Barreto <19890735+rogerbarreto@users.noreply.github.com> Date: Thu, 2 Jul 2026 15:40:03 +0100 Subject: [PATCH] .NET: Bump Azure.AI.Projects to 2.1.0-beta.4 (#6795) * .NET: Bump Azure.AI.Projects to 2.1.0-alpha.20260629.1 Bumps Azure.AI.Projects beta.3 to alpha.20260629.1 and aligns transitive deps (System.ClientModel 1.14.0, Azure.Core 1.59.0, Msal 4.84.2). Adapts to renamed AgentSessionFiles APIs (Upload/GetAll/Delete, scoped GetAgentSessionFiles, SizeInBytes), AgentToolboxes (CreateVersion/Delete), and strongly typed toolbox tools (WebSearchToolboxTool, MCPToolboxTool). Adds azure-sdk public dev feed for prerelease restore. * Use positional arg for AgentSessionFiles.DeleteAsync cleanup * Move to Azure.AI.Projects 2.1.0-beta.4 (released beta) Swaps the alpha daily build for the published 2.1.0-beta.4. Drops the azure-sdk public dev feed since beta.4 and its deps are on nuget.org. Beta.4 requires Azure.Core 1.60.0, which cascades the 10.0.8 servicing packages (Microsoft.Bcl.AsyncInterfaces, System.Diagnostics.DiagnosticSource, System.Text.Json, System.Threading.Channels, Microsoft.Extensions.DependencyInjection.Abstractions, Microsoft.Extensions.Logging.Abstractions) to 10.0.9. * Reconcile Azure.Core 1.60.0 bump with merged main Reverts the over-eager System.Threading.Channels 10.0.9 bump back to 10.0.8 (it was not part of the Azure.Core 1.60.0 cascade and caused a net472 MSB3277 conflict against the 10.0.8 that Microsoft.Extensions.AI pulls). Drops the now-obsolete Azure.Core VersionOverride=1.59.0 in HostedWorkflowHandoff (added on main to satisfy AgentServer while the central pin was lower); the central pin is now 1.60.0 which already satisfies the >=1.59.0 floor, and the override was downgrading this project below sibling projects (CS1705). --- dotnet/Directory.Packages.props | 18 +++++++++--------- .../Agent_Step25_FoundryToolboxMcp/Program.cs | 13 +++++++------ .../InvokeFoundryToolboxMcp/Program.cs | 15 ++++++++------- .../HostedWorkflowHandoff.csproj | 8 ++++---- .../SessionFilesHostedAgentTests.cs | 19 +++++++------------ 5 files changed, 35 insertions(+), 38 deletions(-) diff --git a/dotnet/Directory.Packages.props b/dotnet/Directory.Packages.props index 40846b4dd..93ec832a4 100644 --- a/dotnet/Directory.Packages.props +++ b/dotnet/Directory.Packages.props @@ -27,10 +27,10 @@ - + - + @@ -42,18 +42,18 @@ - + - + - + - + @@ -88,12 +88,12 @@ - + - + @@ -121,7 +121,7 @@ - + diff --git a/dotnet/samples/02-agents/AgentProviders/foundry/Agent_Step25_FoundryToolboxMcp/Program.cs b/dotnet/samples/02-agents/AgentProviders/foundry/Agent_Step25_FoundryToolboxMcp/Program.cs index e611c3450..8dd3f55a8 100644 --- a/dotnet/samples/02-agents/AgentProviders/foundry/Agent_Step25_FoundryToolboxMcp/Program.cs +++ b/dotnet/samples/02-agents/AgentProviders/foundry/Agent_Step25_FoundryToolboxMcp/Program.cs @@ -90,7 +90,7 @@ static async Task CreateSampleToolboxAsync(string name, string endpoint, // Delete existing toolbox if present (ignore 404). try { - await toolboxClient.DeleteToolboxAsync(name); + await toolboxClient.DeleteAsync(name); Console.WriteLine($"Deleted existing toolbox '{name}'"); } catch (ClientResultException ex) when (ex.Status == 404) @@ -99,12 +99,13 @@ static async Task CreateSampleToolboxAsync(string name, string endpoint, } // Create a fresh version with a single MCP tool. - ProjectsAgentTool mcpTool = ProjectsAgentTool.AsProjectTool(ResponseTool.CreateMcpTool( - serverLabel: "api-specs", - serverUri: new Uri("https://gitmcp.io/Azure/azure-rest-api-specs"), - toolCallApprovalPolicy: new McpToolCallApprovalPolicy(GlobalMcpToolCallApprovalPolicy.NeverRequireApproval))); + MCPToolboxTool mcpTool = new("api-specs") + { + ServerUri = new Uri("https://gitmcp.io/Azure/azure-rest-api-specs"), + ToolCallApprovalPolicy = new McpToolCallApprovalPolicy(GlobalMcpToolCallApprovalPolicy.NeverRequireApproval), + }; - ToolboxVersion created = (await toolboxClient.CreateToolboxVersionAsync( + ToolboxVersion created = (await toolboxClient.CreateVersionAsync( name: name, tools: [mcpTool], description: "Sample toolbox with an MCP tool — created by Agent_Step25 sample.")).Value; diff --git a/dotnet/samples/03-workflows/Declarative/InvokeFoundryToolboxMcp/Program.cs b/dotnet/samples/03-workflows/Declarative/InvokeFoundryToolboxMcp/Program.cs index 6636cb13a..812d13cf7 100644 --- a/dotnet/samples/03-workflows/Declarative/InvokeFoundryToolboxMcp/Program.cs +++ b/dotnet/samples/03-workflows/Declarative/InvokeFoundryToolboxMcp/Program.cs @@ -155,7 +155,7 @@ internal sealed class Program try { - await toolboxClient.DeleteToolboxAsync(name); + await toolboxClient.DeleteAsync(name); Console.WriteLine($"Deleted existing toolbox '{name}'"); } catch (ClientResultException ex) when (ex.Status == 404) @@ -163,14 +163,15 @@ internal sealed class Program // Toolbox does not exist. } - ProjectsAgentTool webTool = ProjectsAgentTool.AsProjectTool(ResponseTool.CreateWebSearchTool()); + WebSearchToolboxTool webTool = new(); - ProjectsAgentTool mcpTool = ProjectsAgentTool.AsProjectTool(ResponseTool.CreateMcpTool( - serverLabel: serverLabel, - serverUri: new Uri("https://learn.microsoft.com/api/mcp"), - toolCallApprovalPolicy: new McpToolCallApprovalPolicy(GlobalMcpToolCallApprovalPolicy.NeverRequireApproval))); + MCPToolboxTool mcpTool = new(serverLabel) + { + ServerUri = new Uri("https://learn.microsoft.com/api/mcp"), + ToolCallApprovalPolicy = new McpToolCallApprovalPolicy(GlobalMcpToolCallApprovalPolicy.NeverRequireApproval), + }; - ToolboxVersion created = (await toolboxClient.CreateToolboxVersionAsync( + ToolboxVersion created = (await toolboxClient.CreateVersionAsync( name: name, tools: [webTool, mcpTool], description: "Sample toolbox combining Foundry web search with the Microsoft Learn MCP tools for the declarative InvokeFoundryToolboxMcp sample.")).Value; diff --git a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Workflow-Handoff/HostedWorkflowHandoff.csproj b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Workflow-Handoff/HostedWorkflowHandoff.csproj index 2d913f084..2b0a0af82 100644 --- a/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Workflow-Handoff/HostedWorkflowHandoff.csproj +++ b/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Workflow-Handoff/HostedWorkflowHandoff.csproj @@ -13,10 +13,10 @@ - - + + diff --git a/dotnet/tests/Foundry.Hosting.IntegrationTests/SessionFilesHostedAgentTests.cs b/dotnet/tests/Foundry.Hosting.IntegrationTests/SessionFilesHostedAgentTests.cs index 6ad017c51..34e14c7e4 100644 --- a/dotnet/tests/Foundry.Hosting.IntegrationTests/SessionFilesHostedAgentTests.cs +++ b/dotnet/tests/Foundry.Hosting.IntegrationTests/SessionFilesHostedAgentTests.cs @@ -69,7 +69,6 @@ public sealed class SessionFilesHostedAgentTests(SessionFilesHostedAgentFixture var adminOptions = new AgentAdministrationClientOptions(); adminOptions.AddPolicy(new FoundryFeaturesPolicy(HostedAgentsFeatureValue), PipelinePosition.PerCall); var adminClient = new AgentAdministrationClient(endpoint, credential, adminOptions); - var sessionFiles = adminClient.GetAgentSessionFiles(); // Build the per-agent OpenAI client. The conversation is created on this client so it is // bound to the agent endpoint URL (`/agents/{name}/endpoint/protocols/openai/conversations`). @@ -103,12 +102,13 @@ public sealed class SessionFilesHostedAgentTests(SessionFilesHostedAgentFixture ?? throw new InvalidOperationException( $"Expected '{SessionIdHeader}' response header on warm-up but got none."); + // AgentSessionFiles is scoped to the (agent, session) pair at creation time. + var sessionFiles = adminClient.GetAgentSessionFiles(this._fixture.AgentName, agentSessionId); + try { // Step 3 — upload the file via the alpha AgentSessionFiles SDK to that exact session's $HOME. - SessionFileWriteResponse writeResponse = await sessionFiles.UploadSessionFileAsync( - agentName: this._fixture.AgentName, - sessionId: agentSessionId, + SessionFileWriteResponse writeResponse = await sessionFiles.UploadAsync( sessionStoragePath: TestDataFileName, localPath: localPath); @@ -116,12 +116,10 @@ public sealed class SessionFilesHostedAgentTests(SessionFilesHostedAgentFixture Assert.Equal(expectedBytes, writeResponse.BytesWritten); bool foundEntry = false; - await foreach (SessionDirectoryEntry entry in sessionFiles.GetSessionFilesAsync( - agentName: this._fixture.AgentName, - agentSessionId: agentSessionId, + await foreach (SessionDirectoryEntry entry in sessionFiles.GetAllAsync( sessionStoragePath: ".")) { - if (entry.Name == TestDataFileName && !entry.IsDirectory && entry.Size == expectedBytes) + if (entry.Name == TestDataFileName && !entry.IsDirectory && entry.SizeInBytes == expectedBytes) { foundEntry = true; break; @@ -172,10 +170,7 @@ public sealed class SessionFilesHostedAgentTests(SessionFilesHostedAgentFixture // the platform owns its lifecycle (no isolation key in our hands). try { - await sessionFiles.DeleteSessionFileAsync( - agentName: this._fixture.AgentName, - sessionId: agentSessionId, - path: TestDataFileName); + await sessionFiles.DeleteAsync(TestDataFileName); } catch {