A Dag file is a Python module in the dags/ folder. Airflow's Dag processor runs the file and keeps every Dag it creates. There are two ways to write one, and both appear in real projects.
with DAG(dag_id=..., schedule=..., start_date=...): opens a block, and every operator created inside it belongs to that Dag. The @dag decorator turns a function into a Dag factory instead: the Dag exists only once you call the function at the bottom of the file. Forgetting that call is the most common reason a new Dag does not appear.
Airflow 3 imports both from the Task SDK: from airflow.sdk import DAG, dag, task. The schedule goes in schedule (the old schedule_interval argument is gone in Airflow 3). Use a fixed start_date in the past, made with pendulum.datetime(2026, 11, 1, tz="UTC"), never datetime.now(). The dag_id may use letters, digits, dashes, dots and underscores.
The smallest useful Dag: two placeholder tasks in order. Indentation decides which Dag they belong to.