Skip to content

Drop the SDK agent token from User-Agent under DATABRICKS_NOT_AN_AGENT - #8143

Open
simonfaltum wants to merge 7 commits into
skills/noagent-databricks-not-an-agent-makes-the-cli-acfrom
skills/noagentsdk-the-sdk-agent-header-follows-databricks
Open

simonfaltum wants to merge 7 commits into
skills/noagent-databricks-not-an-agent-makes-the-cli-acfrom
skills/noagentsdk-the-sdk-agent-header-follows-databricks

Conversation

@simonfaltum

@simonfaltum simonfaltum commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

With DATABRICKS_NOT_AN_AGENT set, the CLI's workspace and account clients no longer send an agent/<name> token in the User-Agent header. The SDK added that token from its own agent detection, which does not read the variable. With the variable unset nothing changes. This PR is stacked on #8126, so until that merges the diff against main also shows its changes.

Changes

  • agent.ApplyNotAnAgentHeader wraps the client's HTTP transport and removes agent/ tokens from User-Agent. It does nothing unless NotAnAgent holds, so with the variable unset the config is not touched.
  • cmd/root applies it in MustWorkspaceClient and MustAccountClient, and to a profile picked at a prompt through profileConfig, which builds that profile's config with the same setting. The bundle workspace client applies it after setting its health-checked transport.

Why

The SDK (v0.204.0) has no per-client option for this. Its header visitor reads useragent.AgentProvider(), a process-wide value cached on first use, and it sets User-Agent after the request visitors have run. A Config.Headers hook therefore cannot change it. The transport is the only hook that sees the final header. An SDK change would also work, but this route needs no new SDK release.

Decisions to review

  • A transport wrapper over an SDK change. The wrapper relies on User-Agent being space-separated key/value tokens, which the SDK builds and its tests pin.
  • With no transport set, the wrapper falls back to httptransport.HealthChecked, because the SDK's default is unexported. This happens only with the variable set. The health-check ping settings differ, and databricks apps logs takes its plain-dialer path for a transport that is not an *http.Transport.
  • Coverage is the root command clients, a profile picked at a prompt, and the bundle workspace client. Other sites that build their own SDK config, such as auth login and aitools mcp, still send the token with the variable set. The follow-up Apply the not-an-agent header guard to the remaining CLI SDK clients #8144 covers them.

Tests

  • TestWithoutAgentToken covers the token filter. TestNoAgentHeaderTransportDropsAgentAndKeepsRequest checks the wrapper and that the caller's request is not modified. TestNotAnAgentHeaderOnSDKRequests sends real SDK requests through an in-process transport, with and without the variable.
  • TestWorkspaceClientNotAnAgentWrapsTransport checks that the bundle workspace client's transport is wrapped only when the variable is set. It needs no listener, so it also runs on Windows. TestProfileConfigNotAnAgentHeader covers the config for a picked profile.
  • acceptance/cmd/aitools/not-an-agent records the current-user me request (its cicd/ token is stripped, so CI runners match local runs): no agent/ token with the variable set, and agent/claude-code without it.
  • go test passes for ./libs/agent/..., ./cmd/root/..., ./cmd/quickstart/..., ./cmd/auth/..., ./cmd/feedback/..., ./bundle/config/..., ./bundle/phases/... and ./bundle/deploy/... after merging the parent branch tip. ./task fmt-q lint-q is clean.
  • TestAccept/cmd/aitools, TestAccept/cmd/quickstart, TestAccept/cmd/feedback, TestAccept/cmd/auth, TestAccept/bundle/deployment/bind and TestAccept/bundle/resources/dashboards pass.

Not tested: databricks commands against a real workspace, and the other SDK construction sites listed above.

This pull request and its description were written by Isaac.

…ICKS_NOT_AN_AGENT

The SDK adds an agent/<name> token to User-Agent from its process-wide agent
detection, which does not read DATABRICKS_NOT_AN_AGENT. The SDK has no
per-client option for this, and its header is set after request visitors run,
so the CLI's workspace and account clients wrap their HTTP transport and remove
the token when the variable is set. Without the variable the clients are
unchanged.

Co-authored-by: Isaac <no-reply@databricks.com>
@github-actions

github-actions Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Regression test report ✅

Commit: 34e0c262b | Workflow run

Selected 1 changed tests (limit=20, 0 not selected)

1 tests: regression=1 unreleased=0 coverage=0 failing=0
test branch main (e6f3460) latest (v1.28.0)
TestAccept/cmd/aitools/not-an-agent ✅ ❌ ❌
TestAccept/cmd/aitools/not-an-agent: branch ✅ | main (e6f3460) ❌ | latest (v1.28.0) ❌

main (e6f3460):

acceptance_test.go:1406: Diff:
        --- cmd/aitools/not-an-agent/output.txt
        +++ /tmp/TestAcceptcmdaitoolsnot-an-agent66004237/002/output.txt
        @@ -18,61 +18,35 @@
         === With the variable set, no hint is printed
         
         >>> DATABRICKS_NOT_AN_AGENT=1 CLAUDECODE=1 [CLI] jobs list
        +Before you work with Databricks, run: databricks skills list
         
         === Without the variable, the hint still shows on the same session
         
         >>> CLAUDECODE=1 [CLI] jobs list
        -Before you work with Databricks, run: databricks skills list
         
         === With the variable set, the help has no skills footer
         
         >>> DATABRICKS_NOT_AN_AGENT=1 CLAUDECODE=1 [CLI] fs --help
        -  -t, --target string        bundle target to use (if applicable)
         
        -Use "databricks fs [command] --help" for more information about a command.
        +Coding agents: read the skills for this command group before you use it.
        +  databricks skills read demo-skill
         
         >>> DATABRICKS_NOT_AN_AGENT=1 CLAUDECODE=1 [CLI] --help
         
        -Use "databricks [command] --help" for more information about a command.
        +Coding agents: run `databricks skills list` to find skills for the commands you use.
         
         === With the variable set, quickstart prints the human guide
         
         >>> DATABRICKS_NOT_AN_AGENT=1 CLAUDECODE=1 [CLI] quickstart
        -# Welcome to Databricks
        +# Databricks Quickstart
         
         >>> DATABRICKS_NOT_AN_AGENT=1 CLAUDECODE=1 [CLI] quickstart
        +contains error: 'databricks skills list' was not expected: "- **Reason, don't refuse.** Before telling the user something can't be done, run `databricks <group> --help` and find the matching skill with `databricks skills list` (below). Almost everything is reachable through the CLI."
        +contains error: 'databricks skills list' was not expected: 'Find the bundle skill in `databricks skills list` and read it for bundle structure, resource schemas, and multi-target setup.'
        +contains error: 'databricks skills list' was not expected: '**Databricks Apps** (full-stack TypeScript + React via AppKit) build on bundles too, with a dedicated scaffolder — see the apps skill in `databricks skills list`:'
        +contains error: 'databricks skills list' was not expected: 'databricks skills list                       # the catalog: each skill with its description'
        +contains error: 'databricks skills list' was not expected: 'databricks skills list-files <name>          # the files a skill has, with their paths'
        +contains error: 'databricks skills list' was not expected: 'Pick the skill whose description fits the task from the `databricks skills list` output. The catalog changes between CLI versions, so run `databricks skills list` rather than relying on a remembered list.'
        +contains error: 'databricks skills list' was not expected: "Re-read `databricks <group> --help`, find the matching skill with `databricks skills list`, and check https://docs.databricks.com. If you truly can't do something yourself, tell the user how they can — don't tell them Databricks can't."
         
        -=== With the variable set, auto-install enable says it is still stopped here
        -
        ->>> DATABRICKS_NOT_AN_AGENT=1 CLAUDECODE=1 [CLI] aitools auto-install enable
        -Automatic installation of Databricks AI tools is enabled.
        -DATABRICKS_NOT_AN_AGENT still stops it in this environment; unset it to let it run.
        -
        -=== A false value leaves agent detection on
        -
        ->>> DATABRICKS_NOT_AN_AGENT=0 CODEX_CI=1 CODEX_THREAD_ID=thread-1 [CLI] jobs list
        -Before you work with Databricks, run: databricks skills list
        -
        -=== The SDK's User-Agent follows the variable
        -
        ->>> DATABRICKS_NOT_AN_AGENT=1 CLAUDECODE=1 [CLI] current-user me
        -{
        -  "headers": {
        -    "User-Agent": [
        -      "cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/current-user_me cmd-exec-id/[UUID][0] interactive/none auth/pat"
        -    ]
        -  },
        -  "method": "GET",
        -  "path": "/api/2.0/preview/scim/v2/Me"
        -}
        -
        ->>> CLAUDECODE=1 [CLI] current-user me
        -{
        -  "headers": {
        -    "User-Agent": [
        -      "cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/current-user_me cmd-exec-id/[UUID][1] interactive/none aitools-agent/none auth/pat agent/claude-code"
        -    ]
        -  },
        -  "method": "GET",
        -  "path": "/api/2.0/preview/scim/v2/Me"
        -}
        +Exit code: 1
        
    acceptance_test.go:1184: 
        LOG.quickstart-agent: # Databricks Quickstart
        LOG.quickstart-agent: 
        LOG.quickstart-agent: The `databricks` CLI wraps the public Databricks REST API — there's a command for essentially every API endpoint, so almost any Databricks task can be driven from here. If something looks unsupported, it's almost always a command you haven't found yet, not a real gap. The headline workflow: build durable resources as code with **Declarative Automation Bundles (DABs)** and ship them with `databricks bundle deploy` (see Build and deploy below).
        LOG.quickstart-agent: 
        LOG.quickstart-agent: ## Golden rules
        LOG.quickstart-agent: 
        LOG.quickstart-agent: - **Reason, don't refuse.** Before telling the user something can't be done, run `databricks <group> --help` and find the matching skill with `databricks skills list` (below). Almost everything is reachable through the CLI.
        LOG.quickstart-agent: - **Build with bundles.** For anything durable — jobs, pipelines, dashboards, apps — define it as code in a Declarative Automation Bundle (DABs) and ship with `databricks bundle deploy`, not one-off API calls.
        LOG.quickstart-agent: - **Pick the profile deliberately.** Run `databricks auth profiles`. If only one profile exists, use it. If one is already set as the default (via `databricks auth switch`), assume that one — you can confirm if unsure. Otherwise, show the user the profiles with their workspace URLs and let them choose. Don't invent profile names.
        LOG.quickstart-agent: - **Always pass `--profile <name>`.** Each Bash command runs in its own shell, so a separate `export DATABRICKS_CONFIG_PROFILE=...` line does NOT persist. Use the flag, or chain with `&&`.
        LOG.quickstart-agent: - **OAuth, never PAT.** Authenticate with `databricks auth login`, not personal access tokens.
        LOG.quickstart-agent: 
        LOG.quickstart-agent: ## Step 1 — Authenticate
        LOG.quickstart-agent: 
        LOG.quickstart-agent: ```bash
        LOG.quickstart-agent: databricks auth profiles                  # already set up? lists profiles + validity
        LOG.quickstart-agent: databricks auth login --profile <name>    # if not — opens login.databricks.com to pick a workspace
        LOG.quickstart-agent: ```
        LOG.quickstart-agent: 
        LOG.quickstart-agent: No host needed: without `--host`, login opens login.databricks.com and the user picks a workspace in the browser. Only pass `--host <url>` if the user already gave you a specific workspace URL. Always pass a descriptive `--profile <name>` (e.g. `dev-aws`, `prod-azure`) so you can target it reliably afterward — ask the user for the name rather than inventing one.
        LOG.quickstart-agent: 
        LOG.quickstart-agent: ## Step 2 — Verify
        LOG.quickstart-agent: 
        LOG.quickstart-agent: ```bash
        LOG.quickstart-agent: databricks current-user me --profile <name>
        LOG.quickstart-agent: ```
        LOG.quickstart-agent: 
        LOG.quickstart-agent: ## Build and deploy with Declarative Automation Bundles (DABs)
        LOG.quickstart-agent: 
        LOG.quickstart-agent: **DABs are the standard, recommended way to build on Databricks.** A bundle is a project with a `databricks.yml` that declares your resources (jobs, pipelines, dashboards, apps) and its targets (e.g. dev, prod) — one project, one deploy, every resource type:
        LOG.quickstart-agent: 
        LOG.quickstart-agent: ```bash
        LOG.quickstart-agent: databricks bundle init                     # scaffold a project from a template
        LOG.quickstart-agent: databricks bundle validate                 # check the config
        LOG.quickstart-agent: databricks bundle deploy -t dev            # deploy everything to a target (dev, prod, ...)
        LOG.quickstart-agent: databricks bundle run <resource> -t dev    # run a job or pipeline
        LOG.quickstart-agent: ```
        LOG.quickstart-agent: 
        LOG.quickstart-agent: Find the bundle skill in `databricks skills list` and read it for bundle structure, resource schemas, and multi-target setup.
        LOG.quickstart-agent: 
        LOG.quickstart-agent: **Databricks Apps** (full-stack TypeScript + React via AppKit) build on bundles too, with a dedicated scaffolder — see the apps skill in `databricks skills list`:
        LOG.quickstart-agent: 
        LOG.quickstart-agent: ```bash
        LOG.quickstart-agent: databricks apps init          # scaffold an AppKit app (generates the bundle for you)
        LOG.quickstart-agent: databricks apps deploy        # deploy it to the workspace
        LOG.quickstart-agent: databricks apps run-local     # develop locally (or `dev-remote` against the workspace)
        LOG.quickstart-agent: ```
        LOG.quickstart-agent: 
        LOG.quickstart-agent: ## Common commands
        LOG.quickstart-agent: 
        LOG.quickstart-agent: ```bash
        LOG.quickstart-agent: databricks jobs list --profile <name>
        LOG.quickstart-agent: databricks pipelines list --profile <name>
        LOG.quickstart-agent: databricks apps list --profile <name>
        LOG.quickstart-agent: databricks warehouses list --profile <name>
        LOG.quickstart-agent: 
        LOG.quickstart-agent: # Unity Catalog data uses POSITIONAL args, NOT flags:
        LOG.quickstart-agent: databricks catalogs list --profile <name>
        LOG.quickstart-agent: databricks schemas list <catalog> --profile <name>
        LOG.quickstart-agent: databricks tables list <catalog> <schema> --profile <name>
        LOG.quickstart-agent: ```
        LOG.quickstart-agent: 
        LOG.quickstart-agent: Unsure of a command's shape? Run `databricks <command> --help`.
        LOG.quickstart-agent: 
        LOG.quickstart-agent: ## Find skills for the task
        LOG.quickstart-agent: 
        LOG.quickstart-agent: Skills give you Databricks-specific patterns so you build resources correctly instead of guessing. Find the one that matches the task in the catalog, read it, then read the supporting files it lists:
        LOG.quickstart-agent: 
        LOG.quickstart-agent: ```bash
        LOG.quickstart-agent: databricks skills list                       # the catalog: each skill with its description
        LOG.quickstart-agent: databricks skills list-files <name>          # the files a skill has, with their paths
        LOG.quickstart-agent: databricks skills read <name>                # a skill's instructions
        LOG.quickstart-agent: databricks skills read-file <name> <path>    # a supporting file that the skill lists
        LOG.quickstart-agent: ```
        LOG.quickstart-agent: 
        LOG.quickstart-agent: Pick the skill whose description fits the task from the `databricks skills list` output. The catalog changes between CLI versions, so run `databricks skills list` rather than relying on a remembered list.
        LOG.quickstart-agent: 
        LOG.quickstart-agent: ## Explore data
        LOG.quickstart-agent: 
        LOG.quickstart-agent: Use the built-in tools instead of guessing SQL or navigating by hand:
        LOG.quickstart-agent: 
        LOG.quickstart-agent: ```bash
        LOG.quickstart-agent: databricks experimental aitools tools discover-schema <catalog>.<schema>.<table> --profile <name>
        LOG.quickstart-agent: databricks experimental aitools tools query "SELECT * FROM <table> LIMIT 10" --profile <name>
        LOG.quickstart-agent: ```
        LOG.quickstart-agent: 
        LOG.quickstart-agent: ## When you get stuck
        LOG.quickstart-agent: 
        LOG.quickstart-agent: Re-read `databricks <group> --help`, find the matching skill with `databricks skills list`, and check https://docs.databricks.com. If you truly can't do something yourself, tell the user how they can — don't tell them Databricks can't.
    acceptance_test.go:1184: 
        LOG.quickstart-human: # Databricks Quickstart
        LOG.quickstart-human: 
        LOG.quickstart-human: The `databricks` CLI wraps the public Databricks REST API — there's a command for essentially every API endpoint, so almost any Databricks task can be driven from here. If something looks unsupported, it's almost always a command you haven't found yet, not a real gap. The headline workflow: build durable resources as code with **Declarative Automation Bundles (DABs)** and ship them with `databricks bundle deploy` (see Build and deploy below).
        LOG.quickstart-human: 
        LOG.quickstart-human: ## Golden rules
        LOG.quickstart-human: 
        LOG.quickstart-human: - **Reason, don't refuse.** Before telling the user something can't be done, run `databricks <group> --help` and find the matching skill with `databricks skills list` (below). Almost everything is reachable through the CLI.
        LOG.quickstart-human: - **Build with bundles.** For anything durable — jobs, pipelines, dashboards, apps — define it as code in a Declarative Automation Bundle (DABs) and ship with `databricks bundle deploy`, not one-off API calls.
        LOG.quickstart-human: - **Pick the profile deliberately.** Run `databricks auth profiles`. If only one profile exists, use it. If one is already set as the default (via `databricks auth switch`), assume that one — you can confirm if unsure. Otherwise, show the user the profiles with their workspace URLs and let them choose. Don't invent profile names.
        LOG.quickstart-human: - **Always pass `--profile <name>`.** Each Bash command runs in its own shell, so a separate `export DATABRICKS_CONFIG_PROFILE=...` line does NOT persist. Use the flag, or chain with `&&`.
        LOG.quickstart-human: - **OAuth, never PAT.** Authenticate with `databricks auth login`, not personal access tokens.
        LOG.quickstart-human: 
        LOG.quickstart-human: ## Step 1 — Authenticate
        LOG.quickstart-human: 
        LOG.quickstart-human: ```bash
        LOG.quickstart-human: databricks auth profiles                  # already set up? lists profiles + validity
        LOG.quickstart-human: databricks auth login --profile <name>    # if not — opens login.databricks.com to pick a workspace
        LOG.quickstart-human: ```
        LOG.quickstart-human: 
        LOG.quickstart-human: No host needed: without `--host`, login opens login.databricks.com and the user picks a workspace in the browser. Only pass `--host <url>` if the user already gave you a specific workspace URL. Always pass a descriptive `--profile <name>` (e.g. `dev-aws`, `prod-azure`) so you can target it reliably afterward — ask the user for the name rather than inventing one.
        LOG.quickstart-human: 
        LOG.quickstart-human: ## Step 2 — Verify
        LOG.quickstart-human: 
        LOG.quickstart-human: ```bash
        LOG.quickstart-human: databricks current-user me --profile <name>
        LOG.quickstart-human: ```
        LOG.quickstart-human: 
        LOG.quickstart-human: ## Build and deploy with Declarative Automation Bundles (DABs)
        LOG.quickstart-human: 
        LOG.quickstart-human: **DABs are the standard, recommended way to build on Databricks.** A bundle is a project with a `databricks.yml` that declares your resources (jobs, pipelines, dashboards, apps) and its targets (e.g. dev, prod) — one project, one deploy, every resource type:
... (60 more lines truncated, raise DATABRICKS_CLI_TEST_MAX_LOG to see more)

latest (v1.28.0):

acceptance_test.go:1406: Diff:
        --- cmd/aitools/not-an-agent/output.txt
        +++ /tmp/TestAcceptcmdaitoolsnot-an-agent4209380628/002/output.txt
        @@ -2,77 +2,18 @@
         === Claude Code is hinted, and its help and quickstart are the agent ones
         
         >>> CLAUDECODE=1 [CLI] jobs list
        -Before you work with Databricks, run: databricks skills list
        +Databricks skills are not installed. To work with Databricks reliably, first run: databricks aitools install
         
         >>> CLAUDECODE=1 [CLI] fs --help
        -
        -Coding agents: read the skills for this command group before you use it.
        -  databricks skills read demo-skill
        -
        ->>> CLAUDECODE=1 [CLI] --help
        -
        -Coding agents: run `databricks skills list` to find skills for the commands you use.
        -
        ->>> CLAUDECODE=1 [CLI] quickstart
        -
        -=== With the variable set, no hint is printed
        -
        ->>> DATABRICKS_NOT_AN_AGENT=1 CLAUDECODE=1 [CLI] jobs list
        -
        -=== Without the variable, the hint still shows on the same session
        -
        ->>> CLAUDECODE=1 [CLI] jobs list
        -Before you work with Databricks, run: databricks skills list
        -
        -=== With the variable set, the help has no skills footer
        -
        ->>> DATABRICKS_NOT_AN_AGENT=1 CLAUDECODE=1 [CLI] fs --help
           -t, --target string        bundle target to use (if applicable)
         
         Use "databricks fs [command] --help" for more information about a command.
         
        ->>> DATABRICKS_NOT_AN_AGENT=1 CLAUDECODE=1 [CLI] --help
        +>>> CLAUDECODE=1 [CLI] --help
         
         Use "databricks [command] --help" for more information about a command.
         
        -=== With the variable set, quickstart prints the human guide
        +>>> CLAUDECODE=1 [CLI] quickstart
        +contains error: 'databricks skills list' not found in the output.
         
        ->>> DATABRICKS_NOT_AN_AGENT=1 CLAUDECODE=1 [CLI] quickstart
        -# Welcome to Databricks
        -
        ->>> DATABRICKS_NOT_AN_AGENT=1 CLAUDECODE=1 [CLI] quickstart
        -
        -=== With the variable set, auto-install enable says it is still stopped here
        -
        ->>> DATABRICKS_NOT_AN_AGENT=1 CLAUDECODE=1 [CLI] aitools auto-install enable
        -Automatic installation of Databricks AI tools is enabled.
        -DATABRICKS_NOT_AN_AGENT still stops it in this environment; unset it to let it run.
        -
        -=== A false value leaves agent detection on
        -
        ->>> DATABRICKS_NOT_AN_AGENT=0 CODEX_CI=1 CODEX_THREAD_ID=thread-1 [CLI] jobs list
        -Before you work with Databricks, run: databricks skills list
        -
        -=== The SDK's User-Agent follows the variable
        -
        ->>> DATABRICKS_NOT_AN_AGENT=1 CLAUDECODE=1 [CLI] current-user me
        -{
        -  "headers": {
        -    "User-Agent": [
        -      "cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/current-user_me cmd-exec-id/[UUID][0] interactive/none auth/pat"
        -    ]
        -  },
        -  "method": "GET",
        -  "path": "/api/2.0/preview/scim/v2/Me"
        -}
        -
        ->>> CLAUDECODE=1 [CLI] current-user me
        -{
        -  "headers": {
        -    "User-Agent": [
        -      "cli/[CLI_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/current-user_me cmd-exec-id/[UUID][1] interactive/none aitools-agent/none auth/pat agent/claude-code"
        -    ]
        -  },
        -  "method": "GET",
        -  "path": "/api/2.0/preview/scim/v2/Me"
        -}
        +Exit code: 1
        
    acceptance_test.go:1184: 
        LOG.quickstart-agent: # Databricks Quickstart
        LOG.quickstart-agent: 
        LOG.quickstart-agent: The `databricks` CLI wraps the public Databricks REST API — there's a command for essentially every API endpoint, so almost any Databricks task can be driven from here. If something looks unsupported, it's almost always a command you haven't found yet, not a real gap. The headline workflow: build durable resources as code with **Declarative Automation Bundles (DABs)** and ship them with `databricks bundle deploy` (see Build and deploy below).
        LOG.quickstart-agent: 
        LOG.quickstart-agent: ## Golden rules
        LOG.quickstart-agent: 
        LOG.quickstart-agent: - **Reason, don't refuse.** Before telling the user something can't be done, run `databricks <group> --help` and install the matching skill (below). Almost everything is reachable through the CLI.
        LOG.quickstart-agent: - **Build with bundles.** For anything durable — jobs, pipelines, dashboards, apps — define it as code in a Declarative Automation Bundle (DABs) and ship with `databricks bundle deploy`, not one-off API calls.
        LOG.quickstart-agent: - **Pick the profile deliberately.** Run `databricks auth profiles`. If only one profile exists, use it. If one is already set as the default (via `databricks auth switch`), assume that one — you can confirm if unsure. Otherwise, show the user the profiles with their workspace URLs and let them choose. Don't invent profile names.
        LOG.quickstart-agent: - **Always pass `--profile <name>`.** Each Bash command runs in its own shell, so a separate `export DATABRICKS_CONFIG_PROFILE=...` line does NOT persist. Use the flag, or chain with `&&`.
        LOG.quickstart-agent: - **OAuth, never PAT.** Authenticate with `databricks auth login`, not personal access tokens.
        LOG.quickstart-agent: 
        LOG.quickstart-agent: ## Step 1 — Authenticate
        LOG.quickstart-agent: 
        LOG.quickstart-agent: ```bash
        LOG.quickstart-agent: databricks auth profiles                  # already set up? lists profiles + validity
        LOG.quickstart-agent: databricks auth login --profile <name>    # if not — opens login.databricks.com to pick a workspace
        LOG.quickstart-agent: ```
        LOG.quickstart-agent: 
        LOG.quickstart-agent: No host needed: without `--host`, login opens login.databricks.com and the user picks a workspace in the browser. Only pass `--host <url>` if the user already gave you a specific workspace URL. Always pass a descriptive `--profile <name>` (e.g. `dev-aws`, `prod-azure`) so you can target it reliably afterward — ask the user for the name rather than inventing one.
        LOG.quickstart-agent: 
        LOG.quickstart-agent: ## Step 2 — Verify
        LOG.quickstart-agent: 
        LOG.quickstart-agent: ```bash
        LOG.quickstart-agent: databricks current-user me --profile <name>
        LOG.quickstart-agent: ```
        LOG.quickstart-agent: 
        LOG.quickstart-agent: ## Build and deploy with Declarative Automation Bundles (DABs)
        LOG.quickstart-agent: 
        LOG.quickstart-agent: **DABs are the standard, recommended way to build on Databricks.** A bundle is a project with a `databricks.yml` that declares your resources (jobs, pipelines, dashboards, apps) and its targets (e.g. dev, prod) — one project, one deploy, every resource type:
        LOG.quickstart-agent: 
        LOG.quickstart-agent: ```bash
        LOG.quickstart-agent: databricks bundle init                     # scaffold a project from a template
        LOG.quickstart-agent: databricks bundle validate                 # check the config
        LOG.quickstart-agent: databricks bundle deploy -t dev            # deploy everything to a target (dev, prod, ...)
        LOG.quickstart-agent: databricks bundle run <resource> -t dev    # run a job or pipeline
        LOG.quickstart-agent: ```
        LOG.quickstart-agent: 
        LOG.quickstart-agent: Read the `databricks-dabs` skill for bundle structure, resource schemas, and multi-target setup.
        LOG.quickstart-agent: 
        LOG.quickstart-agent: **Databricks Apps** (full-stack TypeScript + React via AppKit) build on bundles too, with a dedicated scaffolder — see `databricks-apps`:
        LOG.quickstart-agent: 
        LOG.quickstart-agent: ```bash
        LOG.quickstart-agent: databricks apps init          # scaffold an AppKit app (generates the bundle for you)
        LOG.quickstart-agent: databricks apps deploy        # deploy it to the workspace
        LOG.quickstart-agent: databricks apps run-local     # develop locally (or `dev-remote` against the workspace)
        LOG.quickstart-agent: ```
        LOG.quickstart-agent: 
        LOG.quickstart-agent: ## Common commands
        LOG.quickstart-agent: 
        LOG.quickstart-agent: ```bash
        LOG.quickstart-agent: databricks jobs list --profile <name>
        LOG.quickstart-agent: databricks pipelines list --profile <name>
        LOG.quickstart-agent: databricks apps list --profile <name>
        LOG.quickstart-agent: databricks warehouses list --profile <name>
        LOG.quickstart-agent: 
        LOG.quickstart-agent: # Unity Catalog data uses POSITIONAL args, NOT flags:
        LOG.quickstart-agent: databricks catalogs list --profile <name>
        LOG.quickstart-agent: databricks schemas list <catalog> --profile <name>
        LOG.quickstart-agent: databricks tables list <catalog> <schema> --profile <name>
        LOG.quickstart-agent: ```
        LOG.quickstart-agent: 
        LOG.quickstart-agent: Unsure of a command's shape? Run `databricks <command> --help`.
        LOG.quickstart-agent: 
        LOG.quickstart-agent: ## Install skills for the task
        LOG.quickstart-agent: 
        LOG.quickstart-agent: Skills give you Databricks-specific patterns so you build resources correctly instead of guessing. They install into your coding agent (auto-detected):
        LOG.quickstart-agent: 
        LOG.quickstart-agent: ```bash
        LOG.quickstart-agent: databricks aitools install                 # stable skills
        LOG.quickstart-agent: databricks aitools install --experimental  # broader coverage: more areas, lower quality bar
        LOG.quickstart-agent: databricks aitools list                    # available + installed skills — check this for the latest
        LOG.quickstart-agent: ```
        LOG.quickstart-agent: 
        LOG.quickstart-agent: The set evolves, so run `databricks aitools list` rather than relying on a fixed list. Common ones: `databricks-core` (CLI/auth), `databricks-jobs`, `databricks-pipelines`, `databricks-dabs` (deploy as code), `databricks-apps`. Experimental skills reach further (Unity Catalog, vector search, dashboards, AI functions, and more) — worth a look depending on the prompt.
        LOG.quickstart-agent: 
        LOG.quickstart-agent: ## Explore data
        LOG.quickstart-agent: 
        LOG.quickstart-agent: Use the built-in tools instead of guessing SQL or navigating by hand:
        LOG.quickstart-agent: 
        LOG.quickstart-agent: ```bash
        LOG.quickstart-agent: databricks experimental aitools tools discover-schema <catalog>.<schema>.<table> --profile <name>
        LOG.quickstart-agent: databricks experimental aitools tools query "SELECT * FROM <table> LIMIT 10" --profile <name>
        LOG.quickstart-agent: ```
        LOG.quickstart-agent: 
        LOG.quickstart-agent: ## When you get stuck
        LOG.quickstart-agent: 
        LOG.quickstart-agent: Re-read `databricks <group> --help`, install the matching skill, and check https://docs.databricks.com. If you truly can't do something yourself, tell the user how they can — don't tell them Databricks can't.
FAIL

@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Collaborator

✅ Integration test report

Commit: 34e0c26

Run: 46405902338

Env 💚​RECOVERED ✅​pass 🙈​skip Time
💚​ aws linux-2core-8gb 1 173 18 4:25
💚​ aws-windows-latest-4core-16gb 1 173 18 3:35
💚​ azure linux-2core-8gb 1 172 18 4:19
💚​ azure-windows-latest-4core-16gb 1 172 18 3:41
💚​ gcp linux-2core-8gb 1 173 18 4:19
💚​ gcp-windows-latest-4core-16gb 1 173 18 3:38
Test Name aws linux-2core-8gb aws-windows-latest-4core-16gb azure linux-2core-8gb azure-windows-latest-4core-16gb gcp linux-2core-8gb gcp-windows-latest-4core-16gb
💚​ TestAccept 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
Top 6 slowest tests (at least 2 minutes):
duration env testname
4:25 aws linux-2core-8gb TestAccept
3:54 azure linux-2core-8gb TestAccept
3:51 gcp linux-2core-8gb TestAccept
3:39 azure-windows-latest-4core-16gb TestAccept
3:37 gcp-windows-latest-4core-16gb TestAccept
3:33 aws-windows-latest-4core-16gb TestAccept

simonfaltum and others added 2 commits November 27, 2026 20:47
The acceptance golden for cmd/aitools/not-an-agent recorded a cicd/github
token on GitHub Actions runners, so strip cicd/ segments from its User-Agent
the way other acceptance tests do.

The two new header tests opened a loopback server, which the Windows runners
refuse to listen on. The libs/agent test now answers the SDK's requests from
an in-process transport, and the bundle/config test, which needs the real
Workspace.Client transport, is skipped on Windows.

Co-authored-by: Isaac <no-reply@databricks.com>
The macOS runner recorded os/darwin where the golden had os/linux, so
normalize the OS token the way the other User-Agent goldens do.

Co-authored-by: Isaac <no-reply@databricks.com>
@simonfaltum
simonfaltum marked this pull request as ready for review November 27, 2026 21:46
@simonfaltum
simonfaltum requested review from a team as code owners November 27, 2026 21:46

@review-oss-bot review-oss-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review at e792723. Each finding was verified against the code.

Not ready yet: 1 blocking issue(s), tagged [blocking].

This PR wraps the HTTP transport of the root workspace and account clients and the bundle workspace client so that, with DATABRICKS_NOT_AN_AGENT set, the SDK's agent/<name> token is stripped from User-Agent. The filter does what it says on the paths it is installed on, and it leaves the config alone when the variable is unset. One gap is in scope for the paths the PR targets: when the interactive profile picker runs, the root client is rebuilt without the wrapper. The other comments are about tests and doc comments.

Comments outside the changed lines

  • [nit] acceptance/cmd/aitools/not-an-agent/script:44: Both new current-user me runs (lines 44 and 46) send stdout to /dev/null. testing.md says to route that output to LOG.<name>, so it still shows under go test -v when something goes wrong. Can these be > LOG.me_not_an_agent and > LOG.me_agent?

Comment thread cmd/root/auth.go
cfg.Credentials = auth.CredentialsWithoutRefresh()
}
liteswap.Apply(ctx, cfg)
agent.ApplyNotAnAgentHeader(ctx, cfg)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[blocking] The wrapper only goes on this initial cfg. When the default config doesn't resolve and the user picks a profile, workspaceClientOrPrompt builds a fresh databricks.NewWorkspaceClient(&databricks.Config{Profile: profile}) at line 361, and that client is the one the command uses. accountClientOrPrompt does the same at line 178 for MustAccountClient (line 243). So DATABRICKS_NOT_AN_AGENT=1 CLAUDECODE=1 databricks current-user me in a TTY with no host or profile still sends agent/claude-code once a profile is picked. Can you call agent.ApplyNotAnAgentHeader(ctx, ...) on the picked-profile config in both prompt helpers, ideally from one small shared helper?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 7446ce7. Both prompt helpers now build the picked profile's config through one helper, profileConfig, which applies the not-an-agent header setting, so a profile picked at a prompt gets the same behaviour as the caller's config. TestProfileConfigNotAnAgentHeader covers the variable set and unset cases. The prompt path itself cannot run in a test, so that test stands in for it.

Comment thread bundle/config/workspace_test.go Outdated
// refuse to listen here (WSAEPROVIDERFAILEDINIT). The header logic is platform-independent and is
// covered without a listener in libs/agent.
if runtime.GOOS == "windows" {
t.Skip("needs a loopback listener, which the Windows test runners refuse")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nice to have] TestWorkspaceClientNotAnAgentDropsAgentHeader skips on Windows, so nothing checks there that Workspace.Client installs the wrapper. AGENTS.md asks for tests that also run on Windows. Could this test check the client's resulting Config.HTTPTransport instead (for example, that it is no longer the bare httptransport.HealthChecked(...) value when the variable is set)? That way it needs no loopback listener.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed in 7446ce7. The test no longer starts a loopback server and no longer skips on Windows. It checks the client's Config.HTTPTransport: it is the health-checked transport when the variable is unset, and a different, wrapping transport when it is set. The header itself is checked in libs/agent without a listener.

Comment thread libs/agent/agent_header.go Outdated
// noAgentHeaderTransport drops the agent token from User-Agent and passes the request on to base.
type noAgentHeaderTransport struct {
// base is the transport cfg had. When it is nil, the SDK uses its shared default, which
// httptransport.HealthChecked mirrors. It is read from cfg on each request, so the insecure

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nit] "It is read from cfg on each request" reads as if base is re-read, but base is captured once in ApplyNotAnAgentHeader. Only cfg.InsecureSkipVerify is read per request, and only when base is nil. Also, HealthChecked doesn't just mirror the SDK default; it adds HTTP/2 pings. Maybe: "When base is nil, requests go to httptransport.HealthChecked, chosen per request from cfg.InsecureSkipVerify so a skip_verify resolved from the profile applies; it stands in for the SDK's unexported default."

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Taken as suggested in 7446ce7. The comment now says requests go to httptransport.HealthChecked, chosen per request from cfg.InsecureSkipVerify, and that it stands in for the SDK's unexported default.

Comment thread libs/agent/agent_notice.go Outdated
// Provider returns the agent name that useragent.AgentProvider reports, or "" when no agent is detected or
// NotAnAgent holds. The CLI's own readers of the calling agent (output, telemetry, the User-Agent) go through it.
// The SDK's agent request header still reads useragent.AgentProvider directly, so NotAnAgent does not reach it.
// The SDK adds its agent token from useragent.AgentProvider directly; ApplyNotAnAgentHeader removes it from the

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nit] "removes it from the CLI's clients" claims more than the change does. Sites that build their own SDK config, such as auth login and aitools mcp, still send the token. Can this name where it applies (the MustWorkspaceClient/MustAccountClient clients and the bundle workspace client), so the next reader knows the gap is there?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Taken in 7446ce7. The comment now names where the token is dropped: the MustWorkspaceClient, MustAccountClient and bundle workspace clients, including a profile picked at a prompt. It also says that other places which build their own SDK config, such as auth login and aitools mcp, still send the token. Those remaining sites are handled in the follow-up pull request #8144.

simonfaltum and others added 2 commits November 27, 2026 22:07
…-agent-makes-the-cli-ac' into skills/noagentsdk-the-sdk-agent-header-follows-databricks
The picked profile builds its own SDK config, so the User-Agent wrapper set
on the caller's config did not reach it. Both prompt helpers now build the
picked profile's config through one helper that applies the same setting.

The bundle workspace client test checks the client's transport instead of
running a loopback server, so it runs on Windows too. The header itself is
still checked in libs/agent. Comments now say where the agent token is
dropped and where it is still sent.

Co-authored-by: Isaac <no-reply@databricks.com>
…-agent-makes-the-cli-ac' into skills/noagentsdk-the-sdk-agent-header-follows-databricks

Co-authored-by: Isaac <no-reply@databricks.com>
@simonfaltum
simonfaltum requested review from denik and rclarey November 28, 2026 09:02

@denik denik left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Automated review of 5feabf3 by Opus and Astra (two independent passes); each finding verified against the code. Only this PR's own diff against its base was reviewed (stacked on #8126).

Verdict: no blocking issues. The wrapper strips agent/ tokens on the root and bundle clients and leaves the config alone with the variable unset. The PR merges cleanly with current main and the base tip, and the changed unit and acceptance tests pass on that merge. Two small things:

  1. Nit (comment) libs/agent/agent_notice.go:22-25: the merge in 5feabf3 took the base's version of this file, which undid the Provider doc comment update from 7446ce7 (made for review-oss-bot's thread on this line). Head says again "The SDK's agent request header still reads useragent.AgentProvider directly, so NotAnAgent does not reach it", and this PR makes that false for the root and bundle clients. Re-applying the 7446ce7 wording fixes it.
  2. Nit (test) cmd/root/auth_test.go:56: the "variable unset" subtest reads the process environment, so DATABRICKS_NOT_AN_AGENT=1 go test ./cmd/root -run TestProfileConfigNotAnAgentHeader fails at assert.Nil(t, cfg.HTTPTransport). The sibling TestApplyNotAnAgentHeaderUnsetLeavesConfig in libs/agent/agent_header_test.go calls testutil.SetAgentEnv first. Doing the same here, or t.Setenv("DATABRICKS_NOT_AN_AGENT", ""), makes the test independent of the environment.

Still open from the earlier review: review-oss-bot's point to send the two current-user me outputs in acceptance/cmd/aitools/not-an-agent/script (lines 44 and 46) to LOG.* instead of /dev/null, as .agents/rules/testing.md asks.

@denik
denik requested review from a team and denik November 30, 2026 08:42

@rclarey rclarey left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

experimental/ssh/internal/client/client.go:721: [nit] "Decisions to review" lists the apps logs effect but not this one. databricks ssh connect/server/agent-shim build &http.Client{Transport: client.Config.HTTPTransport} from the root client. With the variable unset, that transport is nil and those requests use http.DefaultTransport. With it set, they go through the wrapper to httptransport.HealthChecked, which turns on HTTP/2 pings and now also applies skip_verify. It's probably harmless, and it also drops the agent token there, but could you add it to the list so an eval comparison doesn't blame a network difference on the nudges? (Raised by the fresh Claude session and the devil's advocate.)


[nit] .agents/skills/pr-checklist/SKILL.md asks for a .nextchanges/ fragment for user-visible changes. No fragment in the tree mentions DATABRICKS_NOT_AN_AGENT, neither from this PR nor from #8126. If the variable is meant to be eval-only or internal, ignore this. Otherwise, one fragment for the stack (for example under cli/) saying the variable now also drops the agent/ User-Agent token would cover it. (Conventions reviewer only; it's a judgment call about whether the variable is user-facing.)


[non-blocking] libs/agent/agent_header.go:13: Should DATABRICKS_NOT_AN_AGENT also drop the SDK's meta-harness/<name> token? The SDK adds that token from useragent.MetaHarnessProvider() (SDK v0.204.0 config/api_client.go:90-99; today only OMNIGENT). withoutAgentToken only removes agent/ tokens. A baseline run under Omnigent with the variable set therefore still sends meta-harness/omnigent, and its requests still look agent-driven. If that's intended (a meta-harness "is not itself an agent"), a one-line comment would save the next reader the question. (Raised by Isaac Review and the devil's advocate.)

Comment thread bundle/config/workspace_test.go Outdated
// in libs/agent, which needs no loopback listener.
client, err = w.Client(envlib.Set(t.Context(), "DATABRICKS_NOT_AN_AGENT", "1"))
require.NoError(t, err)
assert.NotSame(t, httptransport.HealthChecked(false), client.Config.HTTPTransport)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nit] assert.NotSame(HealthChecked(false), …) and assert.NotNil(cfg.HTTPTransport) pass for any transport, so they don't show that the wrapper is installed or that it keeps the health-checked base. For example, a change that put the wrapper over a different base in Workspace.Client would still pass. Could these go through a small round-trip instead? Send a request with User-Agent: … agent/x through client.Config.HTTPTransport with a recording base, or check the base via a test-only accessor in libs/agent. Then the tests check the behaviour, not just that something changed. (Raised by Isaac Review, the fresh Claude session and the conventions reviewer.)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Taken in 34e0c26. The test now checks the behaviour through a small accessor, agent.WrappedTransport: with the variable unset the client's transport is not the wrapper, and with it set the transport is the wrapper over the same health-checked base (assert.Same against HealthChecked(false)). A wrapper over a different base would now fail. It needs no loopback listener, so it runs on Windows too.

Co-authored-by: Isaac <no-reply@databricks.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants