Labels
Categorize and filter DAGs and DAG runs using labels.
Overview
Labels support key-value pairs (env=prod) and simple labels (critical). Values are normalized to lowercase.
Label Format
Labels are validated at DAG load time. Invalid labels cause load errors.
| Component | Rules |
|---|---|
| Key | 1-63 characters. Alphanumeric, -, _, .. Must start with letter or number. |
| Value | 0-255 characters. Alphanumeric, -, _, ., /. |
Valid: env, my-label, app.version, path=foo/bar
Invalid: -starts-with-dash, has space, has@special
YAML Formats
All formats below are equivalent:
# String: space-separated key=value
labels: "env=prod team=platform"
# String: comma-separated (simple labels)
labels: "production, critical, batch"
# Map notation
labels:
env: prod
team: platform
# Array of strings
labels:
- env=prod
- team=platform
- critical
# Array of maps
labels:
- env: prod
- team: platform
# Mixed array
labels:
- env=prod
- critical
- team: platformtags is accepted as a deprecated alias for compatibility with existing DAGs. Do not set both labels and tags in the same DAG.
API Filtering
Filter DAGs and DAG runs using the labels query parameter. dagu history --labels takes the same filter.
Filter Syntax
| Syntax | Description |
|---|---|
key | Match any item with this key (any value) |
key=value | Match exact key-value pair |
key= | Match items with this key and no value |
key* | Wildcard: match keys starting with key |
key=value* | Wildcard: match values starting with value |
te?m | Wildcard: ? matches single character |
! before any term | Match items that do not match the term, such as !deprecated, !env=dev, or !region=us-* |
Multiple filters use AND logic. Keys and values match without case.
A term that has none of these forms, such as env==prod, =prod, or a lone !, is an error. The API returns 400 with invalid label filter "<term>", and dagu history exits non-zero.
Wildcard Patterns
Use * (any characters) and ? (single character) for pattern matching:
# Match env=prod, env=production, env=prod-us
GET /api/v1/dags?labels=env=prod*
# Match any value for team key
GET /api/v1/dags?labels=team=*
# Match keys starting with "env"
GET /api/v1/dags?labels=env*
# Match team or teem (single char wildcard)
GET /api/v1/dags?labels=te?mDAG Filtering
# DAGs with "env" key (any value)
GET /api/v1/dags?labels=env
# DAGs with env=prod
GET /api/v1/dags?labels=env=prod
# DAGs with env=prod AND team key
GET /api/v1/dags?labels=env=prod,team
# DAGs without "deprecated" key
GET /api/v1/dags?labels=!deprecated
# DAGs not labeled env=dev
GET /api/v1/dags?labels=!env=dev
# Combined: env=prod AND has team AND not deprecated
GET /api/v1/dags?labels=env=prod,team,!deprecatedDAG Runs Filtering
Filter runs from DAGs that have the specified labels:
# Runs from DAGs with "env" key
GET /api/v1/dag-runs?labels=env
# Runs from DAGs with env=prod
GET /api/v1/dag-runs?labels=env=prod
# Runs from DAGs with env=prod AND team key
GET /api/v1/dag-runs?labels=env=prod,teamUI
The label filter dropdown is available on both the DAG list and DAG runs pages. Select labels to filter; multiple labels use AND logic. A typed term follows the same syntax, and an invalid one shows the error instead of the list.

