Hi Jason Lee ,
Thank you for reaching out on the Microsoft Q&A forum.
To retrieve your agent using GetAgentAsync, please ensure you are using the Agent ID (GUID) from the Azure AI Foundry portal:
Azure AI Foundry → Project → Agents → Select Agent → Agent Details → Agent ID
Then update your code as follows:
string agentId = "<your-agent-id>";
AgentRecord agentRecord = await _projectClient.Agents.GetAgentAsync(agentId);
var agentVersion = agentRecord.Versions.Latest;
var responseClient = _projectClient.OpenAI.GetProjectResponsesClientForAgent(agentVersion);
var chatClient = responseClient.AsIChatClient();
var agent = chatClient.CreateAIAgent();
return agent.AsAIFunction();
Please also confirm that the agent version is published and deployed within your AI Project.
References:
Azure AI Foundry — Agents Overview https://learn.microsoft.com/en-us/azure/ai-foundry/agents/overview
Quickstart — Create an Agent in Azure AI Foundry https://learn.microsoft.com/en-us/azure/ai-foundry/agents/quickstart
Microsoft Agent Framework — Azure AI Foundry Agent https://learn.microsoft.com/en-us/agent-framework/user-guide/agents/agent-types/azure-ai-foundry-agent
I hope this helps!
If the information is useful, please accept the answer and upvote it to close the thread. Thanks.