Skip to content

Framework for orchestrating role-playing, autonomous AI agents. By fostering collaborative intelligence, CrewAI empowers agents to work together seamlessly, tackling complex tasks.

feat(tools): declare env_vars on DatabricksQueryTool (#5892)

Thiago Morettoc3ef622ec65f
diff --git a/lib/crewai-tools/src/crewai_tools/tools/databricks_query_tool/databricks_query_tool.py b/lib/crewai-tools/src/crewai_tools/tools/databricks_query_tool/databricks_query_tool.py
index ba9a375bd..2ce9338ab 100644
--- a/lib/crewai-tools/src/crewai_tools/tools/databricks_query_tool/databricks_query_tool.py
+++ b/lib/crewai-tools/src/crewai_tools/tools/databricks_query_tool/databricks_query_tool.py
@@ -4,7 +4,7 @@ import os
import time
from typing import TYPE_CHECKING, Any, TypeGuard, TypedDict
-from crewai.tools import BaseTool
+from crewai.tools import BaseTool, EnvVar
from pydantic import BaseModel, Field, model_validator
@@ -99,6 +99,25 @@ class DatabricksQueryTool(BaseTool):
_workspace_client: WorkspaceClient | None = None
package_dependencies: list[str] = Field(default_factory=lambda: ["databricks-sdk"])
+ env_vars: list[EnvVar] = Field(
+ default_factory=lambda: [
+ EnvVar(
+ name="DATABRICKS_HOST",
+ description="Databricks workspace URL (use with DATABRICKS_TOKEN, or set DATABRICKS_CONFIG_PROFILE instead).",
+ required=False,
+ ),
+ EnvVar(
+ name="DATABRICKS_TOKEN",
+ description="Databricks personal access token (pair with DATABRICKS_HOST).",
+ required=False,
+ ),
+ EnvVar(
+ name="DATABRICKS_CONFIG_PROFILE",
+ description="Databricks CLI profile name (alternative to DATABRICKS_HOST/TOKEN).",
+ required=False,
+ ),
+ ]
+ )
def __init__(
self,
diff --git a/lib/crewai-tools/tool.specs.json b/lib/crewai-tools/tool.specs.json
index 6f759c5d8..6afe92ca7 100644
--- a/lib/crewai-tools/tool.specs.json
+++ b/lib/crewai-tools/tool.specs.json
@@ -6821,7 +6821,26 @@
},
{
"description": "Execute SQL queries against Databricks workspace tables and return the results. Provide a 'query' parameter with the SQL query to execute.",
- "env_vars": [],
+ "env_vars": [
+ {
+ "default": null,
+ "description": "Databricks workspace URL (use with DATABRICKS_TOKEN, or set DATABRICKS_CONFIG_PROFILE instead).",
+ "name": "DATABRICKS_HOST",
+ "required": false
+ },
+ {
+ "default": null,
+ "description": "Databricks personal access token (pair with DATABRICKS_HOST).",
+ "name": "DATABRICKS_TOKEN",
+ "required": false
+ },
+ {
+ "default": null,
+ "description": "Databricks CLI profile name (alternative to DATABRICKS_HOST/TOKEN).",
+ "name": "DATABRICKS_CONFIG_PROFILE",
+ "required": false
+ }
+ ],
"humanized_name": "Databricks SQL Query",
"init_params_schema": {
"$defs": {