Skip to content

Commit 3ea9c5f

Browse files
authored
.NET: Fixes AgentWithHostedMCP chat fails: ErrorHTTP 404 (: 404) Resource not found (#3856)
* Update packages * Fix run-request.http format
1 parent 5aa05eb commit 3ea9c5f

3 files changed

Lines changed: 6 additions & 5 deletions

File tree

dotnet/samples/HostedAgents/AgentWithHostedMCP/AgentWithHostedMCP.csproj

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,10 @@
3535
</ItemGroup>
3636

3737
<ItemGroup>
38-
<PackageReference Include="Azure.AI.AgentServer.AgentFramework" Version="1.0.0-beta.5" />
39-
<PackageReference Include="Azure.AI.OpenAI" Version="2.7.0-beta.2" />
38+
<PackageReference Include="Azure.AI.AgentServer.AgentFramework" Version="1.0.0-beta.6" />
39+
<PackageReference Include="Azure.AI.OpenAI" Version="2.8.0-beta.1" />
4040
<PackageReference Include="Azure.Identity" Version="1.17.1" />
41-
<PackageReference Include="Microsoft.Agents.AI.OpenAI" Version="1.0.0-preview.251219.1" />
42-
<PackageReference Include="Microsoft.Extensions.AI.OpenAI" Version="10.1.1-preview.1.25612.2" />
41+
<PackageReference Include="Microsoft.Extensions.AI.OpenAI" Version="10.3.0" />
4342
</ItemGroup>
4443

4544
<!-- Add analyzers with compatible versions -->

dotnet/samples/HostedAgents/AgentWithHostedMCP/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
using Azure.Identity;
1010
using Microsoft.Agents.AI;
1111
using Microsoft.Extensions.AI;
12-
using OpenAI.Responses;
1312

1413
var endpoint = Environment.GetEnvironmentVariable("AZURE_OPENAI_ENDPOINT") ?? throw new InvalidOperationException("AZURE_OPENAI_ENDPOINT is not set.");
1514
var deploymentName = Environment.GetEnvironmentVariable("AZURE_OPENAI_DEPLOYMENT_NAME") ?? "gpt-4o-mini";
@@ -29,6 +28,7 @@
2928
new Uri(endpoint),
3029
new DefaultAzureCredential())
3130
.GetResponsesClient(deploymentName)
31+
.AsIChatClient()
3232
.CreateAIAgent(
3333
instructions: "You answer questions by searching the Microsoft Learn content only.",
3434
name: "MicrosoftLearnAgent",

dotnet/samples/HostedAgents/AgentWithHostedMCP/run-requests.http

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@ GET {{host}}/readiness
77
### Simple string input - Ask about MCP Tools
88
POST {{endpoint}}
99
Content-Type: application/json
10+
1011
{
1112
"input": "Please summarize the Azure AI Agent documentation related to MCP Tool calling?"
1213
}
1314

1415
### Explicit input - Ask about Agent Framework
1516
POST {{endpoint}}
1617
Content-Type: application/json
18+
1719
{
1820
"input": [
1921
{

0 commit comments

Comments
 (0)