Skip to content

.NET: Microsoft.Agents.AI is giving 404 Resource not found although the input values are correct. #1692

@MSRY

Description

@MSRY

Language/Version
What package version of the SDK are you using.

  • Language: C#
  • Package version: 1.0.0-preview.251016.1
  • SDK Use: Agents Hosting

If you're using the Agent Hosting system, please complete the following information:

  • How are you Hosting this: Cloud
  • Are you deploying: AppServices
  • Are you using Azure Bot Services: Yes, Azure Bot
  • What Client are you using: MSTeams
  • What dotnet\node\python version is your build in: 8.0

Describe the bug
Although the endpoint URL, and deployment-id are correct, the SDK is reporting 404 Resource not found error. It is not considering wrong API key when we tried for debugging purpose.
This failure case has following packages installed in the project.
Project 'AssistantBot.Application' has the following package references
[net8.0]:
Top-level Package Requested Resolved

AdaptiveCards 3.1.0 3.1.0
AdaptiveCards.Templating 2.0.5 2.0.5
Asp.Versioning.Mvc.ApiExplorer 8.1.0 8.1.0
Asp.Versioning.OData.ApiExplorer 8.2.0 8.2.0
Azure.Identity 1.17.0 1.17.0
FunctionalDdd.Asp $(FunctionalDddVersion) 2.1.1
Microsoft.Agents.AI 1.0.0-preview.251016.1 1.0.0-preview.251016.1
Microsoft.Agents.AI.OpenAI 1.0.0-preview.251016.1 1.0.0-preview.251016.1
Microsoft.Agents.Authentication.Msal 1.1.151 1.1.151
Microsoft.Agents.Builder.Dialogs 1.1.151 1.1.151
Microsoft.Agents.Extensions.Teams 1.1.151 1.1.151
Microsoft.Agents.Hosting.AspNetCore 1.1.151 1.1.151
Microsoft.AspNetCore.OData 9.3.2 9.3.2
Microsoft.AspNetCore.OpenApi 8.0.13 8.0.13
Microsoft.Bot.Builder.Integration.AspNet.Core 4.23.0 4.23.0
Microsoft.Bot.Connector 4.23.0 4.23.0
Microsoft.Extensions.Http 9.0.1 9.0.1
Microsoft.Extensions.Logging 9.0.6 9.0.6
Microsoft.Identity.ServiceEssentials.AspNetCore 1.36.0 1.36.0
Microsoft.Identity.Web 3.9.4 3.9.4
Microsoft.SemanticKernel 1.61.0 1.61.0
Microsoft.SemanticKernel.Agents.AzureAI 1.61.0-preview 1.61.0-preview
Microsoft.SemanticKernel.Agents.Core 1.61.0 1.61.0
Microsoft.SemanticKernel.Connectors.AzureOpenAI 1.61.0 1.61.0
Microsoft.SemanticKernel.Connectors.OpenAI 1.66.0 1.66.0
Microsoft.TeamsFx 3.0.0 3.0.0
ModelContextProtocol 0.3.0-preview.3 0.3.0-preview.3
NeoSmart.AsyncLock 3.2.1 3.2.1

Transitive Package Resolved

Antlr4.Runtime.Standard 4.13.1
Asp.Versioning.Abstractions 8.1.0
Asp.Versioning.Http 8.1.0
Asp.Versioning.Mvc 8.1.0
Asp.Versioning.OData 8.2.0
Azure.AI.Agents.Persistent 1.0.0
Azure.AI.Inference 1.0.0-beta.4
Azure.AI.OpenAI 2.2.0-beta.5
Azure.AI.Projects 1.0.0-beta.9
Azure.Core 1.49.0
Azure.Security.KeyVault.Certificates 4.6.0
Azure.Security.KeyVault.Secrets 4.6.0
Azure.Storage.Blobs 12.23.0
Azure.Storage.Common 12.22.0
FluentValidation 11.10.0
FunctionalDdd.DomainDrivenDesign 2.1.1
FunctionalDdd.FluentValidation 2.1.1
FunctionalDdd.RailwayOrientedProgramming 2.1.1
Json.More.Net 2.0.1.2
JsonPath.Net 1.1.0
Microsoft.Agents.AI.Abstractions 1.0.0-preview.251016.1
Microsoft.Agents.Authentication 1.1.151
Microsoft.Agents.Builder 1.1.151
Microsoft.Agents.Client 1.1.151
Microsoft.Agents.Connector 1.1.151
Microsoft.Agents.Core 1.1.151
Microsoft.Agents.Storage 1.1.151
Microsoft.Agents.Storage.Transcript 1.1.151
Microsoft.AspNetCore.Authentication.JwtBearer 8.0.11
Microsoft.AspNetCore.Authentication.OpenIdConnect 8.0.0
Microsoft.AspNetCore.Authorization 8.0.14
Microsoft.AspNetCore.Components 8.0.14
Microsoft.AspNetCore.Components.Analyzers 8.0.14
Microsoft.AspNetCore.Components.Forms 8.0.14
Microsoft.AspNetCore.Components.Web 8.0.14
Microsoft.AspNetCore.Cryptography.Internal 8.0.1
Microsoft.AspNetCore.DataProtection 8.0.1
Microsoft.AspNetCore.DataProtection.Abstractions 8.0.1
Microsoft.AspNetCore.Metadata 8.0.14
Microsoft.Bcl.AsyncInterfaces 9.0.4
Microsoft.Bcl.HashCode 1.1.1
Microsoft.Bcl.TimeProvider 8.0.1
Microsoft.Bot.AdaptiveExpressions.Core 4.22.9
Microsoft.Bot.Builder 4.23.0
Microsoft.Bot.Configuration 4.23.0
Microsoft.Bot.Connector.Streaming 4.23.0
Microsoft.Bot.Schema 4.23.0
Microsoft.Bot.Streaming 4.23.0
Microsoft.CSharp 4.7.0
Microsoft.Extensions.AI 9.10.0
Microsoft.Extensions.AI.Abstractions 9.10.0
Microsoft.Extensions.AI.OpenAI 9.10.0-preview.1.25513.3
Microsoft.Extensions.Caching.Abstractions 8.0.0
Microsoft.Extensions.Caching.Memory 8.0.1
Microsoft.Extensions.Configuration 9.0.1
Microsoft.Extensions.Configuration.Abstractions 9.0.1
Microsoft.Extensions.Configuration.Binder 9.0.1
Microsoft.Extensions.Configuration.CommandLine 9.0.1
Microsoft.Extensions.Configuration.EnvironmentVariables 9.0.1
Microsoft.Extensions.Configuration.FileExtensions 9.0.1
Microsoft.Extensions.Configuration.Json 9.0.1
Microsoft.Extensions.Configuration.UserSecrets 9.0.1
Microsoft.Extensions.DependencyInjection 9.0.6
Microsoft.Extensions.DependencyInjection.Abstractions 9.0.10
Microsoft.Extensions.DependencyModel 8.0.2
Microsoft.Extensions.Diagnostics 9.0.1
Microsoft.Extensions.Diagnostics.Abstractions 9.0.1
Microsoft.Extensions.FileProviders.Abstractions 9.0.1
Microsoft.Extensions.FileProviders.Physical 9.0.1
Microsoft.Extensions.FileSystemGlobbing 9.0.1
Microsoft.Extensions.Hosting 9.0.1
Microsoft.Extensions.Hosting.Abstractions 9.0.1
Microsoft.Extensions.Logging.Abstractions 9.0.10
Microsoft.Extensions.Logging.Configuration 9.0.1
Microsoft.Extensions.Logging.Console 9.0.1
Microsoft.Extensions.Logging.Debug 9.0.1
Microsoft.Extensions.Logging.EventLog 9.0.1
Microsoft.Extensions.Logging.EventSource 9.0.1
Microsoft.Extensions.ObjectPool 6.0.3
Microsoft.Extensions.Options 9.0.6
Microsoft.Extensions.Options.ConfigurationExtensions 9.0.1
Microsoft.Extensions.Options.DataAnnotations 9.0.1
Microsoft.Extensions.Primitives 9.0.6
Microsoft.Extensions.VectorData.Abstractions 9.7.0
Microsoft.Graph 5.74.0
Microsoft.Graph.Core 3.2.4
Microsoft.Identity.Abstractions 9.1.0
Microsoft.Identity.Client 4.76.0
Microsoft.Identity.Client.Extensions.Msal 4.76.0
Microsoft.Identity.ServerAuthorization 4.12.7
Microsoft.Identity.ServiceEssentials.Authentication 1.36.0
Microsoft.Identity.ServiceEssentials.Caching 1.36.0
Microsoft.Identity.ServiceEssentials.Core 1.36.0
Microsoft.Identity.ServiceEssentials.DataContracts.ClaimsOnlyAuthZ 1.36.0
Microsoft.Identity.ServiceEssentials.DataProviders.ClaimsOnlyAuthZ 1.36.0
Microsoft.Identity.ServiceEssentials.Extensions.AspNetCoreMiddleware 1.36.0
Microsoft.Identity.ServiceEssentials.Extensions.AspNetCoreMiddleware.S2S 1.36.0
Microsoft.Identity.ServiceEssentials.Extensions.AspNetCoreMiddleware.S2SWeb 1.36.0
Microsoft.Identity.ServiceEssentials.Modules.ClaimsOnlyAuthZ 1.36.0
Microsoft.Identity.ServiceEssentials.Modules.SettingBasedTokenRevocation 1.36.0
Microsoft.Identity.ServiceEssentials.Modules.TrV2Module 2.6.3
Microsoft.Identity.ServiceEssentials.S2SWeb 1.36.0
Microsoft.Identity.ServiceEssentials.Standard 1.36.0
Microsoft.Identity.ServiceEssentials.Telemetry.Abstractions 1.36.0
Microsoft.Identity.ServiceEssentials.Telemetry.OneCollector 1.36.0
Microsoft.Identity.ServiceEssentials.TokenAcquisition 1.36.0
Microsoft.Identity.ServiceEssentials.TokenAcquisitionIdWeb 1.36.0
Microsoft.Identity.TokenRevocationFromSettings 1.36.0
Microsoft.Identity.Web.Certificate 3.9.4
Microsoft.Identity.Web.Certificateless 3.9.4
Microsoft.Identity.Web.Diagnostics 3.9.4
Microsoft.Identity.Web.DownstreamApi 3.9.3
Microsoft.Identity.Web.TokenAcquisition 3.9.4
Microsoft.Identity.Web.TokenCache 3.9.4
Microsoft.IdentityModel.Abstractions 8.12.1
Microsoft.IdentityModel.JsonWebTokens 8.12.1
Microsoft.IdentityModel.Logging 8.12.1
Microsoft.IdentityModel.LoggingExtensions 8.12.1
Microsoft.IdentityModel.Protocols 8.12.1
Microsoft.IdentityModel.Protocols.OpenIdConnect 8.12.1
Microsoft.IdentityModel.Protocols.SignedHttpRequest 8.12.0
Microsoft.IdentityModel.Protocols.WsFederation 8.12.0
Microsoft.IdentityModel.S2S 4.19.0
Microsoft.IdentityModel.S2S.Configuration 4.19.0
Microsoft.IdentityModel.S2S.DstsExtensions 4.19.0
Microsoft.IdentityModel.S2S.Extensions.AspNetCore 4.19.0
Microsoft.IdentityModel.S2S.ServerAuthorizationExtensions 4.19.0
Microsoft.IdentityModel.S2S.Tokens 4.19.0
Microsoft.IdentityModel.Tokens 8.12.1
Microsoft.IdentityModel.Tokens.Saml 8.12.0
Microsoft.IdentityModel.Validators 8.12.1
Microsoft.IdentityModel.Xml 8.12.0
Microsoft.JSInterop 8.0.14
Microsoft.Kiota.Abstractions 1.17.1
Microsoft.Kiota.Authentication.Azure 1.17.1
Microsoft.Kiota.Http.HttpClientLibrary 1.17.1
Microsoft.Kiota.Serialization.Form 1.17.1
Microsoft.Kiota.Serialization.Json 1.17.1
Microsoft.Kiota.Serialization.Multipart 1.17.1
Microsoft.Kiota.Serialization.Text 1.17.1
Microsoft.OData.Core 8.2.3
Microsoft.OData.Edm 8.2.3
Microsoft.OData.ModelBuilder 2.0.0
Microsoft.OpenApi 1.4.3
Microsoft.Recognizers.Text 1.3.2
Microsoft.Recognizers.Text.Choice 1.3.2
Microsoft.Recognizers.Text.DataTypes.TimexExpression 1.3.2
Microsoft.Recognizers.Text.DateTime 1.3.2
Microsoft.Recognizers.Text.Number 1.3.2
Microsoft.Recognizers.Text.NumberWithUnit 1.3.2
Microsoft.Rest.ClientRuntime 2.3.24
Microsoft.SemanticKernel.Abstractions 1.66.0
Microsoft.SemanticKernel.Agents.Abstractions 1.61.0
Microsoft.SemanticKernel.Core 1.66.0
Microsoft.Spatial 8.2.3
Microsoft.Win32.SystemEvents 8.0.0
ModelContextProtocol.Core 0.3.0-preview.3
Newtonsoft.Json 13.0.3
OpenAI 2.5.0
OpenTelemetry 1.8.1
OpenTelemetry.Api 1.9.0
OpenTelemetry.Api.ProviderBuilderExtensions 1.8.1
OpenTelemetry.Exporter.Geneva 1.8.0
OpenTelemetry.Exporter.OneCollector 1.8.0
PolySharp 1.14.1
Std.UriTemplate 2.0.1
System.ClientModel 1.7.0
System.Collections.Immutable 1.4.0
System.ComponentModel.Annotations 4.6.0
System.Configuration.ConfigurationManager 8.0.1
System.Diagnostics.DiagnosticSource 9.0.10
System.Diagnostics.EventLog 9.0.1
System.Drawing.Common 8.0.0
System.Formats.Asn1 8.0.1
System.IdentityModel.Tokens.Jwt 8.12.1
System.IO.Hashing 6.0.0
System.IO.Pipelines 9.0.2
System.Linq.Async 6.0.3
System.Memory 4.5.4
System.Memory.Data 8.0.1
System.Net.ServerSentEvents 10.0.0-preview.4.25258.110
System.Numerics.Tensors 9.0.8
System.Runtime.Caching 8.0.1
System.Runtime.CompilerServices.Unsafe 4.6.0
System.Security.Cryptography.Pkcs 8.0.0
System.Security.Cryptography.ProtectedData 8.0.0
System.Security.Cryptography.Xml 8.0.1
System.Text.Encodings.Web 9.0.2
System.Text.Json 9.0.2
System.Threading.Tasks.Extensions 4.6.3
System.ValueTuple 4.4.0
T4.Build 0.2.4

The same values are provided in a console app and it works as expected. in case of wrong api key, it properly throws 401 code.

To Reproduce
It is "personal" chat in teams app. Following is the code in working and not working setup.
Same exact code in "working" and "non-working" case because we kept it in a class library:

    var deploymentId = "gpt-5"; // our model and deployment name are same

#pragma warning disable CA2208
string? apiKey = ""; // with valid value
//string? apiKey = "wrongkey" // wrong value
?? throw new ArgumentException("Environment variable 'OpenAI:ApiKey' is missing.", "OpenAI:ApiKey");
#pragma warning restore CA2208

_aiAgent = new AzureOpenAIClient(new Uri("https://<>>>.openai.azure.com/"), new AzureKeyCredential(apiKey))
.GetChatClient(deploymentId)
.CreateAIAgent(instructions: ""); //our prompt instruction text
}

public async Task<QHubAIAgentResponse> GetChatResponseAsync(string userInput)
{
    Console.WriteLine($"[INFO] Getting agent response for input: {userInput}");

    try
    {
        var response = await _aiAgent.RunAsync(userInput)!;

Expected behavior
It should work when the provided values are correct as it is working in the console app scenario.

Screenshots

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

Labels

.NETagentsIssues related to single agents

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions