Ashwin_DSA
Databricks Employee
Databricks Employee

Hi @karuppusamy,

Databricks fully supports deploying Genie Agents (formerly Genie Spaces) as code using Declarative Automation Bundles (DABs), which makes CI/CD promotion from dev to QA to production straightforward

As of Databricks CLI version 1.3.0, you can define a Genie Agent as a genie_spaces resource in your databricks.yml. A key requirement is that Genie Agent bundles must use the direct deployment engine (engine: direct). 

Here is a minimal example.

# databricks.yml
bundle:
  name: my-genie-agent
  engine: direct  # required for genie_spaces

resources:
  genie_spaces:
    my_genie:
      title: 'Sales Analytics Agent'
      description: 'Ask questions about sales data'
      warehouse_id: ${var.warehouse_id}
      file_path: ./my_genie.geniespace.json
      permissions:
        - level: CAN_RUN
          group_name: users

The file_path points to a JSON file that holds the full serialized definition of your Genie space, including data sources, column configs, text instructions, and sample questions. You can export this from your existing dev Genie and check it into source control alongside your bundle config.

To deploy the same Genie to QA and Production, define separate targets in your bundle and use variables to swap environment-specific values like warehouse_id and catalog names. Refer here.

variables:
  warehouse_id:
    description: SQL warehouse for the Genie Agent
  catalog:
    description: Unity Catalog to query

targets:
  dev:
    mode: development
    default: true
    workspace:
      host: https://dev-workspace.databricks.com
    variables:
      warehouse_id: abc123
      catalog: dev_catalog

  qa:
    workspace:
      host: https://qa-workspace.databricks.com
    variables:
      warehouse_id: def456
      catalog: qa_catalog

  prod:
    mode: production
    workspace:
      host: https://prod-workspace.databricks.com
      root_path: /Workspace/Production/.bundle/${bundle.name}
    run_as:
      service_principal_name: '<your-sp-application-id>'
    variables:
      warehouse_id: ghi789
      catalog: prod_catalog

Then deploy to each environment in your CI/CD pipeline:

databricks bundle validate --target qa
databricks bundle deploy --target qa

databricks bundle validate --target prod
databricks bundle deploy --target prod

I would recommend using a service principal for production. Setting run_as to a service principal ensures deployments and runs are not tied to an individual user account. Databricks recommends this for any staging or production target. 

Also, when you set mode: production, the CLI validates that Git branches match, artifact paths are not user-specific, and permissions are explicitly declared. You can override the Git check with --force if needed.

Hope this helps you get your Genie promoted smoothly. If you run into anything specific during the deployment, feel free to share the error and we can dig in further.

If this answer resolves your question, could you mark it as “Accept as Solution”? That helps other users quickly find the correct fix.

 

Regards,
Ashwin | Delivery Solution Architect @ Databricks
Helping you build and scale the Data Intelligence Platform.
***Opinions are my own***

View solution in original post