Interact with Google Cloud Composer (Airflow). Use when reading task logs, checking DAG run status, debugging task failures, listing DAG runs, inspecting mapped tasks, querying XCom values, clearing runs, or when the user pastes a Composer URL. Triggers on composer, airflow logs, airflow task, dag run, task failed, debug airflow, composer URL, composer.googleusercontent.com, XCom, clear run.
Interact with Google Cloud Composer (Airflow) via the REST API.
Requires gcloud auth print-access-token — the user needs an active gcloud session and the access-reportify CloudDo permit.
# Explicit fields (primary interface)
scripts/composer logs --dag-id my.dag --run-id "scheduled__2025-03-30" --task-id my_task --errors
# URL shortcut (extracts dag_id, run_id, task_id, map_index automatically)
scripts/composer logs --url "https://...composer.googleusercontent.com/dags/my.dag?dag_run_id=...&task_id=..."
When the user pastes a Composer URL, use --url. When building commands from known fields, use explicit flags. Explicit flags override anything extracted from the URL.
scripts/composer logs --dag-id X --run-id Y --task-id Z # Task logs
scripts/composer logs --url "URL" --errors # Errors and tracebacks only
scripts/composer logs --url "URL" --try-number 2 # Specific attempt
scripts/composer status --dag-id X --run-id Y # Task counts by state + failures
scripts/composer runs --dag-id X -n 20 # List recent DAG runs
scripts/composer info --dag-id X --run-id Y --task-id Z # Task metadata (state, duration, inputs)
scripts/composer mapped --dag-id X --run-id Y --task-id Z # All map indices with state/duration
scripts/composer clear --dag-id X --run-id Y --dry-run # Preview which tasks would be cleared
scripts/composer clear --dag-id X --run-id Y # Clear and re-run failed tasks
scripts/composer xcom --dag-id X --run-id Y --task-id Z # List XCom entries
scripts/composer xcom --url "URL" --key return_value # Get specific XCom value
Run scripts/composer <subcommand> --help for full options.
| Topic | File | When to read |
|---|---|---|
| Raw Airflow REST API | references/airflow-rest-api.md | Event logs, variables, connections, or anything the CLI doesn't cover |
scripts/composer status --url "URL" to see task counts + all failuresscripts/composer logs --url "URL" --task-id TASK --errors--errors for full logsairflow/dags/scripts/composer mapped --url "URL" to see all map indices with state/durationscripts/composer logs --url "URL" --map-index N --errorsscripts/composer info --url "URL" --map-index N to see rendered input paramsscripts/composer clear --url "URL" --dry-run to previewscripts/composer clear --url "URL" to executescripts/composer xcom --url "URL" to list all keysscripts/composer xcom --url "URL" --key return_value for a specific value| Problem | Fix |
|---|---|
| 401 from API | Token expired — re-run gcloud auth print-access-token |
| 403 from API | Missing access-reportify CloudDo permit |
| 404 for task instance | Mapped task — use scripts/composer mapped instead |
No data for runs | Check DAG ID spelling — our DAGs encode environment: *.production.*, *.staging.* |
| Can't detect environment | Pass --base-url explicitly (see reference for URLs) |