diff --git a/dotnet/Directory.Packages.props b/dotnet/Directory.Packages.props index 40846b4dddf..93ec832a44f 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 e611c345023..8dd3f55a8a1 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 6636cb13a7f..812d13cf7a2 100644 --- a/dotnet/samples/03-workflows/Declarative/InvokeFoundryToolboxMcp/Program.cs +++ b/dotnet/samples/03-workflows/Declarative/InvokeFoundryToolboxMcp/Program.cs @@ -155,7 +155,7 @@ private static async Task CreateSampleToolboxAsync(string name, string s 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 @@ private static async Task CreateSampleToolboxAsync(string name, string s // 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 2d913f0842f..2b0a0af8261 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 6ad017c51a5..34e14c7e4fd 100644 --- a/dotnet/tests/Foundry.Hosting.IntegrationTests/SessionFilesHostedAgentTests.cs +++ b/dotnet/tests/Foundry.Hosting.IntegrationTests/SessionFilesHostedAgentTests.cs @@ -69,7 +69,6 @@ public async Task UploadedFile_IsReadByHostedAgentAsync() 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 async Task UploadedFile_IsReadByHostedAgentAsync() ?? 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 async Task UploadedFile_IsReadByHostedAgentAsync() 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 async Task UploadedFile_IsReadByHostedAgentAsync() // 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 {