Airflow Summit 2025 is coming October 07-09. Register now for early bird ticket!

airflow.providers.standard.operators.hitl

Classes

HITLOperator

Base class for all Human-in-the-loop Operators to inherit from.

ApprovalOperator

Human-in-the-loop Operator that has only 'Approval' and 'Reject' options.

HITLBranchOperator

BranchOperator based on Human-in-the-loop Response.

HITLEntryOperator

Human-in-the-loop Operator that is used to accept user input through TriggerForm.

Module Contents

class airflow.providers.standard.operators.hitl.HITLOperator(*, subject, options, body=None, defaults=None, multiple=False, params=None, **kwargs)[source]

Bases: airflow.models.baseoperator.BaseOperator

Base class for all Human-in-the-loop Operators to inherit from.

Parameters:
  • subject (str) – Headline/subject presented to the user for the interaction task.

  • options (list[str]) – List of options that the an user can select from to complete the task.

  • body (str | None) – Descriptive text (with Markdown support) that gives the details that are needed to decide.

  • defaults (str | list[str] | None) – The default options and the options that are taken if timeout is passed.

  • multiple (bool) – Whether the user can select one or multiple options.

  • params (airflow.sdk.definitions.param.ParamsDict | dict[str, Any] | None) – dictionary of parameter definitions that are in the format of Dag params such that a Form Field can be rendered. Entered data is validated (schema, required fields) like for a Dag run and added to XCom of the task result.

template_fields: collections.abc.Collection[str] = ('subject', 'body')[source]
subject[source]
body = None[source]
options[source]
defaults[source]
multiple = False[source]
params: airflow.sdk.definitions.param.ParamsDict = None[source]
validate_defaults()[source]

Validate whether the given defaults pass the following criteria.

  1. Default options should be the subset of options.

  2. When multiple is False, there should only be one option.

execute(context)[source]

Add a Human-in-the-loop Response and then defer to HITLTrigger and wait for user input.

property serialzed_params: dict[str, Any][source]
execute_complete(context, event)[source]
process_trigger_event_error(event)[source]
validate_chosen_options(chosen_options)[source]

Check whether user provide valid response.

validate_params_input(params_input)[source]

Check whether user provide valid params input.

class airflow.providers.standard.operators.hitl.ApprovalOperator(ignore_downstream_trigger_rules=False, **kwargs)[source]

Bases: HITLOperator, airflow.providers.standard.utils.skipmixin.SkipMixin

Human-in-the-loop Operator that has only ‘Approval’ and ‘Reject’ options.

inherits_from_skipmixin = True[source]
FIXED_ARGS = ['options', 'multiple'][source]
ignore_downstream_trigger_rules = False[source]
execute_complete(context, event)[source]
class airflow.providers.standard.operators.hitl.HITLBranchOperator(**kwargs)[source]

Bases: HITLOperator

BranchOperator based on Human-in-the-loop Response.

abstract execute_complete(context, event)[source]
class airflow.providers.standard.operators.hitl.HITLEntryOperator(**kwargs)[source]

Bases: HITLOperator

Human-in-the-loop Operator that is used to accept user input through TriggerForm.

Was this entry helpful?