---
title: Workload YAML reference
description: Reference for AI Runtime workload YAML configurations used with the Databricks CLI, including compute, environment, code, and run fields.
canonical_url: https://docs.databricks.com/aws/en/machine-learning/ai-runtime/connecting/cli/yaml-config
---

# Workload YAML reference

This page describes the workload YAML fields accepted by `databricks air run`. For command syntax and flags, see [databricks air run](https://docs.databricks.com/aws/en/dev-tools/cli/reference/air-commands.md#databricks-air-run). To submit a workload, see [AI Runtime quickstart](https://docs.databricks.com/aws/en/machine-learning/ai-runtime/quickstart.md).

Every workload requires [`experiment_name`](https://docs.databricks.com/aws/en/machine-learning/ai-runtime/connecting/cli/yaml-config.md#experiment-name), [`compute`](https://docs.databricks.com/aws/en/machine-learning/ai-runtime/connecting/cli/yaml-config.md#compute), and [`command`](https://docs.databricks.com/aws/en/machine-learning/ai-runtime/connecting/cli/yaml-config.md#command).

##### Example

The following example shows a sample workload configuration:

```yaml
experiment_name: my-training
compute:
  accelerator_type: GPU_1xA10
  num_accelerators: 1
environment:
  version: 6
  dependencies:
    - torch
code_source:
  root_path: .
command: python $CODE_SOURCE_PATH/train.py
```

<a id="experiment-name" />

## experiment\_name

**Type:** String

Required. The `experiment_name` key is the MLflow experiment name.

If an experiment with this name does not exist, AI Runtime creates it. Otherwise, AI Runtime adds the new run to the existing experiment.

## compute

**Type:** Map

Required. The `compute` object defines the accelerator configuration.

| Key                | Type    | Description                                                                                                                                                                                                      |
| ------------------ | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `accelerator_type` | string  | Required. One of the [accelerator types](https://docs.databricks.com/aws/en/machine-learning/ai-runtime/connecting/cli/yaml-config.md#accelerator-types) available in the workspace. Matching is case-sensitive. |
| `num_accelerators` | integer | Required. The total number of GPUs to allocate. Must be a multiple of the GPUs per node for the selected accelerator type.                                                                                       |

<a id="reference" />

<a id="accelerator-types" />

### Accelerator types

Each `accelerator_type` value has the form `GPU_<GPUs per node>x<GPU model>`. For example, `GPU_8xH100` is a node with eight H100 GPUs. Use the exact value from the following table, including the `GPU_` prefix and capitalization:

| `accelerator_type` | GPU                                          | GPUs per node | Valid `num_accelerators`                    |
| ------------------ | -------------------------------------------- | ------------- | ------------------------------------------- |
| `GPU_1xA10`        | NVIDIA A10, 24 GB                            | 1             | Positive integer                            |
| `GPU_1xH100`       | NVIDIA H100, 80 GB                           | 1             | `1`                                         |
| `GPU_8xH100`       | NVIDIA H100, 80 GB per GPU                   | 8             | A multiple of 8, such as `8`, `16`, or `64` |
| `GPU_8xB300`       | NVIDIA B300, 288 GB per GPU (Public Preview) | 8             | A multiple of 8, such as `8` or `16`        |

The number of nodes provisioned is `num_accelerators` divided by the GPUs per node. For example, `accelerator_type: GPU_8xH100` with `num_accelerators: 16` provisions two 8xH100 nodes.

Accelerator availability depends on the workspace, cloud, and region. To list the accelerator types available in your workspace, run:

```bash
databricks air run -h config.compute.accelerator_type
```

For help choosing hardware, see [ Hardware](https://docs.databricks.com/aws/en/machine-learning/ai-runtime/overview.md#hardware-options).

<a id="command-and-parameters" />

## command

**Type:** String

Required. The `command` key contains a nonempty shell command or script. Paths in the command refer to remote file paths in the workload container. When `code_source` is set, `$CODE_SOURCE_PATH` contains the absolute path to the extracted code.

<a id="environment" />

<a id="python-dependencies" />

<a id="custom-docker-images" />

## environment

**Type:** Map

The `environment` object selects a managed environment with optional dependencies or a custom Unity Catalog image.

| Key                   | Type              | Description                                                                                                                                                                                                                                                                                                                         |
| --------------------- | ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `version`             | string or integer | A numeric [environment version](https://docs.databricks.com/aws/en/release-notes/serverless/environment-version/index.md), such as `6`, or a Databricks AI environment identifier, such as `databricks_ai_v6`. A `databricks_ai_v` identifier requires version 5 or above. If omitted, the CLI uses the current AI Runtime default. |
| `dependencies`        | list of strings   | Package specifications passed to the serverless environment. Defaults to no additional dependencies.                                                                                                                                                                                                                                |
| `unity_catalog_image` | string            | A custom image in the format `<catalog>.<schema>.<image>:<tag>`. Mutually exclusive with `version` and `dependencies`. For setup instructions, see [Use custom Docker images with AI Runtime](https://docs.databricks.com/aws/en/machine-learning/ai-runtime/connecting/cli/docker-images.md).                                      |

For guidance about selecting and extending an environment, see [Set up your AI Runtime environment](https://docs.databricks.com/aws/en/machine-learning/ai-runtime/develop-workloads/environment.md).

##### Managed environment example

```yaml
environment:
  version: 6
  dependencies:
    - torch
```

To use a custom image instead of a managed environment, specify only `unity_catalog_image`:

##### Custom image example

```yaml
environment:
  unity_catalog_image: main.ml.training:v1
```

<a id="code-source" />

<a id="work-with-code-sources" />

## code\_source

**Type:** Map

The `code_source` object packages local code for the workload.

| Key             | Type            | Description                                                                                                                                                                       |
| --------------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `root_path`     | string          | Required when `code_source` is set. The local directory to package. The directory must exist when the CLI stages the run.                                                         |
| `remote_volume` | string          | A Unity Catalog volume location for the uploaded archive. Must start with `/Volumes/`. Defaults to a workspace location.                                                          |
| `include_paths` | list of strings | Paths to include relative to `root_path`. Entries must be nonempty and relative, and cannot contain `..`. Omit the key to include all selected files. An empty list is not valid. |
| `git`           | object          | Pins the code source snapshot to a local Git branch or commit.                                                                                                                    |

If you omit `git`, the CLI packages the working tree, including uncommitted and untracked files that are not excluded by Git ignore rules. A relative `root_path` resolves from the directory that contains the workload YAML file.

<a id="code-source-git" />

### git

**Type:** Map

The `git` object supports the following keys:

| Key      | Type   | Description                                                                                                                  |
| -------- | ------ | ---------------------------------------------------------------------------------------------------------------------------- |
| `branch` | string | Required when `commit` is omitted. Packages the local HEAD of the branch. Selected files cannot contain uncommitted changes. |
| `commit` | string | Required when `branch` is omitted. Packages a commit from the local Git object store. Mutually exclusive with `branch`.      |

##### Example

The following example packages selected paths from the local `main` branch:

```yaml
code_source:
  root_path: ./src
  include_paths:
    - training
    - configs
  git:
    branch: main
```

<a id="env-variables" />

## env\_variables

**Type:** Map of strings

The `env_variables` key contains plain environment variable names and string values. A name cannot also appear in `secrets`.

##### Example

```yaml
env_variables:
  BATCH_SIZE: '32'
  LEARNING_RATE: '0.001'
```

<a id="idempotency-token" />

## idempotency\_token

**Type:** String

The `idempotency_token` key identifies repeated submissions. A repeated submission with the same token returns the existing run. The CLI generates a UUID when this key is omitted. The `--idempotency-key` command flag takes precedence.

<a id="max-retries" />

## max\_retries

**Type:** Integer

The `max_retries` key specifies the number of retries after the initial attempt. The value must be nonnegative. Default: `3`.

<a id="mlflow-artifact-location" />

## mlflow\_artifact\_location

**Type:** String

The `mlflow_artifact_location` key contains a `dbfs:/` URI or `/Volumes/` path. If you omit this key, a new experiment uses the default DBFS location, and an existing experiment uses its configured artifact location. For an existing experiment, the value must match the experiment's artifact location.

<a id="mlflow-experiment-directory" />

## mlflow\_experiment\_directory

**Type:** String

The `mlflow_experiment_directory` key contains the workspace directory for the experiment. The path must start with `/Workspace`.

<a id="mlflow-run-name" />

## mlflow\_run\_name

**Type:** String

The `mlflow_run_name` key contains the run name. If you omit this key, the run name defaults to the value of `experiment_name`.

## parameters

**Type:** Map

The `parameters` key contains free-form nested values. The CLI serializes the values to `hyperparameters.yaml` with the other launch artifacts.

##### Example

```yaml
parameters:
  learning_rate: 0.001
  model:
    hidden_size: 1024
```

## permissions

**Type:** List of maps

The `permissions` key contains grants applied after submission. If a grant fails, the run remains created and the CLI prints a warning.

Each grant supports the following keys:

| Key                      | Type   | Description                                                                                                               |
| ------------------------ | ------ | ------------------------------------------------------------------------------------------------------------------------- |
| `level`                  | string | Required. A permission level, such as `CAN_VIEW` or `CAN_MANAGE`. The workspace validates the value.                      |
| `user_name`              | string | The user email. Specify exactly one of `user_name`, `group_name`, or `service_principal_name` for each grant.             |
| `group_name`             | string | The group name. Specify exactly one of `user_name`, `group_name`, or `service_principal_name` for each grant.             |
| `service_principal_name` | string | The service principal name. Specify exactly one of `user_name`, `group_name`, or `service_principal_name` for each grant. |

##### Example

```yaml
permissions:
  - user_name: trainer@example.com
    level: CAN_MANAGE
  - group_name: training-team
    level: CAN_VIEW
```

## <a id="secrets" />secrets

**Type:** Map of strings

The `secrets` key contains environment variable names mapped to secret references in the exact `scope/key` format. The scope and key must be nonempty. A name cannot also appear in `env_variables`.

##### Example

```yaml
secrets:
  HF_TOKEN: <scope-name>/<key-name>
```

For information about creating and managing secrets, see [Secret management](https://docs.databricks.com/aws/en/security/secrets/index.md).

To pass credentials such as a Hugging Face token to a workload, see [Pass credentials to a workload with secrets](https://docs.databricks.com/aws/en/machine-learning/ai-runtime/develop-workloads/environment.md#pass-credentials-with-secrets).

<a id="timeout-minutes" />

## timeout\_minutes

**Type:** Integer

The `timeout_minutes` key sets the wall-clock limit for the complete run, including retries. The value must be positive. If omitted, the workload uses the AI Runtime default.

<a id="usage-policy-id" />

## usage\_policy\_id

**Type:** String

The `usage_policy_id` key contains the canonical UUID of an existing serverless usage policy. Mutually exclusive with `usage_policy_name`.

<a id="usage-policy-name" />

## usage\_policy\_name

**Type:** String

The `usage_policy_name` key contains the name of an existing serverless usage policy. Mutually exclusive with `usage_policy_id`.

For information about creating usage policies, see [Attribute usage with serverless usage policies](https://docs.databricks.com/aws/en/admin/usage/budget-policies.md).

## Additional resources

* [AI Runtime quickstart](https://docs.databricks.com/aws/en/machine-learning/ai-runtime/quickstart.md)
* [`air` command group](https://docs.databricks.com/aws/en/dev-tools/cli/reference/air-commands.md)
* [Use custom Docker images with AI Runtime](https://docs.databricks.com/aws/en/machine-learning/ai-runtime/connecting/cli/docker-images.md)
* [Environment versions](https://docs.databricks.com/aws/en/release-notes/serverless/environment-version/index.md)
