Skip to content

.NET: MissingMethodException on AIProjectClient.GetAIAgent #2869

@gopkumr

Description

@gopkumr

Trying to use Agent Framework with the v2 Prompt agent in Microsoft Foundry and receiving "Method not found" Exception.

Code

var aiProjectClient = new AIProjectClient(new Uri(configuration.AIProjectEndpoint), new AzureCliCredential());
 var existingAgents = aiProjectClient.Agents.GetAgents();
 var existingAgent = existingAgents.FirstOrDefault(q => q.Name == _agentName);
AIAgent agent = aiProjectClient.GetAIAgent(existingAgent);

Exception

System.MissingMethodException: Method not found: 'OpenAI.Responses.OpenAIResponseClient OpenAI.OpenAIClient.GetOpenAIResponseClient(System.String)'.
          at Microsoft.Agents.AI.AzureAI.AzureAIProjectChatClient..ctor(AIProjectClient aiProjectClient, AgentReference agentReference, String defaultModelId, ChatOptions chatOptions)
          at Microsoft.Agents.AI.AzureAI.AzureAIProjectChatClient..ctor(AIProjectClient aiProjectClient, AgentReference agentReference, String defaultModelId, ChatOptions chatOptions)
          at Microsoft.Agents.AI.AzureAI.AzureAIProjectChatClient..ctor(AIProjectClient aiProjectClient, AgentVersion agentVersion, ChatOptions chatOptions)
          at Microsoft.Agents.AI.AzureAI.AzureAIProjectChatClient..ctor(AIProjectClient aiProjectClient, AgentRecord agentRecord, ChatOptions chatOptions)
          at Azure.AI.Projects.AzureAIProjectChatClientExtensions.CreateChatClientAgent(AIProjectClient aiProjectClient, AgentRecord agentRecord, ChatClientAgentOptions agentOptions, Func`2 clientFactory, IServiceProvider services)
          at Azure.AI.Projects.AzureAIProjectChatClientExtensions.CreateChatClientAgent(AIProjectClient AIProjectClient, AgentRecord agentRecord, IList`1 tools, Func`2 clientFactory, Boolean requireInvocableTools, IServiceProvider services)
          at Azure.AI.Projects.AzureAIProjectChatClientExtensions.GetAIAgent(AIProjectClient aiProjectClient, AgentRecord agentRecord, IList`1 tools, Func`2 clientFactory, IServiceProvider services)

Tried adding the below nuget Packages in an attempt to find the missing method

  • Azure.AI.OpenAI 2.8.0-beta.1
  • Azure.AI.Projects 1.2.0-beta.5
  • Azure.AI.Projects.OpenAI 1.0.0-beta.5
  • Microsoft.Agents.AI 1.0.0-preview.251204.1
  • Microsoft.Agents.AI.AzureAI 1.0.0-preview.251204.1
  • Microsoft.Agents.AI.OpenAI 1.0.0-preview.251204.1
  • Microsoft.Extensions.AI 10.1.1
  • Microsoft.Extensions.AI.OpenAI 10.1.1-preview.1.25612.2

Metadata

Metadata

Assignees

Labels

.NETagentsIssues related to single agentsv1.0Features being tracked for the version 1.0 GA

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions