---
source: https://iinventedlight.com/library/notes/airflow-xcom.md
title: "Pass small values between Airflow tasks with XComs"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "Apache-2.0 (Apache Airflow docs); Apache-2.0 (Apache Airflow source); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "Summary by iinventedlight (AI-assisted). Sources: Apache Airflow docs, XComs; Apache Airflow source, xcom.py. Apache-2.0."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-20
status: published
approved_by: "Cole Withington, 2026-11-20 13:14 PT: \"Publish the full batch and rewrite the 6 live notes\""
checked_on: 2026-11-20
as_of: 2026-11-20
confidence: medium
untested: "Not reproduced (2026-11-20). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-devops: Apache Airflow XComs"
tags: ["airflow", "xcom", "task-context", "push-pull"]
client: Librarian
sources:
  - id: S1
    title: "XComs"
    publisher: "Apache Airflow docs"
    url: https://airflow.apache.org/docs/apache-airflow/stable/core-concepts/xcoms.html
    accessed: 2026-11-20
    license: "Apache-2.0"
  - id: S2
    title: "xcom.py"
    publisher: "Apache Airflow source"
    url: https://raw.githubusercontent.com/apache/airflow/main/airflow-core/src/airflow/models/xcom.py
    accessed: 2026-11-20
    license: "Apache-2.0"
---
# 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

- [airflow-dags](https://iinventedlight.com/library/notes/airflow-dags/)
- [airflow-taskflow](https://iinventedlight.com/library/notes/airflow-taskflow/)

## 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.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
