Forum Discussion
Using a data agent in a notebook
- 7 months ago
Hello KimTutein,
Please consider raising a Microsoft support ticket for further investigation. You can explain all the troubleshooting steps you have taken to help them better understand the issue.
You can create a Microsoft support ticket with the help of the link below:
https://learn.microsoft.com/en-us/power-bi/support/create-support-ticket
Hi KimTutein ,
You're right — the tutorial you found on Microsoft Learn uses the deprecated Assistants API, which is why you're seeing the warning.
Microsoft Fabric has evolved its Data Agent API, and the recommended SDK (fabric-data-agent-sdk) now uses the Responses API instead.
Install the latest SDK -- !pip install --upgrade fabric-data-agent-sdk
Updated Code Snippet (using Responses API)
from fabric_data_agent_sdk import FabricClient
# Authenticate using current Fabric identity (within notebook)
fabric = FabricClient()
# Your data agent name (must already exist)
agent_name = "MyAgent"
# Ask a question or send a command
response = fabric.responses.create(
data_agent_name=agent_name,
query="What are the top 5 products by sales?"
)
# Display the response
print(response.answer)
This avoids the deprecated .beta.threads.create() syntax.
The SDK automatically authenticates using the Fabric notebook context (no secrets/tokens needed).
The query can be natural language or SQL, depending on your agent configuration.
Make sure you're using the latest SDK methods, especially since Fabric is still evolving fast.
If this post helps, then please appreciate giving a Kudos or accepting as a Solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
Hi ssrithar
Thank you for your message
Install the latest SDK --
!pip install --upgrade fabric-data-agent-sdk
#This part does not work - I am not sure how to import the FabricClient?
from fabric_data_agent_sdk import FabricClient
#I tried something like below - however this client