How to find PROJECT_ENDPOINT_STRING to use AI Agents SDK?

Rayane Laraki 20 Reputation points
2025-06-05T17:00:15.3233333+00:00

Hello,

We need to migrate from using Bing API v7.0 to Grounding with Custom Bing Service.
In that context, I am striving to create and leverage my agents using the Python SDK as shown here.

The issue arises when I try to instantiate the client, as I do not find anywhere the PROJECT_ENDPOINT_STRING. My view on the portal is not the same as the screenshot. Under 'Project details' I can see:

  1. Project connection string
  2. Subscription
  3. Subscription ID
  4. Location

I also created a brand new Foundry project and got a closer match with the screenshot, but still could not find the relevant information.

I was able before able to create the client by using AIProjectClient.from_connection_string but apparently has been deprecated.

Thank you in advance for the support.

Azure AI services
Azure AI services
A group of Azure services, SDKs, and APIs designed to make apps more intelligent, engaging, and discoverable.
3,603 questions
0 comments No comments
{count} votes

Accepted answer
  1. JAYA SHANKAR G S 4,035 Reputation points Microsoft External Staff Moderator
    2025-06-12T10:17:21.9766667+00:00

    Hello @Rayane Laraki ,

    You can find project endpoint in Project Overview like below.

    enter image description here

    If you don't find the endpoint there or showing connection string then you are having hub-based project instead of having foundry-based project.

    Check this documentation on how to create foundry-based project.

    After creating it you can able to get project endpoint and use it in code like Azar mentioned.

    If above answer helped you do accept and give feedback clicking on yes.

    Thank you

    1 person found this answer helpful.

2 additional answers

Sort by: Most helpful
  1. Azar 29,520 Reputation points MVP Volunteer Moderator
    2025-06-05T18:53:43.5733333+00:00

    Hi there Rayane Laraki

    Thabnks for using QandA platform

    Yes thats right the AIProjectClient.from_connection_string() method has been deprecated in the newer Azure AI Agents SDK. To use the newer AIClient with PROJECT_ENDPOINT_STRING, what you now need is the Project Endpoint, which is a URL, not the connection string.

    Go to the Azure portal → navigate to your Azure AI Studio (Foundry) project.

    On the left, click on "Project details".

    1. Look for the value labeled “Project endpoint” — this is the PROJECT_ENDPOINT_STRING you need. It will look something like:
         https://<your-project-name>.<region>.inference.ai.azure.com
      

    If you're only seeing a "connection string", you're probably looking at the wrong field — avoid using that with the new SDK.

    from azure.ai.agents import AIClient
    from azure.identity import DefaultAzureCredential
    
    client = AIClient(
        endpoint="https://<your-project-name>.<region>.inference.ai.azure.com",
        credential=DefaultAzureCredential()
    )
    

    If this helps kindly accpt the answer thanks much,


  2. Rayane Laraki 20 Reputation points
    2025-06-13T15:35:55.81+00:00

    Hi @JAYA SHANKAR G S & @Pavankumar Purilla
    Thank you very much for your replies!
    I created a "standalone" foundry project (outside of a hub) and selected Western Europe but unfortunately got this error under the Agents service tab: Screenshot 2025-06-12 at 16.17.55

    As we are required to only use resources located in Europe (and not Asia or US) I repeated the process but chose NorwayEast. I am now able to see the PROJECT_CONNECTION_STRING and do not get the error as above.
    I also connected our model deployments that I am able to see in Models + endpoints tab.
    I finally used the SDK code samples here and was able to successfully create a client, thread, until the following error occured:

    Unclosed client session
    client_session: <aiohttp.client.ClientSession object at 0x1210ce060>
    Unclosed connector
    connections: ['deque([(<aiohttp.client_proto.ResponseHandler object at 0x122ac1670>, 1723857.434361708)])']
    connector: <aiohttp.connector.TCPConnector object at 0x1210cb350>
    Created agent, agent ID: asst_URHdtjV6dGpm1OmPC8Lsi3mq
    Created thread, thread ID: thread_oYKeESbniJu44fPaWdRiATDU
    Created message, message ID: msg_gc27b1otVPUplpvwov2SCHin
    Run status: RunStatus.FAILED
    Run error: {'code': 'invalid_engine_error', 'message': 'Failed to resolve model info for: gpt-4o-mini-mvp'}
    Deleted agent
    

    I am now really close to making it work. Do you think that this is still due to the region?

    Many thanks for the support!


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.