Karthik_Karanm
New Contributor III

Hi Community,

I'm working with the Databricks Genie multi-agent framework and using the GenieAgent to generate SQL queries from natural language questions.

I've instantiated the agent like this:

from databricks.genie.agents import GenieAgent
from databricks.sdk import WorkspaceClient

genie_agent = GenieAgent(
    genie_space_id=GENIE_SPACE_ID,
    genie_agent_name="Genie",
    description=genie_agent_description,
    client=WorkspaceClient(
        host=os.getenv("DB_MODEL_SERVING_HOST_URL"),
        token=os.getenv("DATABRICKS_GENIE_PAT"),
    ),
)

The agent returns a result (i.e., the answer to the user's query), but it does not return the corresponding SQL query that was executed or generated. For my use case, I need to access the generated SQL as well, for transparency and debugging purposes.

Has anyone else encountered this?
Is there a specific way to extract the SQL query from the GenieAgent output?
Any configuration I might be missing?

Thanks in advance!