The more common and cleaner approach, introduced with the TaskFlow API, is using return values. In a function decorated with @task , any value returned by the function is automatically pushed to XCom with the default key return_value . Subsequent tasks can then access this value simply by passing the output of the first task function as an argument. Best Practices and Limitations
process_record(get_latest_record_id())
In the explicit approach, you use the xcom_push and xcom_pull methods available on the ti (task instance) object. This is useful when a task needs to share multiple distinct pieces of information. For example, a PythonOperator might push a "status" flag and a "record_count" integer. xcom in airflow
@task def consume_one(data): return f"Got data['ids'][0]" The more common and cleaner approach, introduced with
# In airflow.cfg or helm values xcom_backend = airflow.utils.xcom.s3_xcom_backend.S3XComBackend xcom_s3_bucket = my-airflow-xcom-bucket The more common and cleaner approach
To demonstrate the retrieval, Mara showed Leo two ways to read the message. The "Hard Way" (using the XCom API) and the "Smart Way" (using Jinja templating).