Forum Discussion

Shiyao's avatar
Shiyao
Microsoft Employee
1 year ago
Solved

Fabric data agent

I created a Fabric data agent and connected it as a knowledge source via Azure AI Foundry agent. I also developed a custom python application and run the Azure AI Foundry agent. But the run info of the agent only shows input and output (with some obfuscated tags like【92:0†source】) of the connected Fabric data agent, not the SQL query code it uses in response. Is it possible to fetch this SQL query Fabric data agent generates within agent run via Azure AI Projects Python SDK.

  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi Shiyao ,

    You're absolutely right currently, the Fabric Data Agent SDK is indeed limited to the Fabric runtime (like notebooks) and doesn’t support integration directly within a custom Python backend running outside Fabric. And unfortunately, even when running inside Fabric, it doesn’t expose the raw SQL queries the data agent generates during inference or interaction with the Azure AI Foundry agent.

    At this point, Microsoft hasn’t provided a built-in way to log or intercept the translated SQL queries within an agent run via the Azure AI Projects Python SDK. The obfuscated references (like ) are more about traceability than transparency.

    If your goal is to manually or automatically validate what SQL was generated, a workaround could be:

    • Injecting a custom critic or reasoning prompt into your Foundry agent pipeline that forces the agent to explain what SQL it would run not perfect, but it helps with transparency.
    • Raising feedback to Microsoft, since SQL traceability during inference is a critical need for auditing and enterprise-grade validation. This is still a gap in the current agent ecosystem.

    Thanks,
    Akhil.

7 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Shiyao 

    Based on the latest documentation and updates, the Fabric Data Agent Python SDK does allow for programmatic interaction with data agents, including evaluation and inspection of responses. However, it does not currently expose the raw SQL queries generated by the Fabric data agent during a run via the Azure AI Projects Python SDK.

    The obfuscated tags like 【92:0†source】 are part of the internal referencing system used to trace back to the knowledge source, but they don’t reveal the actual SQL logic used behind the scenes.

    You can, evaluate agent responses using structured test sets. Retrieve detailed logs and evaluation summaries and customize evaluation prompts to judge answer quality.

    For official guidance, check out.

    If you're aiming to debug or audit the SQL logic, your best bet might be to use a custom critic prompt during evaluation that asks the agent to explain its reasoning or inferred query logic.
    ------------------------------------------------------------------------------------------------------------------------------
    If this solution works for you, please consider marking it as accepted so others facing a similar issue can benefit too.

    Regards,
    Akhil.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Shiyao 


    just following up to see if the info on using the Fabric Data Agent SDK for evaluation and response inspection was helpful. Were you able to try customizing the evaluation prompts to get more insight into the query logic?

    If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it!


    Regards,
    Akhil.

    • Shiyao's avatar
      Shiyao
      Microsoft Employee

      Using Fabric Data Agent SDK won't help as I can't host my Python backend code completely in Fabric runtime. As I understand, Fabric Data Agent SDK is only supported in Fabric notebook. I'm looking for logging the translated SQL queries for manual/automated fact checking while users are interacting with Azure AI Foundry agent, not about just a few sample evaluation prompts.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Shiyao ,

    You're absolutely right currently, the Fabric Data Agent SDK is indeed limited to the Fabric runtime (like notebooks) and doesn’t support integration directly within a custom Python backend running outside Fabric. And unfortunately, even when running inside Fabric, it doesn’t expose the raw SQL queries the data agent generates during inference or interaction with the Azure AI Foundry agent.

    At this point, Microsoft hasn’t provided a built-in way to log or intercept the translated SQL queries within an agent run via the Azure AI Projects Python SDK. The obfuscated references (like ) are more about traceability than transparency.

    If your goal is to manually or automatically validate what SQL was generated, a workaround could be:

    • Injecting a custom critic or reasoning prompt into your Foundry agent pipeline that forces the agent to explain what SQL it would run not perfect, but it helps with transparency.
    • Raising feedback to Microsoft, since SQL traceability during inference is a critical need for auditing and enterprise-grade validation. This is still a gap in the current agent ecosystem.

    Thanks,
    Akhil.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Shiyao ,

    Just following up here. As noted, the current SDK limitations restrict SQL visibility and external integration. If this remains a blocker, please feel free to reach Microsoft Fabric Community Forum.

    Regards,
    Akhil

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Shiyao ,

    Just circling back once more to check if you had a chance to explore any of the workarounds we discussed particularly injecting a reasoning prompt to extract the SQL logic or raising feedback through official channels.

    If the limitation is still holding up your use case. happy to help where possible.

    Thanks again,
    Akhil.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Shiyao ,

    Since we haven’t heard back from you, we’ll proceed to close this thread for now. If you continue to experience issues or have any additional questions, feel free to start a new thread in the Microsoft Fabric Community Forum. We’re always here to help and happy to support you.


    Regards,
    Akhil.