<?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 Connect Databricks Genie AI via API in Databricks Free Edition Help</title>
    <link>https://community.databricks.com/t5/databricks-free-edition-help/how-to-connect-databricks-genie-ai-via-api/m-p/158050#M809</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/219024"&gt;@SantiNath_Dey&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;The Genie API provides two types of capabilities: &lt;STRONG&gt;Conversation APIs&lt;/STRONG&gt; (Public Preview) for natural language data querying in chatbots, applications, and AI agent frameworks, and &lt;STRONG&gt;Management APIs&lt;/STRONG&gt; for programmatic creation, configuration, and deployment of Genie spaces. The conversation APIs support stateful conversations where users can ask follow-up questions over time.&lt;BR /&gt;Using Genie Code programatically is currently not supported:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from databricks.sdk import WorkspaceClient

w = WorkspaceClient()  # picks up env vars or ~/.databrickscfg

# Start a conversation
result = w.genie.start_conversation_and_wait(
    space_id="&amp;lt;your_space_id&amp;gt;",
    content="What were total sales last month?"
)

# Follow-up
follow_up = w.genie.create_message_and_wait(
    space_id="&amp;lt;your_space_id&amp;gt;",
    conversation_id=result.conversation_id,
    content="Break that down by region"
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 01 Jun 2026 12:57:33 GMT</pubDate>
    <dc:creator>szymon_dybczak</dc:creator>
    <dc:date>2026-06-01T12:57:33Z</dc:date>
    <item>
      <title>How to Connect Databricks Genie AI via API</title>
      <link>https://community.databricks.com/t5/databricks-free-edition-help/how-to-connect-databricks-genie-ai-via-api/m-p/158022#M808</link>
      <description>&lt;DIV&gt;How can I connect Databricks Genie AI from a third-party tool using API execution?&lt;/DIV&gt;</description>
      <pubDate>Mon, 01 Jun 2026 05:49:41 GMT</pubDate>
      <guid>https://community.databricks.com/t5/databricks-free-edition-help/how-to-connect-databricks-genie-ai-via-api/m-p/158022#M808</guid>
      <dc:creator>SantiNath_Dey</dc:creator>
      <dc:date>2026-06-01T05:49:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to Connect Databricks Genie AI via API</title>
      <link>https://community.databricks.com/t5/databricks-free-edition-help/how-to-connect-databricks-genie-ai-via-api/m-p/158050#M809</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/219024"&gt;@SantiNath_Dey&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;The Genie API provides two types of capabilities: &lt;STRONG&gt;Conversation APIs&lt;/STRONG&gt; (Public Preview) for natural language data querying in chatbots, applications, and AI agent frameworks, and &lt;STRONG&gt;Management APIs&lt;/STRONG&gt; for programmatic creation, configuration, and deployment of Genie spaces. The conversation APIs support stateful conversations where users can ask follow-up questions over time.&lt;BR /&gt;Using Genie Code programatically is currently not supported:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from databricks.sdk import WorkspaceClient

w = WorkspaceClient()  # picks up env vars or ~/.databrickscfg

# Start a conversation
result = w.genie.start_conversation_and_wait(
    space_id="&amp;lt;your_space_id&amp;gt;",
    content="What were total sales last month?"
)

# Follow-up
follow_up = w.genie.create_message_and_wait(
    space_id="&amp;lt;your_space_id&amp;gt;",
    conversation_id=result.conversation_id,
    content="Break that down by region"
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jun 2026 12:57:33 GMT</pubDate>
      <guid>https://community.databricks.com/t5/databricks-free-edition-help/how-to-connect-databricks-genie-ai-via-api/m-p/158050#M809</guid>
      <dc:creator>szymon_dybczak</dc:creator>
      <dc:date>2026-06-01T12:57:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to Connect Databricks Genie AI via API</title>
      <link>https://community.databricks.com/t5/databricks-free-edition-help/how-to-connect-databricks-genie-ai-via-api/m-p/158055#M810</link>
      <description>&lt;P&gt;Hello&amp;nbsp; &lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/219024"&gt;@SantiNath_Dey&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":waving_hand:"&gt;👋&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Connecting a third-party tool to Databricks Genie AI is fully supported. While you &lt;I&gt;can&lt;/I&gt; use the &lt;STRONG&gt;Databricks Managed MCP Server&lt;/STRONG&gt; (which is perfect if your third-party tool is an AI agent framework like LangGraph or Claude Desktop), the simplest and most common way to execute queries programmatically is using the &lt;STRONG&gt;Genie Spaces REST API&lt;/STRONG&gt; via the Databricks SDK.&lt;/P&gt;&lt;P&gt;Here is the simplest way to get it running without overcomplicating things:&lt;/P&gt;&lt;H3&gt;1. Authentication&lt;/H3&gt;&lt;P&gt;For third-party tools, the best practice is to use &lt;STRONG&gt;OAuth M2M (Service Principal)&lt;/STRONG&gt;. For quick local testing, you can use a &lt;STRONG&gt;Personal Access Token (PAT)&lt;/STRONG&gt;. Your tool simply needs to pass this token via the DATABRICKS_TOKEN environment variable or in the HTTP header as Authorization: Bearer &amp;lt;YOUR_TOKEN&amp;gt;.&lt;/P&gt;&lt;H3&gt;2. The Execution Flow&lt;/H3&gt;&lt;P&gt;Because Genie takes time to analyze data and generate SQL, the API is &lt;STRONG&gt;asynchronous&lt;/STRONG&gt;. The flow always requires two steps:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Ask the question&lt;/STRONG&gt; (Start the conversation).&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Poll for the status&lt;/STRONG&gt; (Loop until the status returns as COMPLETED).&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;You can find the direct reference for these endpoints in the &lt;A class="" href="https://docs.databricks.com/api/azure/workspace/genie" target="_blank" rel="noopener"&gt;Databricks Genie REST API Documentation&lt;/A&gt;.&lt;/P&gt;&lt;H3&gt;3. Python Code Example (Using Databricks SDK)&lt;/H3&gt;&lt;P&gt;Instead of manually wiring up raw REST requests or dealing with complex MCP protocols, you can use the official Databricks SDK (pip install databricks-sdk). See the full &lt;A class="" href="https://databricks-sdk-py.readthedocs.io/en/stable/workspace/dashboards/genie.html" target="_blank" rel="noopener"&gt;Databricks SDK for Python (Genie Modules)&lt;/A&gt; for detailed method details.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from databricks.sdk import WorkspaceClient
import time

# 1. Initialize client (Automatically picks up DATABRICKS_HOST and DATABRICKS_TOKEN from env variables)
w = WorkspaceClient()
space_id = "YOUR_GENIE_SPACE_ID_HERE" # (e.g., a 32-character hex string)
question = "What were the total sales last month?"

# 2. Ask the question to Genie
message = w.genie.start_conversation(
    space_id=space_id,
    content=question
)
conversation_id = message.conversation_id
message_id = message.id

print(f"Asked Genie! Conversation ID: {conversation_id}")

# 3. Poll until Genie is done thinking
while True:
    response = w.genie.get_message(
        space_id=space_id, 
        conversation_id=conversation_id, 
        message_id=message_id
    )
    
    if response.status.value == "COMPLETED":
        print("\nGenie Response:")
        print(response.content)
        break
    elif response.status.value in ["FAILED", "CANCELED"]:
        print(f"\nQuery stopped with status: {response.status.value}")
        break
        
    print("Waiting for Genie to finish...")
    time.sleep(3) # Wait 3 seconds before checking again&lt;/LI-CODE&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;FONT size="5"&gt;&lt;STRONG&gt;What if you &lt;I&gt;must&lt;/I&gt; use the MCP Server?&lt;/STRONG&gt;&lt;/FONT&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;P&gt;If your third-party tool strictly relies on the &lt;STRONG&gt;Model Context Protocol (MCP)&lt;/STRONG&gt; to discover tools, Databricks does provide a managed endpoint:&lt;/P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Untitled 2.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/27449i62C44FF4AAD05EA2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Untitled 2.png" alt="Untitled 2.png" /&gt;&lt;/span&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;URL Pattern:&lt;/STRONG&gt; https://&amp;lt;workspace-url&amp;gt;/api/2.0/mcp/genie&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;MCP Tools:&lt;/STRONG&gt; It exposes genie_ask (to start the chat) and genie_poll_response (to fetch the results).&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;However, unless you are specifically building an agentic workflow that requires MCP tool-calling, sticking to the standard SDK/API approach highlighted above will save you a lot of development overhead!&lt;/P&gt;&lt;P&gt;Hope this helps!&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 01 Jun 2026 13:03:17 GMT</pubDate>
      <guid>https://community.databricks.com/t5/databricks-free-edition-help/how-to-connect-databricks-genie-ai-via-api/m-p/158055#M810</guid>
      <dc:creator>ShamenParis</dc:creator>
      <dc:date>2026-06-01T13:03:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to Connect Databricks Genie AI via API</title>
      <link>https://community.databricks.com/t5/databricks-free-edition-help/how-to-connect-databricks-genie-ai-via-api/m-p/158056#M811</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/219024"&gt;@SantiNath_Dey&lt;/a&gt;&amp;nbsp;, FYI: The managed MCP server feature may not available on the Free/Community Edition of Databricks.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jun 2026 13:09:06 GMT</pubDate>
      <guid>https://community.databricks.com/t5/databricks-free-edition-help/how-to-connect-databricks-genie-ai-via-api/m-p/158056#M811</guid>
      <dc:creator>ShamenParis</dc:creator>
      <dc:date>2026-06-01T13:09:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to Connect Databricks Genie AI via API</title>
      <link>https://community.databricks.com/t5/databricks-free-edition-help/how-to-connect-databricks-genie-ai-via-api/m-p/158063#M812</link>
      <description>&lt;P&gt;Thanks for quick response&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jun 2026 16:36:04 GMT</pubDate>
      <guid>https://community.databricks.com/t5/databricks-free-edition-help/how-to-connect-databricks-genie-ai-via-api/m-p/158063#M812</guid>
      <dc:creator>SantiNath_Dey</dc:creator>
      <dc:date>2026-06-01T16:36:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to Connect Databricks Genie AI via API</title>
      <link>https://community.databricks.com/t5/databricks-free-edition-help/how-to-connect-databricks-genie-ai-via-api/m-p/158069#M813</link>
      <description>&lt;P&gt;No problem &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jun 2026 17:22:31 GMT</pubDate>
      <guid>https://community.databricks.com/t5/databricks-free-edition-help/how-to-connect-databricks-genie-ai-via-api/m-p/158069#M813</guid>
      <dc:creator>szymon_dybczak</dc:creator>
      <dc:date>2026-06-01T17:22:31Z</dc:date>
    </item>
  </channel>
</rss>

