Skip to content

Dynamic DAG parameter options based on external configuration (dropdown / radio support) #56632

@rolfschleiss

Description

@rolfschleiss

Description

When triggering a DAG in the Airflow web UI, all parameters defined in the params section are currently rendered as plain text input fields.
It would be highly useful if Airflow supported dynamic UI field types (e.g. dropdowns or radio buttons) that can populate their options from external configuration files, such as INI, YAML or JSON.

Use case/motivation

In many environments, DAGs depend on configuration files that define available interfaces, systems, or targets.
For example, an INI file might describe multiple interfaces with different types:

[InterfaceA]
TYPE = Script

[InterfaceB]
TYPE = EBICS

[InterfaceC]
TYPE = Script

When triggering the DAG, users should be able to select from all sections that match a given condition (e.g. TYPE = Script), using a dropdown or radio button instead of free-text entry.

Example goal:

Show a dropdown listing InterfaceA and InterfaceC, because both are defined as TYPE = Script in the INI file.

This would make DAG triggering:

  • safer (no typos in interface names),
  • more dynamic (values adapt automatically to config changes),
  • and much more user-friendly for non-technical operators.

Alternatively, Airflow could provide a plugin interface to populate parameter choices dynamically,
so that DAG authors can implement their own logic for which options should appear.

Benefits

  • Greatly improves safety and UX for parameterized DAGs.
  • Keeps Airflow configuration-driven (no need to hardcode options).
  • Enables dynamic parameter lists that reflect live configuration.
  • Avoids invalid values and reduces operational mistakes.

Possible Implementation Notes

  • Extend the Web UI (React) to render dropdowns/radio fields when ui metadata is provided.
  • Allow a DAG to expose a small API or callable hook to fetch dynamic choices.
  • Could reuse existing Airflow variable/config reading mechanisms.

Proposed Change

Allow params definitions to reference an external source for valid options.

Example:

with DAG(
    "interface_trigger_dag",
    params={
        "interface_name": {
            "source": "config/interfaces.ini",
            "filter": {"TYPE": "Script"},
            "key": "section_name",
            "ui": "dropdown"  # or "radio"
        }
    },
) as dag:
    ...

Labels:
enhancement, UI, params, feature-request, dynamic-config

Related issues

#56427DAG Params Enum not works as expected
: Dropdown rendering for enum params not functioning correctly.

#42524DAG Param incorrectly convert enum objects to strings
: Enum parameters are displayed as plain strings instead of UI choices.

#31399Trigger UI Form Dropdowns with enums do not set default correctly
: Dropdown default value not applied properly in DAG trigger form.

#48481Multiple-choice Params (discussion)
: Community discussion about extending enum params to support richer UI controls.

#39904Dynamic DAG Params behave differently in manually triggered runs
: Dynamic parameter behavior inconsistency between manual and scheduled runs.

Are you willing to submit a PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions