<?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: DatabricksVectorSearch seems to crash when served in Generative AI</title>
    <link>https://community.databricks.com/t5/generative-ai/databricksvectorsearch-seems-to-crash-when-served/m-p/135452#M1255</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/166121"&gt;@brahaman&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The notice you're seeing is exactly what's causing the authentication issue when your agent is deployed. When running in a notebook, the `DatabricksVectorSearch` class automatically uses your notebook authentication token (which works fine for development), but this authentication method fails when the agent is served because the deployed endpoint doesn't have access to your personal credentials.&lt;/P&gt;
&lt;H3&gt;The Solution: Use Automatic Authentication Passthrough&lt;/H3&gt;
&lt;P&gt;The &lt;STRONG&gt;recommended approach&lt;/STRONG&gt;&amp;nbsp;for production deployment is to use Databricks' automatic authentication passthrough feature. This eliminates authentication issues by automatically managing credentials for your agent.&lt;/P&gt;
&lt;P&gt;Here's how to fix your code:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;1. Update your agent logging to declare the Vector Search index as a resource:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;```python&lt;BR /&gt;import mlflow&lt;BR /&gt;from mlflow.models.resources import DatabricksVectorSearchIndex, DatabricksServingEndpoint&lt;/P&gt;
&lt;P&gt;# When you log your model, add the resources parameter&lt;BR /&gt;with mlflow.start_run():&lt;BR /&gt;logged_agent_info = mlflow.pyfunc.log_model(&lt;BR /&gt;python_model="your_agent.py", # Your agent file&lt;BR /&gt;artifact_path="agent",&lt;BR /&gt;input_example=input_example,&lt;BR /&gt;example_no_conversion=True,&lt;BR /&gt;resources=[&lt;BR /&gt;DatabricksVectorSearchIndex(&lt;BR /&gt;index_name="dbw_genai_sbx_databricks.unstructured.pdf_docs_chunked_index"&lt;BR /&gt;),&lt;BR /&gt;DatabricksServingEndpoint(&lt;BR /&gt;endpoint_name="databricks-meta-llama-3-3-70b-instruct"&lt;BR /&gt;)&lt;BR /&gt;]&lt;BR /&gt;)&lt;BR /&gt;```&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;2. You don't need to modify your tool initialization code.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;When the agent is deployed with resources declared, Databricks automatically provisions a service principal with the necessary permissions and handles all authentication.&lt;/P&gt;
&lt;H3&gt;How It Works&lt;/H3&gt;
&lt;P&gt;When you declare resources during logging, Databricks:&lt;BR /&gt;1. Verifies you (the deployer) have access to those resources&lt;BR /&gt;2. Automatically creates a service principal for your agent with least-privilege access&lt;BR /&gt;3. Manages short-lived OAuth tokens that are automatically rotated&lt;/P&gt;
&lt;P&gt;This approach provides better security than manual authentication and eliminates the performance overhead mentioned in the notice (up to 100ms per query).&lt;/P&gt;
&lt;H3&gt;Requirements&lt;/H3&gt;
&lt;P&gt;- Ensure you're using &lt;STRONG&gt;MLflow 2.13.1 or above&lt;/STRONG&gt;&amp;nbsp;for Vector Search automatic authentication&lt;BR /&gt;- You must have `Can Use` permission on the Vector Search index when deploying&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps, Louis.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 20 Oct 2025 19:00:25 GMT</pubDate>
    <dc:creator>Louis_Frolio</dc:creator>
    <dc:date>2025-10-20T19:00:25Z</dc:date>
    <item>
      <title>DatabricksVectorSearch seems to crash when served</title>
      <link>https://community.databricks.com/t5/generative-ai/databricksvectorsearch-seems-to-crash-when-served/m-p/121907#M958</link>
      <description>&lt;P&gt;Hey y'all !&lt;/P&gt;&lt;P&gt;So I'm experimenting with the Databricks'&amp;nbsp;&lt;EM&gt;DatanircksVectorSearch&lt;/EM&gt; class in Python to serve as a tool that can be used by an agent. When I run it on a notebook, I get the following error:&lt;BR /&gt;"[NOTICE] Using a notebook authentication token. Recommended for development only. For improved performance, please use Service Principal based authentication. To disable this message, pass disable_notice=True."&lt;BR /&gt;But I do correctly get an output in the notebook. But when I serve it, and test it via the Playground, the agent tells me that it has encountered an issue about authentification and I think it has to do with this notice but I'm not really sure and I don't know how to fix it...&lt;/P&gt;&lt;P&gt;Here's my code:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# -----------------------------
# Initialize the Vector Search tool
vs_tool = DatabricksVectorSearch(
    index_name="dbw_genai_sbx_databricks.unstructured.pdf_docs_chunked_index",
    columns=["chunk_id", "doc_uri", "content_chunked"],
    
)

# -----------------------------
# Function to retrieve information
def retrieve_infs_for_databricks(query: str) -&amp;gt; list[dict[str, Any]]:
    docs = vs_tool.similarity_search(query=query)
    res = []
    for doc in docs:
        res.append({
            "content": doc.page_content,
            "source": doc.metadata["doc_uri"],
            "chunk_id": doc.metadata["chunk_id"],
        })
    print(f"Res:\n{res}")
    return res

# -----------------------------
# LangChain tool definition
tool = Tool(
    name="databricks_docs_retriever",
    func=retrieve_infs_for_databricks,
    description="""
    Searches for infos for Databricks products from the Databricks documentation.
    It accepts a string query which is the main keywords to search for.
    And it returns a list of dictionaries with the following keys:
      - content: contains the retrieved information
      - source: contains the URL of the document where the information was retrieved
      - chunk_id: contains the ID of the chunk where the information was
    When it returns a source, you should also cite the source in your final result.
    """
)

print("----------------------------------------------------------------------")

# -----------------------------
# Initialize LangChain LLM with tools
llm = ChatDatabricks(endpoint="databricks-meta-llama-3-3-70b-instruct")

agent = create_react_agent(
    llm,
    tools=[tool],
)

# -----------------------------
# Example usage
agent.invoke({
    "messages": [
        {"role": "user", "content": "Based on the Databricks documentation, What is the best way to develop an AI agent? And give me the sources"}
    ]
})&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jun 2025 20:54:15 GMT</pubDate>
      <guid>https://community.databricks.com/t5/generative-ai/databricksvectorsearch-seems-to-crash-when-served/m-p/121907#M958</guid>
      <dc:creator>brahaman</dc:creator>
      <dc:date>2025-06-16T20:54:15Z</dc:date>
    </item>
    <item>
      <title>Re: DatabricksVectorSearch seems to crash when served</title>
      <link>https://community.databricks.com/t5/generative-ai/databricksvectorsearch-seems-to-crash-when-served/m-p/135452#M1255</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/166121"&gt;@brahaman&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The notice you're seeing is exactly what's causing the authentication issue when your agent is deployed. When running in a notebook, the `DatabricksVectorSearch` class automatically uses your notebook authentication token (which works fine for development), but this authentication method fails when the agent is served because the deployed endpoint doesn't have access to your personal credentials.&lt;/P&gt;
&lt;H3&gt;The Solution: Use Automatic Authentication Passthrough&lt;/H3&gt;
&lt;P&gt;The &lt;STRONG&gt;recommended approach&lt;/STRONG&gt;&amp;nbsp;for production deployment is to use Databricks' automatic authentication passthrough feature. This eliminates authentication issues by automatically managing credentials for your agent.&lt;/P&gt;
&lt;P&gt;Here's how to fix your code:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;1. Update your agent logging to declare the Vector Search index as a resource:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;```python&lt;BR /&gt;import mlflow&lt;BR /&gt;from mlflow.models.resources import DatabricksVectorSearchIndex, DatabricksServingEndpoint&lt;/P&gt;
&lt;P&gt;# When you log your model, add the resources parameter&lt;BR /&gt;with mlflow.start_run():&lt;BR /&gt;logged_agent_info = mlflow.pyfunc.log_model(&lt;BR /&gt;python_model="your_agent.py", # Your agent file&lt;BR /&gt;artifact_path="agent",&lt;BR /&gt;input_example=input_example,&lt;BR /&gt;example_no_conversion=True,&lt;BR /&gt;resources=[&lt;BR /&gt;DatabricksVectorSearchIndex(&lt;BR /&gt;index_name="dbw_genai_sbx_databricks.unstructured.pdf_docs_chunked_index"&lt;BR /&gt;),&lt;BR /&gt;DatabricksServingEndpoint(&lt;BR /&gt;endpoint_name="databricks-meta-llama-3-3-70b-instruct"&lt;BR /&gt;)&lt;BR /&gt;]&lt;BR /&gt;)&lt;BR /&gt;```&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;2. You don't need to modify your tool initialization code.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;When the agent is deployed with resources declared, Databricks automatically provisions a service principal with the necessary permissions and handles all authentication.&lt;/P&gt;
&lt;H3&gt;How It Works&lt;/H3&gt;
&lt;P&gt;When you declare resources during logging, Databricks:&lt;BR /&gt;1. Verifies you (the deployer) have access to those resources&lt;BR /&gt;2. Automatically creates a service principal for your agent with least-privilege access&lt;BR /&gt;3. Manages short-lived OAuth tokens that are automatically rotated&lt;/P&gt;
&lt;P&gt;This approach provides better security than manual authentication and eliminates the performance overhead mentioned in the notice (up to 100ms per query).&lt;/P&gt;
&lt;H3&gt;Requirements&lt;/H3&gt;
&lt;P&gt;- Ensure you're using &lt;STRONG&gt;MLflow 2.13.1 or above&lt;/STRONG&gt;&amp;nbsp;for Vector Search automatic authentication&lt;BR /&gt;- You must have `Can Use` permission on the Vector Search index when deploying&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps, Louis.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Oct 2025 19:00:25 GMT</pubDate>
      <guid>https://community.databricks.com/t5/generative-ai/databricksvectorsearch-seems-to-crash-when-served/m-p/135452#M1255</guid>
      <dc:creator>Louis_Frolio</dc:creator>
      <dc:date>2025-10-20T19:00:25Z</dc:date>
    </item>
    <item>
      <title>Re: DatabricksVectorSearch seems to crash when served</title>
      <link>https://community.databricks.com/t5/generative-ai/databricksvectorsearch-seems-to-crash-when-served/m-p/152021#M1725</link>
      <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/34815"&gt;@Louis_Frolio&lt;/a&gt;&amp;nbsp;&amp;nbsp;Are there audit logs or visibility into which service principal is being used and what access it has?&lt;/P&gt;&lt;P&gt;Another question: With automatic authentication passthrough, do we still need to set DATABRICKS_HOST and DATABRICKS_TOKEN as environment variables in the serving endpoint configuration?&amp;nbsp;or can those be omitted entirely?&lt;/P&gt;</description>
      <pubDate>Wed, 25 Mar 2026 13:38:45 GMT</pubDate>
      <guid>https://community.databricks.com/t5/generative-ai/databricksvectorsearch-seems-to-crash-when-served/m-p/152021#M1725</guid>
      <dc:creator>ZD</dc:creator>
      <dc:date>2026-03-25T13:38:45Z</dc:date>
    </item>
  </channel>
</rss>

