<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to use an agent from Azure AI Foundry in a Fabric notebook? in Data Engineering</title>
    <link>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-use-an-agent-from-Azure-AI-Foundry-in-a-Fabric-notebook/m-p/4779487#M11331</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/882991"&gt;@v-nmadadi-msft&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Thank you for the hint.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I was unsure where the error could actually be located. As it turned out yesterday, the error is actually in our Fabric environment.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;For historical reasons, our Fabric workspaces are based on a Power BI Premium SKU (P1). This has some limitations compared to the newer Fabric SKU (e.g., F64). Specifically, it lacks exactly those features that are required to use Azure AI Foundry agents from a Python notebook in Fabric.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;The medium-term solution is to switch from a Power BI SKU to a Fabric SKU. Technically, this is not complicated, but in our case it is problematic for commercial reasons.&lt;BR /&gt;&lt;BR /&gt;Many thanks to everyone for your support!&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;Udo&lt;/P&gt;</description>
    <pubDate>Tue, 29 Jul 2025 07:09:08 GMT</pubDate>
    <dc:creator>Udo_S</dc:creator>
    <dc:date>2025-07-29T07:09:08Z</dc:date>
    <item>
      <title>How to use an agent from Azure AI Foundry in a Fabric notebook?</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-use-an-agent-from-Azure-AI-Foundry-in-a-Fabric-notebook/m-p/4774017#M11180</link>
      <description>&lt;P&gt;Dear all,&lt;BR /&gt;We want to use an agent that we created in Azure AI Foundry in a Python notebook in Fabric. Unfortunately, we have no idea how that works fundamentally and how the authentication works in particular.&lt;BR /&gt;I am grateful for any help.&lt;BR /&gt;Best regards,&lt;BR /&gt;Udo&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jul 2025 16:33:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-use-an-agent-from-Azure-AI-Foundry-in-a-Fabric-notebook/m-p/4774017#M11180</guid>
      <dc:creator>Udo_S</dc:creator>
      <dc:date>2025-07-23T16:33:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to use an agent from Azure AI Foundry in a Fabric notebook?</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-use-an-agent-from-Azure-AI-Foundry-in-a-Fabric-notebook/m-p/4774597#M11192</link>
      <description>&lt;P&gt;To use an agent from azure AI foundry in a Fabric notebook you need to interact with the agent’s REST API endpoint, which becomes available once the agent is deployed in azure AI studio. The process fundamentally involves sending an HTTP request from the notebook to the agent’s endpoint with appropriate authentication. You can authenticate in one of two main ways: using an AAD access token or with an API key, depending on how the agent is configured in Azure AI Studio. In Fabric notebooks, authentication using AAD typically involves leveraging the Azure Identity library to generate a token for the cognitive services scope. If your agent is set up with API key authentication, you will need to include the key in the request header. It is important to ensure that your Fabric workspace has been properly configured to access external endpoints if using private networking. Once authentication is set up correctly, your notebook can send messages to the agent and receive intelligent responses as part of your workflow.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Please 'Kudos' and 'Accept as Solution' if this answered your query.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Jul 2025 06:34:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-use-an-agent-from-Azure-AI-Foundry-in-a-Fabric-notebook/m-p/4774597#M11192</guid>
      <dc:creator>Vinodh247</dc:creator>
      <dc:date>2025-07-24T06:34:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to use an agent from Azure AI Foundry in a Fabric notebook?</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-use-an-agent-from-Azure-AI-Foundry-in-a-Fabric-notebook/m-p/4774710#M11196</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/782942"&gt;@Udo_S&lt;/a&gt;&amp;nbsp; , &lt;BR /&gt;Thanks for reaching out to the Microsoft fabric community forum.&lt;BR /&gt;&lt;BR /&gt;To get started on how to use Azure AI foundry with Fabric Notebooks, You can refer these articles for more information for the points mentioned by&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/640329"&gt;@Vinodh247&lt;/a&gt;&amp;nbsp; who talks about using the REST API endpoint.&lt;BR /&gt;&lt;A href="https://learn.microsoft.com/en-us/python/api/overview/azure/ai-projects-readme?view=azure-python-preview" target="_blank" rel="noopener"&gt;Azure AI Projects client library for Python | Microsoft Learn&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://learn.microsoft.com/en-us/azure/ai-foundry/agents/quickstart?pivots=programming-language-python-azure" target="_blank" rel="noopener"&gt;Quickstart - Create a new Azure AI Foundry Agent Service project - Azure AI Foundry | Microsoft Learn&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://learn.microsoft.com/en-us/python/api/overview/azure/ai-projects-readme?view=azure-python-preview" target="_blank" rel="noopener"&gt;Azure AI Projects client library for Python | Microsoft Learn&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Other than that approach, to ease things instead of Using Azure AI foundry there is also a feature called Fabric data agent where you can create conversational AI experiences that answer questions about data stored in lakehouses, warehouses, Power BI semantic models, and KQL databases in Fabric itself&lt;BR /&gt;Please check this article to know more about it and learn how to create it: &lt;BR /&gt;&lt;A href="https://learn.microsoft.com/en-us/fabric/data-science/how-to-create-data-agent" target="_blank" rel="noopener"&gt;Create a Fabric data agent (preview) - Microsoft Fabric | Microsoft Learn&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;You can then use Fabric data agent SDK to connect to the agent using your Fabric Notebook, the SDK is designed for code-first users, and it simplifies the creation, management, and utilization of Fabric data agents within Microsoft Fabric notebooks.&lt;BR /&gt;&lt;A href="https://learn.microsoft.com/en-us/fabric/data-science/fabric-data-agent-sdk" target="_blank" rel="noopener"&gt;Fabric data agent Python SDK (preview) - Microsoft Fabric | Microsoft Learn&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;If the Azure AI Foundry approach feels too complex, consider using the Fabric Data Agent as a simpler alternative to achieve your requirements.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;I hope this information helps. Please do let us know if you have any further queries.&lt;BR /&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Thu, 24 Jul 2025 07:37:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-use-an-agent-from-Azure-AI-Foundry-in-a-Fabric-notebook/m-p/4774710#M11196</guid>
      <dc:creator>v-nmadadi-msft</dc:creator>
      <dc:date>2025-07-24T07:37:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to use an agent from Azure AI Foundry in a Fabric notebook?</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-use-an-agent-from-Azure-AI-Foundry-in-a-Fabric-notebook/m-p/4776027#M11243</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/640329"&gt;@Vinodh247&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/882991"&gt;@v-nmadadi-msft&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;Thanks for your help!&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As it turns out, we are missing permissions for our Azure subscriptions. Once that is corrected, we can conduct further tests.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;Udo&lt;/P&gt;</description>
      <pubDate>Fri, 25 Jul 2025 06:46:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-use-an-agent-from-Azure-AI-Foundry-in-a-Fabric-notebook/m-p/4776027#M11243</guid>
      <dc:creator>Udo_S</dc:creator>
      <dc:date>2025-07-25T06:46:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to use an agent from Azure AI Foundry in a Fabric notebook?</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-use-an-agent-from-Azure-AI-Foundry-in-a-Fabric-notebook/m-p/4776674#M11255</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/882991"&gt;@v-nmadadi-msft&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/882991"&gt;@v-nmadadi-msft&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;The permission issue has been resolved, but I still can't fully understand the root of the problem. Perhaps a bit more context from my side will help:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;I have a Fabric workspace with a Python notebook.&lt;/LI&gt;&lt;LI&gt;I also have a subscription in the Azure Portal, and the Fabric workspace has been assigned the Contributor role on this subscription.&lt;/LI&gt;&lt;LI&gt;Within this subscription, I created a project in Azure AI Foundry, which includes a project endpoint.&lt;/LI&gt;&lt;LI&gt;Finally, I created an agent within this project. This agent has an Agent ID, but I can't find any additional credentials—such as a REST API key or any other form of authentication.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;I tried running the following code in my notebook, hoping that authentication would happen automatically since the Fabric workspace has contributor permissions on my Azure subscription:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;project = AIProjectClient(
    credential=DefaultAzureCredential(),
    endpoint="PROJECT_ENDPOINT")

agent = project.agents.get_agent("AGENT_ID")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;But this doesn't work.&lt;BR /&gt;&lt;BR /&gt;I must admit I'm not a pro when it comes to Azure, therefore I would be very grateful if someone could give me a specific hint about what I need to do — for example, where to find the credentials for the agent's REST API (if that is the correct approach).&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Many thanks in advance!&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;Udo&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Jul 2025 16:27:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-use-an-agent-from-Azure-AI-Foundry-in-a-Fabric-notebook/m-p/4776674#M11255</guid>
      <dc:creator>Udo_S</dc:creator>
      <dc:date>2025-07-25T16:27:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to use an agent from Azure AI Foundry in a Fabric notebook?</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-use-an-agent-from-Azure-AI-Foundry-in-a-Fabric-notebook/m-p/4777300#M11265</link>
      <description>&lt;P&gt;Great! Pls drop in here after your tests to see how it goes.&lt;/P&gt;</description>
      <pubDate>Sun, 27 Jul 2025 01:43:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-use-an-agent-from-Azure-AI-Foundry-in-a-Fabric-notebook/m-p/4777300#M11265</guid>
      <dc:creator>Vinodh247</dc:creator>
      <dc:date>2025-07-27T01:43:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to use an agent from Azure AI Foundry in a Fabric notebook?</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-use-an-agent-from-Azure-AI-Foundry-in-a-Fabric-notebook/m-p/4777405#M11268</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/640329"&gt;@Vinodh247&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;SPAN&gt;Unfortunately, the tests didn't go well. I'm still totally stuck when it comes to authenticating my agent in Fabric.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I tried assigning a contributor role to my Fabric workspace in the Azure portal and I tried CLI authentication. Both didn't work. I don't see any API endpoint for my agent (jut an ID).&lt;BR /&gt;AI (Perplexity and ChatGPT) suggest using using environment variables as an alternative, but this only applies to apps and not to agents.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;Unfortunately, by now I am quite desperate.&amp;nbsp;&lt;/STRONG&gt;I left a reply below with some context, and I hope that someone might come up with a step-by-step guide for my specific problem.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 27 Jul 2025 11:02:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-use-an-agent-from-Azure-AI-Foundry-in-a-Fabric-notebook/m-p/4777405#M11268</guid>
      <dc:creator>Udo_S</dc:creator>
      <dc:date>2025-07-27T11:02:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to use an agent from Azure AI Foundry in a Fabric notebook?</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-use-an-agent-from-Azure-AI-Foundry-in-a-Fabric-notebook/m-p/4779360#M11329</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/782942"&gt;@Udo_S&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;SPAN&gt;In this Forum you will find people who are good at Power BI and Fabric, as the root cause of the issue is related to Azure AI Foundry, for issues related to it, please raise a question in Azure Community &amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://azure.microsoft.com/en-us/support/community/?msockid=0408defa328e6ed00058cbc533666fa4" target="_blank" rel="nofollow noopener noreferrer"&gt;Azure Community Support | Microsoft Azure&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;to get the best possible help.&lt;BR /&gt;&lt;/SPAN&gt;Azure community members who are good with Azure AI Foundry will take a look and will provide suggestions.&lt;BR /&gt;&lt;SPAN&gt;In the meantime for any other issues related to Fabric please don’t hesitate to raise a post in this forum.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;Thank you&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jul 2025 05:17:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-use-an-agent-from-Azure-AI-Foundry-in-a-Fabric-notebook/m-p/4779360#M11329</guid>
      <dc:creator>v-nmadadi-msft</dc:creator>
      <dc:date>2025-07-29T05:17:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to use an agent from Azure AI Foundry in a Fabric notebook?</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-use-an-agent-from-Azure-AI-Foundry-in-a-Fabric-notebook/m-p/4779487#M11331</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/882991"&gt;@v-nmadadi-msft&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Thank you for the hint.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I was unsure where the error could actually be located. As it turned out yesterday, the error is actually in our Fabric environment.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;For historical reasons, our Fabric workspaces are based on a Power BI Premium SKU (P1). This has some limitations compared to the newer Fabric SKU (e.g., F64). Specifically, it lacks exactly those features that are required to use Azure AI Foundry agents from a Python notebook in Fabric.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;The medium-term solution is to switch from a Power BI SKU to a Fabric SKU. Technically, this is not complicated, but in our case it is problematic for commercial reasons.&lt;BR /&gt;&lt;BR /&gt;Many thanks to everyone for your support!&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;Udo&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jul 2025 07:09:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-use-an-agent-from-Azure-AI-Foundry-in-a-Fabric-notebook/m-p/4779487#M11331</guid>
      <dc:creator>Udo_S</dc:creator>
      <dc:date>2025-07-29T07:09:08Z</dc:date>
    </item>
    <item>
      <title>SOLVED: How to use an agent from Azure AI Foundry in a Fabric notebook?</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-use-an-agent-from-Azure-AI-Foundry-in-a-Fabric-notebook/m-p/4809220#M11983</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We have now found a solution to our problem, which I would like to briefly document here. Perhaps it will help someone else who is struggling with a similar issue as we were.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First, let me briefly restate the challenge (which can serve as an example for other similar use cases):&lt;/P&gt;&lt;P&gt;We created an Agent in Azure AI Foundry. We want to use this Agent in a Python Notebook in Fabric (to clarify: this is not about a "Fabric Agent," which is not helpful for our purposes).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The agent uses an LLM (in our case, gpt-4o) and a tool for web search (in our case, Bing Grounding Search).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The agent should perform a web search based on product data from a Lakehouse table (e.g., an EAN number) and enrich the product data in the Lakehouse with the results from the web search.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Our main problem was authenticating the agent in Fabric.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the solution:&lt;/P&gt;&lt;P&gt;The magic word is "Role-Based Access Control" (RBAC).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Requirements:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;An Azure subscription.&lt;/LI&gt;&lt;LI&gt;A project in Azure AI Foundry ( &lt;A href="https://learn.microsoft.com/en-us/azure/ai-foundry/how-to-create-projects?tabs=ai-foundry&amp;amp;pivots=fdp-project" target="_blank" rel="noopener"&gt;https://learn.microsoft.com/en-us/azure/ai-foundry/how-to-create-projects?tabs=ai-foundry&amp;amp;pivots=fdp-project&lt;/A&gt;)&lt;/LI&gt;&lt;LI&gt;An Agent in Azure AI Foundry ( &lt;A href="https://learn.microsoft.com/en-us/azure/ai-foundry/agents/quickstart?pivots=ai-foundry-portal" target="_blank" rel="noopener"&gt;https://learn.microsoft.com/en-us/azure/ai-foundry/agents/quickstart?pivots=ai-foundry-portal&lt;/A&gt;)&lt;/LI&gt;&lt;LI&gt;An Azure Service Principal at the tenant level (setup is fairly simple, but can only be done by someone with the Cloud Application Administrator role).&lt;/LI&gt;&lt;LI&gt;An Azure Key Vault.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Once the prerequisites are met, the following initial steps must be performed:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Open the project in the Azure Portal and assign the Service Principal the role of "Azure AI User" via "Access Control (IAM)" (this is the crucial step in "Role-Based Access Control").&lt;/LI&gt;&lt;LI&gt;In the Azure Portal, create a Client Secret for the Service Principal and store the secret in the Azure Key Vault.&lt;/LI&gt;&lt;LI&gt;The following data should also be stored in the Azure Key Vault:&lt;/LI&gt;&lt;/OL&gt;&lt;UL&gt;&lt;LI&gt;The Tenant ID.&lt;/LI&gt;&lt;LI&gt;The Tlient ID of the Service Principal.&lt;/LI&gt;&lt;/UL&gt;&lt;OL&gt;&lt;LI&gt;In addition, you will need the project endpoint and the ID of the Foundry Agent.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Foundry Agent can now be used in a Python Notebook in Fabric. Below is a code example.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Maybe this helps someone. Feel free to reach out if you have any questions about the procedure described above.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;BR /&gt;Udo&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from azure.ai.projects import AIProjectClient
from azure.identity import ClientSecretCredential
from azure.ai.agents.models import ListSortOrder

# Retrieve secrets from Azure Key Vault using mssparkutils
TENANT_ID = mssparkutils.credentials.getSecret('YOUR-KEY-VAULT-URL','TENANT_ID')
CLIENT_ID = mssparkutils.credentials.getSecret('YOUR-KEY-VAULT-URL','CLIENT_ID')
CLIENT_SECRET = mssparkutils.credentials.getSecret('YOUR-KEY-VAULT-URL','CLIENT_SECRET')
PROJECT_ENDPOINT = 'YOUR-PROJECT-ENDPOINT"

# Define credentials for authentication
credential = ClientSecretCredential(
    tenant_id=TENANT_ID,
    client_id=CLIENT_ID,
    client_secret=CLIENT_SECRET
)

# Initialize the AI project client with the credentials and endpoint
project = AIProjectClient(credential=credential, endpoint=PROJECT_ENDPOINT)

# Retrieve the specific agent by its ID
agent = project.agents.get_agent('YOUR-AGENT-ID')

# Create a new thread for the conversation
thread = project.agents.threads.create()
print(f"Created thread, ID: {thread.id}")

# Send a message to the agent with the specific query
message = project.agents.messages.create(
    thread_id=thread.id,
    role="user",
    content="Hello Agent"
)
# Create and process a run for the agent to handle the message
run = project.agents.runs.create_and_process(
    thread_id=thread.id,
    agent_id=agent.id
)
# Check the status of the run and handle accordingly
if run.status == "failed":
    print(f"Run failed: {run.last_error}")
else:
    # Retrieve and print all messages in the thread in ascending order
    messages = project.agents.messages.list(thread_id=thread.id, order=ListSortOrder.ASCENDING)
    for message in messages:
        if message.text_messages:
            print(f"{message.role}: {message.text_messages[-1].text.value}")&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Aug 2025 14:09:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-use-an-agent-from-Azure-AI-Foundry-in-a-Fabric-notebook/m-p/4809220#M11983</guid>
      <dc:creator>Udo_S</dc:creator>
      <dc:date>2025-08-27T14:09:22Z</dc:date>
    </item>
  </channel>
</rss>

