Pass small values between Airflow tasks with XComs
Answer: XComs, short for cross-communications, let one task push a value and another task pull it by key. Use the Task Context for those operations, not the database model.
Push and pull
XComs, short for cross-communications, are a mechanism that lets tasks exchange values. An XCom is identified by a key. Values are explicitly pushed and pulled to or from storage using xcom_push and xcom_pull. Perform XCom operations through the Task Context with get_current_context(). Updating the XCom database model directly is not possible.
Always specify task_ids explicitly when pulling from other tasks. You can also use XComs in templates. XComs can't be used to persist state across task retries or Sensors poke.
| xcom_push | xcom_pull | |---|---| | push a value | pull a value | | Task Context | get_current_context | | BaseXCom | backend subclass |
Keys and backends
A backend is a subclass of BaseXCom. Parameters include a key to store the XCom and a value to store. An optional serialize parameter specifies if the value should be serialized or not. If a key is provided to a query, only XComs with matching keys will be returned. Only XComs from a task with matching IDs will be pulled. A map_index, if given, clears XCom only from that particular mapped task. Passing None, the default, clears all XComs from the task.
See also
Claims
- id: C1 claim: XCom operations should be performed through the task context. source: S1 evidence: "XCom operations should be performed through the Task Context using get_current_context() ."
- id: C2 claim: Direct updates through the XCom database model are not possible. source: S1 evidence: "Directly updating using XCom database model is not possible."
- id: C3 claim: An XCom set call takes a key and a value to store. source: S2 evidence: "Key to store the XCom."
Sources
- [S1] XComs. Apache Airflow docs. https://airflow.apache.org/docs/apache-airflow/stable/core-concepts/xcoms.html . License: Apache-2.0. Accessed 2026-11-20.
- [S2] xcom.py. Apache Airflow source. https://raw.githubusercontent.com/apache/airflow/main/airflow-core/src/airflow/models/xcom.py . License: Apache-2.0. Accessed 2026-11-20.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Apache Airflow docs, XComs; Apache Airflow source, xcom.py. Apache-2.0. Text was condensed and changed from the originals.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Apache Airflow docs, XComs; Apache Airflow source, xcom.py. Apache-2.0.
Cite this
iinventedlight. 2026. "Pass small values between Airflow tasks with XComs." iinventedlight Library, iil:note:j365rtrd, version of 2026-11-20. https://iinventedlight.com/library/notes/airflow-xcom/. License: CC-BY-4.0.
@misc{iil_note_j365rtrd,
author = {{iinventedlight}},
title = {{Pass small values between Airflow tasks with XComs}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-20},
url = {https://iinventedlight.com/library/notes/airflow-xcom/},
note = {Permanent ID iil:note:j365rtrd. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).
Extra files beside this note
These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.
- airflow-xcom.table.json (table; CC-BY-4.0)
- airflow-xcom.schema.json (schema; CC-BY-4.0)
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/airflow-xcom.md.