XComs (Cross-Communication) are Airflow's mechanism for passing small values between tasks within the same DAG run. Dynamic task generation — creating task instances at runtime based on data rather than at DAG-definition time — enables parametrised fan-out where the number of parallel tasks is not known when the DAG is written. Together, XComs and dynamic tasks unlock pipeline patterns that static DAGs cannot express: a pipeline that discovers how many data sources to process at runtime and spins up exactly that many tasks in parallel.
The key XCom design constraint is size: values stored in the metadata database are limited to tens of kilobytes by default. XComs suit coordination values — file paths, row counts, status flags — not data payloads. Pushing a large DataFrame to XCom is the most common source of mysterious Airflow failures, hard to trace because the error occurs at serialisation time rather than where the data was created. Always pass S3 or file paths between tasks and read data from storage inside each downstream task.
Analogy🏏Cricket
🏏 Think of it like cricket: Migrating from Airflow to Prefect is like the same bowling coach shifting from traditional Test cricket notation to a modern T20 analytics dashboard — the underlying ball-by-ball data (the business logic) is exactly the same. What changes is how the data is recorded, displayed, and acted upon. The yorker that Bumrah bowls in over 20 is identical whether it is recorded in the old scorebook (Airflow DAG file) or the new analytics platform (Prefect flow). The migration is a transcription exercise, not a strategy change — and a wise coach verifies that the runs, wickets, and economies match exactly between the old and new system before decommissioning the scorebook. That verification step is the whole heart of the migration: because the yorker is unchanged, the only honest test is to run the same over through both systems and confirm the recorded runs, wickets and economies match to the last digit before the old scorebook is thrown away. Rushing to burn the scorebook the moment the shiny dashboard lights up is how teams lose a season of records to a silent transcription slip. The coach keeps both systems running in parallel for a while, reconciles their outputs ball by ball, and only when every figure agrees does he trust the new dashboard alone — a transcription is only complete when you have proven nothing was lost in the copying.
🏏 Showing the Cricket analogy — a Cricket version isn’t available for this concept yet.