abt-databricks-tools
abt-databricks-tools is a first-party abt package with SDK-backed @tool functions for Databricks — jobs, runs, SQL warehouses, query history, notebooks, cluster lifecycle, and Genie One questions — backed by databricks-sdk (install abt-core[databricks], which requires databricks-sdk>=0.162.0; abt deps does not). Only databricks_genie_ask talks to Databricks' managed Genie MCP server, reusing the same credentials.
| Databricks MCP (external) | abt-databricks-tools (SDK) | |
|---|---|---|
| Schema injection per call | Large tool schemas | 0 extra MCP tokens |
| Prerequisites | MCP server + tokens | abt-core[databricks] installed (uv pip install "abt-core[databricks]"). abt deps does not install it. |
| Host binary | — | None (databricks-sdk only) |
Package id: abt-databricks-tools · Shorthand: databricks
Write tools ship in the manifest but are gated by default (defaults.allow_writes: false). Select components or individual tools via shorthand specs. Tool names carry the service prefix (databricks_run_get) because the model sees the bare tool name, not the databricks__ spec.
Tool catalog
| Component | Tool | Access |
|---|---|---|
| jobs | databricks_job_get |
read |
| jobs | databricks_job_runs_list |
read |
| jobs | databricks_run_get |
read |
| jobs | databricks_run_output_get |
read |
| jobs | databricks_run_cancel |
write |
| jobs | databricks_job_run_now |
write |
| pipelines | databricks_pipeline_events_list |
read |
| sql | databricks_warehouse_list |
read |
| sql | databricks_warehouse_get |
read |
| sql | databricks_query_history_list |
read |
| sql | databricks_query_get |
read |
| statements | databricks_query_execute |
write |
| compute | databricks_cluster_get |
read |
| compute | databricks_cluster_start |
write |
| compute | databricks_cluster_terminate |
write |
| notebooks | databricks_notebook_list |
read |
| notebooks | databricks_notebook_get |
read |
| admin | databricks_permissions_get |
read |
| genie | databricks_genie_ask |
read |
abt docs package databricks --project-root . # same table from abt_package.yaml
Tool spec syntax
Agent frontmatter uses shorthand__tool_name (double underscore) — list individual tools or a package wildcard (provider__*):
tools:
- databricks__databricks_run_get
- databricks__databricks_job_get
- databricks__* # all enabled read tools; writes when allow_writes permits
- databricks__databricks_run_cancel # explicit write — needs allow_writes
Invalid specs: bare tool names without the databricks__ prefix, pseudo-bundles (databricks__jobs, databricks__write), and specs with more than one __ segment. abt compile fails on such specs once the package is installed (run abt deps first), and abt config show --agent NAME lists what actually resolves.
databricks_query_execute runs any SQL
Databricks has no read-only mode for the statement API, so databricks_query_execute sends whatever statement the model writes to the warehouse, DML and DDL included. It is classified as a write tool in its own statements component, so databricks__* leaves it out until you opt in with components.statements.allow_writes: true. What the statement may touch is decided by the credential's permissions: give agents a service principal that can only read, and grant write access deliberately.
Gate components and writes in abt.yaml only when you need overrides — see Packages — config.packages:
config:
packages:
abt-databricks-tools:
disabled_components: [admin]
components:
jobs:
allow_writes: true # only jobs write tools; compute stays read-only
statements:
allow_writes: true # enables databricks_query_execute
Backend: databricks-sdk
All tools call abt.integrations.databricks, a shared SDK layer in abt. Each tool delegates to a single integration function that returns markdown (for example fetch_run_markdown), matching the Slack/Atlassian choke-point pattern. databricks_genie_ask is the one exception on the wire: it talks to the Genie One MCP server on Unity AI Gateway (/ai-gateway/mcp-services/system.ai.genie_one_mcp) using the same WorkspaceClient credentials — see Genie.
Credentials: profiles.yaml → credentials.databricks with host and token.
Installation
packages:
- git: https://github.com/getyourguide/abt-core.git
revision: main
subdirectory: packages/abt-databricks-tools
abt deps
Credentials (profiles.yaml)
# profiles.yaml
default:
target: dev
outputs:
dev:
credentials:
databricks:
host: https://your-workspace.cloud.databricks.com
token: "{{ env_var('DATABRICKS_TOKEN') }}"
Environment fallbacks: DATABRICKS_HOST, DATABRICKS_TOKEN. host must be https:// (or a bare hostname); an explicit http:// host is rejected unless it is localhost, 127.0.0.1 or ::1, because the token is sent with every request.
A personal access token is the default and remains fully supported. For token federation /
OAuth setups (service principals, Azure AD, GCP, generic OIDC), omit token and provide the
matching databricks-sdk auth fields instead — e.g. OAuth M2M with a service principal:
# profiles.yaml
default:
target: dev
outputs:
dev:
credentials:
databricks:
host: https://your-workspace.cloud.databricks.com
client_id: "abt-agent-sp"
client_secret: "{{ env_var('DATABRICKS_CLIENT_SECRET') }}"
Any recognized databricks-sdk Config auth field (client_id, client_secret,
azure_client_id, azure_client_secret, azure_tenant_id, azure_use_msi,
google_credentials, google_service_account, oauth_token, token_audience,
oidc_token_env, oidc_token_filepath, auth_type, profile, username,
password) is forwarded to
WorkspaceClient as-is; the SDK handles the actual token exchange. See the
Databricks unified auth docs
for the full list of supported modes.
If neither token nor any of those fields is set anywhere abt looks, host (from
profiles.yaml or DATABRICKS_HOST) is still required, but abt does not block the
call — it forwards only host to WorkspaceClient and lets the SDK fall back to its own
ambient auth resolution (its own env vars such as DATABRICKS_CLIENT_ID, a
~/.databrickscfg profile, databricks auth login CLI cache, or a cloud instance
metadata service). If that also fails, the error surfaces from the SDK on first API call.
Tools
Every tool returns markdown text. Notebook source, logs, SQL results and pipeline events are data from the workspace: the tool descriptions tell the model to treat them as data, not instructions, and agents that act on them should keep that boundary in their own prompt. Responses are capped near 25k tokens (75,000 characters) and say when they were cut or when more results exist, so the model can narrow the request. Errors start with [ERROR] and say what would work; auth errors and 403s say that retrying will not help. The SDK's configuration dump (host, account and workspace ids) is removed from error text. Numeric arguments outside their documented range are rejected with the allowed range instead of being clamped.
Jobs and runs
| Tool | Purpose |
|---|---|
databricks_run_get(run_id_or_url) |
Run state, why it ended (termination message and code), per-task state and failure message, cluster ids, pipeline ids of pipeline tasks, run URL. Runs are deleted after 60 days. |
databricks_run_output_get(run_id_or_url, task_key="") |
A task's error, stack trace, stdout logs and notebook result. Long traces and logs keep their start and end and say how many characters were cut from the middle (trace 8,000, logs 20,000, notebook result 4,000). The API returns the last 5 MB of stdout, only for Spark JAR, Python and wheel tasks; a task that started another job reports the child run id. Multi-task runs need task_key from databricks_run_get. |
databricks_job_get(job_id_or_url) |
Job definition: tasks and dependencies, notebook paths, SQL and pipeline refs, job clusters, schedule, parameters, run-as, creator. |
databricks_job_runs_list(job_id_or_url="", limit=20, active_only=False, started_after="", started_before="") |
Newest-first runs with failure messages, UTC start times. limit 1-100; empty job id lists across all jobs. started_after / started_before take ISO-8601 times (2026-11-01, 2026-11-01T06:00:00Z; UTC when no zone). The API keeps 60 days of runs; older history is in system.lakeflow.job_run_timeline (395 days) through databricks_query_execute. |
databricks_job_run_now(job_id_or_url) |
Write. Start a run with default parameters; returns the run id. |
databricks_run_cancel(run_id_or_url) |
Write. Cancel an in-progress run. |
Pipelines
| Tool | Purpose |
|---|---|
databricks_pipeline_events_list(pipeline_id, level="ERROR", limit=10) |
Pipeline name, state, health and latest update, then the newest events at level (ERROR, WARN or INFO) with flow name and exception messages. A pipeline task has no logs in databricks_run_output_get; its failure is here. limit 1-100. |
SQL
| Tool | Purpose |
|---|---|
databricks_warehouse_list(limit=50) |
Warehouses with id, state and size (limit 1-500). |
databricks_warehouse_get(warehouse_id_or_url) |
State, size, scaling range, auto-stop, tags. |
databricks_query_history_list(query_id_or_url="", warehouse_id="", status=None, hours_back=24, limit=25, started_before="") |
Execution log, newest first. With query_id_or_url, one execution in detail (SQL up to 30,000 characters, error, Spark UI link, rows produced). status is one of FAILED, CANCELED, FINISHED, RUNNING, QUEUED. One listing spans at most 30 days (hours_back up to 720); started_before (ISO-8601) moves the end of that window back to reach older history. For history beyond what the API returns, system.query.history is admin-only by default and masks statement_text unless the reader is an account admin or has databricks_pii_access. |
databricks_query_get(query_id) |
A saved query's definition (SQL text, warehouse, owner, tags). Not results. |
databricks_query_execute(statement, warehouse_id, catalog="", schema_name="", row_limit=200, poll_timeout_seconds=None) |
Write. Run one statement and return rows as a markdown table. row_limit 1-1000; when rows were cut, page with LIMIT n OFFSET m or aggregate in SQL; waits 30 s, then polls up to poll_timeout_seconds (1-900, default 150, env DATABRICKS_QUERY_EXECUTE_REQUEST_TIMEOUT) and cancels the statement on timeout. |
Compute
| Tool | Purpose |
|---|---|
databricks_cluster_get(cluster_id_or_url) |
State, termination reason (code, type, parameters), state message, Spark version, node types, workers or autoscale range, auto-termination. |
databricks_cluster_start(cluster_id_or_url) |
Write. Start a terminated cluster. |
databricks_cluster_terminate(cluster_id_or_url) |
Write. Stop a cluster; its configuration is kept. |
Workspace
| Tool | Purpose |
|---|---|
databricks_notebook_list(path="/", recursive=False, limit=50) |
Notebooks, files and folders under a path (limit 1-500). Browse a narrow folder; never search from / or /Shared. |
databricks_notebook_get(path, start_line=1) |
Notebook or workspace file source (export limit 10 MB), in pages of about 60,000 characters (a single line over 10,000 characters is shown cut and the output says so); the output names the start_line for the next page. Editor URLs (/editor/notebooks/<id>#command/<id>) resolve only for notebooks under the caller's own /Users folder. Cell outputs are not available through the API. |
Admin
databricks_permissions_get(resource_type, resource_id) returns the ACL of one resource. resource_type is one of alerts, clusters, cluster-policies, dashboards, dbsql-dashboards, directories, experiments, files, genie, instance-pools, jobs, notebooks, pipelines, queries, registered-models, repos, serving-endpoints, vector-search-endpoints, warehouses, spelled as the Permissions API spells them (warehouses, not sql_warehouses; hyphens, not underscores). Notebooks, directories and files take the numeric object id. Unity Catalog grants are not covered; read them with SHOW GRANTS through databricks_query_execute.
Genie
databricks_genie_ask(question, conversation_id="", poll_timeout_seconds=None) asks Genie One a natural-language data question through the Genie MCP server on Unity AI Gateway (https://<host>/ai-gateway/mcp-services/system.ai.genie_one_mcp?o=<workspace-id>). The workspace id comes from the SDK config, or one lookup when the config lacks it. Set ABT_DATABRICKS_GENIE_MCP_URL to override the full endpoint URL. One call performs the whole genie_ask → genie_poll_response → genie_get_query_result cycle and returns markdown with:
- status and the
conversation_id(pass it back asconversation_idto ask a follow-up in the same Genie conversation), - the Explore in Databricks deep link,
- Genie's answer with cited sources and assumptions,
- one section per SQL result Genie exposes (
query_items).
Timeout: poll_timeout_seconds per call (1-900, default 300); deployment-wide via the DATABRICKS_GENIE_ASK_REQUEST_TIMEOUT (or ABT_-prefixed) env var, which you can set per target under profiles.yaml → outputs.<target>.env. On timeout the in-flight Genie turn is cancelled best-effort and the error says so.
Requirements and limits:
- The workspace preview Managed MCP Servers must be enabled (admin: username → Previews), and the credential needs
EXECUTEonsystem.ai.genie_one_mcp. A 401/403/404 from the endpoint returns[ERROR] … Hint: …with the matching preview or credential hint. For OAuth, a 401 can mean theai-gatewayscope is missing. - Auth reuses
credentials.databricksexactly like the SDK tools — a PAT works; OAuth/CLI-profile modes work through the sameWorkspaceClient. - Genie answers with Unity Catalog permissions of the calling identity; the tool is read-only.
- Single-space Genie servers (
/api/2.0/mcp/genie/{space_id}) expose differently named tools and are not supported — use Genie One, which routes to the right Genie space itself.
Treat Genie's numbers as a lead: confirm important figures with databricks_query_execute against the SQL Genie shows.
Investigation playbook
Typical incident triage order:
databricks_run_get— failed run from an alert URL; the termination message often names the taskdatabricks_run_output_get— that task's error text and stack trace; for a pipeline task,databricks_pipeline_events_listwith the pipeline id from step 1 insteaddatabricks_job_get— workflow definition and task notebook pathsdatabricks_job_runs_list— is this failure new or recurringdatabricks_cluster_get— termination reason, capacitydatabricks_warehouse_get+databricks_query_history_list— stuck or failing SQLdatabricks_query_get— saved query referenced in historydatabricks_notebook_list→databricks_notebook_get— read notebook source from job task pathsdatabricks_permissions_get— whether an access error is expecteddatabricks_query_execute— verify an alert-reported number (needs thestatementswrite opt-in)databricks_genie_ask— business or metric question when the table is unknown; verify key numbers withdatabricks_query_execute
Prefer full URLs from alerts over guessing ids, and notebook paths from databricks_job_get over guessing paths.
Example agent
Use provider__tool specs (see Packages — tool spec syntax):
tools:
- databricks__databricks_job_get
- databricks__databricks_job_runs_list
- databricks__databricks_run_get
- databricks__databricks_run_output_get
- databricks__databricks_warehouse_get
- databricks__databricks_query_history_list
- databricks__databricks_cluster_get
- databricks__databricks_notebook_list
- databricks__databricks_notebook_get
- databricks__databricks_genie_ask
Environment variables
| Variable | Default | Description |
|---|---|---|
ABT_TOOL_MAX_OUTPUT_BYTES |
500 KB | Per-tool output cap in bytes; the Databricks tools also stop at 75,000 characters |
DATABRICKS_GENIE_ASK_REQUEST_TIMEOUT |
300 s | databricks_genie_ask wait before cancelling (also ABT_-prefixed) |
DATABRICKS_QUERY_EXECUTE_REQUEST_TIMEOUT |
150 s | databricks_query_execute poll budget before cancelling (also ABT_-prefixed) |
DATABRICKS_HOST |
— | Workspace URL fallback |
DATABRICKS_TOKEN |
— | PAT fallback |