The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
08-05-2025 13:13 PM
Recently, I posted that the Semantic Models are the most valuable asset in your data estate to be used for Data Agents. Semantic Models are (mostly) put in perspective of the business users, using easy to understand terminology and avoiding technical setups like PascalCase or camelCase. Also, your business logic mostly lives in the Semantic Model, captured in DAX expressions. For each of these model objects, you may (or you should have) enriched the model with descriptions and synonyms.
However, it was only shortly after that I could no other than conclude that Data Agents do not use the synonyms that are added to the Semantic Model. The implicit measures generated by the Data Agent, may return different results then when you ask the very same question in Power BI Copilot directly, or using the good old Power BI Q&A visual. By simply adding the synonyms to the AI notes for the Data Agent, which are captured on the right-hand side in the Data Agent editor, it will actually use that input to find the right measures in your Semantic Model.
In the Notebook, I'm focusing on collecting the synonyms that are added by the developer, by simply filtering to only the items that have a Las Modified time. Collection of all this information happens using Semantic Link Labs. With all the information, I'm building a text string that can be copy-pasted to an existing Data Agent or populated automatically as I'm doing in the next steps.
# Get all synynyms in the semantic model
allsynonyms = labs.list_synonyms(dataset = semanticmodel_name, workspace= workspace_name)
# By default the synonym field is populated with the object name. Therefore, filtering down to only relevant ones
# filter out all rows where the object name is the same as the synonym
relevantsynonyms = allsynonyms["IsExactMatch"] = allsynonyms["Object Name"].str.lower() == allsynonyms["Synonym"].str.lower()
Next, I'm setting up a new Data Agent (defaults to the same workspace) to make sure I can populate the AI Notes with the text string with synonyms. To do so, I'm using the Data Agent SDK. The following actions are performed:
# Update Data Agent config to add instructions
data_agent.update_configuration(
instructions=f"{result_text}",
user_description=f"Data agent to assist users with insights from the Semantic Model {semanticmodel_name}",
)
# Get current configuration
data_agent.get_configuration()
The Notebook cell nicely outputs the configured instructions for the Data Agent. When we open the Data Agent, we see the information populated there as well.
Once the data source (Semantic Model) is connected to the Data Agent, no tables are selected yet. All though the SDK allows to directly link tables, I did not automate this, as I believe this is for the Data Analyst to decide which tables are relevant (like Field parameters, which appear as tables in a model). In that same light, some of the synonyms collected in earlier steps, may not be relevant to bring along to the Data Agent.
https%3A%2F%2Fgithub.com%2Fmarclelijveld%2FFabric-Automation%2Fblob%2Fmain%2FData%2520Agents%2FNB_CREATE_DataAgentSemanticModel.ipynb
Any idea why the "user_description" parameter does not seem to work? I.e. including a description value still results in a "None" in the get_configuration() output.
Hmm... should be included. Feels like a bug. Will report it.
Something went wrong including the link to the full Notebook...
Here's the link to my GitHub which includes the full notebook.