Forum Discussion

TySu's avatar
TySu
Copper Contributor
May 08, 2025

Azure AI Foundry/Azure AI Service - cannot access agents

I'm struggling with getting agents to work via API which were defined in AI Foundry (based on Azure AI Service).

When defining agent in project in AI Foundry I can use it in playground via web browser. The issue appears when I'm trying to access them via API (call from Power Automate). When executing Run on agent I get info that agent cannot be found.

The issue doesn't exist when using Azure OpenAI and defining assistants. I can use them both via API and web browser.

I guess that another layer of management which is project might be an issue here. I saw usage of SDK in Python and first call is to connect to a project and then get an agent.

Does anyone of you experienced the same? Is a way to select and run agent via API?

2 Replies

  • benray20's avatar
    benray20
    Copper Contributor

    Hi Gabrield. Thanks for the info I am using this and It is failing as it says the API version is not supported. Any reason as to why this would be happening.

     

    https://xxxxxxxx.services.ai.azure.com/api/projects/xxxxxxx/agents?api-version=2025-05-16

     

  • you need to use the full project endpoint URL, which looks like this: https://<your-service>.services.ai.azure.com/api/projects/<your-project-id>. You can find this exact URL by opening your project in the Foundry portal and checking the Overview or API tab. It is important to use the real project ID from the URL and not just the project name. Once you have the correct endpoint, you can authenticate using Azure Active Directory credentials or an API key with the proper role assigned, such as Azure AI User. Then, you can list agents using a GET request to https://<your-service>.services.ai.azure.com/api/projects/<your-project-id>/agents?api-version=2025-05-16, create a thread with POST to /threads, send a message with POST to /messages, run the agent using POST to /runs, and retrieve the results with GET to /runs/{runId}/steps. These API calls follow the same structure as the Azure OpenAI Assistants API. More information is available in the official Microsoft documentation at Quickstart - Create a new Azure AI Foundry Agent Service project - Azure AI Foundry | Microsoft Learn

Resources