[DRAFT] Add experimental genie-cli command#5989
Open
tedjt wants to merge 6 commits into
Open
Conversation
Add `databricks experimental genie-cli`: an out-of-the-box interactive AI
coding agent preconfigured for a Databricks workspace. It authenticates
through the workspace and routes model requests through the Databricks AI
Gateway (no separate model API keys), and it preloads the Databricks skills
plugin so the agent works effectively against Databricks.
The command orchestrates an existing launcher (ucode) driving Codex, but
that runtime is an intentional implementation detail: users only interact
with `genie-cli`. On each run it:
1. ensures the launcher runtime is installed (installing it via uv, and
erroring with actionable instructions when uv is absent),
2. configures the agent against the resolved workspace non-interactively,
3. installs the Databricks skills plugin for the agent if not already
recorded, then refreshes it (refresh failures are non-fatal so the
agent still starts offline), and
4. hands off to the interactive agent session via process replacement.
Co-authored-by: Isaac
Contributor
Waiting for approvalBased on git history, these people are best suited to review:
Eligible reviewers: Suggestions based on git history. See OWNERS for ownership rules. |
Make the agent operate as a Databricks CLI assistant out of the box:
- Inject a default system prompt (adapted from the Genie Code agent,
retargeted to the real `databricks` CLI, the Databricks skills, and the
Databricks MCP servers). It is injected per-session only, via the agent's
`-c developer_instructions=` override — an additive developer-role message,
so nothing is written to the user's agent config and their own instructions
are untouched. `--no-system-prompt` opts out.
- Embed the resolved workspace host and CLI profile in the prompt so the
agent acts against the same workspace and profile genie-cli authenticated
with.
- Register Databricks MCP services from system.ai for the session
(best-effort: a workspace without those services warns and still launches).
Co-authored-by: Isaac
Mark genie-cli Hidden like the other in-progress experimental commands (genie, aitools). It stays fully runnable; it just doesn't list in `databricks experimental --help`. Co-authored-by: Isaac
Guide the agent to answer data discovery and data-science / analytics questions with `databricks experimental genie ask "<question>"` instead of hand-writing SQL, falling back to SQL only when Genie can't answer or the user is authoring a query/pipeline. Co-authored-by: Isaac
Sharpen the prompt around one decision: if a task does not depend on the user's local filesystem, do the whole thing through `genie ask` rather than using Genie only to find tables and then hand-writing SQL locally. Genie gives a better, workspace-grounded, shareable result and still returns the SQL and tables it used (via --include-sql / --output json) so the agent can explore further locally when the task genuinely needs it. Co-authored-by: Isaac
Add a --harness flag (default codex) so the user can choose which coding
agent ucode launches, with pass-through for any ucode agent name.
Make system-prompt injection harness-aware, since agents differ:
- codex: inline `-c developer_instructions=<toml>` (unchanged).
- opencode: no inline flag, so the prompt is written to a genie-cli-managed
file and referenced via OPENCODE_CONFIG_CONTENT={"instructions":[...]},
whose entries opencode appends to the model context. Still session-scoped
(env var only) and non-destructive to the user's own opencode config.
- any other harness: launched with no prompt injection.
Skip the aitools plugin step for harnesses without a headless plugin (e.g.
opencode, which is skills-only): those rely on the injected system prompt.
Co-authored-by: Isaac
Contributor
|
An authorized user can trigger integration tests manually by following the instructions below: Trigger: Inputs:
Checks will be approved automatically on success. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
databricks experimental genie-cli: an out-of-the-box interactive AI coding agent preconfigured for a Databricks workspace. It authenticates through the workspace and routes model requests through the Databricks AI Gateway (no separate model API keys), preloads the Databricks skills plugin, registers Databricks MCP tools, and primes the agent with a Databricks-aware system prompt.The command orchestrates an existing launcher (ucode) driving a coding agent, but that runtime is an intentional implementation detail: users only interact with
genie-cli. The command isHidden, matching the other in-progress experimental commands.What each run does
uv tool installwhen missing, and errors with actionable instructions whenuvitself is absent (no speculative auto-bootstrap ofuv).--profile,DATABRICKS_CONFIG_PROFILE, the default profile, or env-var auth):--profiles <name>for a named profile (adding--use-patfor PAT profiles), else--workspaces <host>. This step also installs the agent binary and the Databricks CLI the launcher relies on.system.ai(best-effort).libs/execv, the same primitivedatabricks psqluses).Choosing the coding agent (
--harness)--harness(defaultcodex) selects which agent ucode launches; any ucode agent name is accepted.codexandopencodeare both primed with the Databricks system prompt; other agents launch without injection.System prompt
The prompt is adapted from the internal Genie Code agent, retargeted to the real
databricksCLI, the installed Databricks skills, and the Databricks MCP servers. It:genie-cliauthenticated with.databricks experimental genie ask "<question>"— for a better, workspace-grounded, shareable result — rather than using Genie only to find tables and then hand-writing SQL locally. Genie still returns the SQL and tables it used, so the agent can explore further locally when the task genuinely needs it.-c developer_instructions=<toml>(additive developer-role message).OPENCODE_CONFIG_CONTENT={"instructions":[...]}, whose entries opencode appends to the model context (opencode has no inline system-prompt flag).--no-system-prompt.Testing
go build ./...,go test ./experimental/geniecli/...(unit tests for arg construction, runtime detection/install, harness-aware launch args + env, prompt rendering with/without profile, per-harness injection, and the non-plugin-harness skip), andgolangci-lintall pass (0 issues).go.mod/go.sumchanges). Reuseslibs/aitools/installerso plugin behavior stays consistent withdatabricks aitools.--harness/--no-system-promptand help render correctly.Note: the underlying agent runtime and MCP/opencode behavior have been verified against ucode/opencode/Codex source and unit tests, but not yet in a live end-to-end session (which would install ucode + an agent and mutate agent config).