Share via

How to get an API endpoint into an agent?

Reynold 0 Reputation points
2025-03-13T05:11:19.8666667+00:00

I created an agent through AI Foundry. How can I get an endpoint for it? Because on the "Models + endpoints" page, I see an endpoint for the base model as far as I understand, but how can I get an endpoint for the agent?
User's image

Foundry Tools
Foundry Tools

Formerly known as Azure AI Services or Azure Cognitive Services is a unified collection of prebuilt AI capabilities within the Microsoft Foundry platform

0 comments No comments

1 answer

Sort by: Most helpful
  1. Saideep Anchuri 9,545 Reputation points Moderator
    2025-03-13T09:40:08.8833333+00:00

    Hi Reynold

    For Agents, There does not seem to be endpoint and key for authentication.  You can get the agent id with below code from UI containing the agents and use it for thread creation.

    Kindly refer below screenshot:

    User's image

    Here is the code:

    # Create a thread with messages
    thread = project_client.agents.create_thread()
    message = project_client.agents.create_message(
        thread_id=thread.id,
        role="user",
        content="Could you please create a bar chart for the operating profit using the following data and provide the file to me? Company A: $1.2 million, Company B: $2.5 million, Company C: $3.0 million, Company D: $1.8 million",
    )
     
    # Ask the agent to perform work on the thread
    run = project_client.agents.create_and_process_run(thread_id=thread.id, agent_id=agent.id)
     
    # Fetch and log all messages to see the agent's response
    messages = project_client.agents.list_messages(thread_id=thread.id)
    print(f"Messages: {messages}")
    
    
    

    Kindly refer below link: what-is-an-ai-agent

    Hope this helps. Do let us know if you any further queries.

     


    If this answers your query, do click Accept Answer and Yes for was this answer helpful.

    Thank You.

    Was this answer helpful?


Your answer

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