$npx -y skills add astronomer/agents --skill managing-astro-local-envManage local Airflow environment with Astro CLI (Docker and standalone modes). Use when the user wants to start, stop, or restart Airflow, view logs, query the Airflow API, troubleshoot, or fix environment issues. For project setup, see setting-up-astro-project.
| 1 | # Astro Local Environment |
| 2 | |
| 3 | This skill helps you manage your local Airflow environment using the Astro CLI. |
| 4 | |
| 5 | Two modes: **Docker** (default, uses containers) and **Standalone** (Docker-free, uses a local venv — requires Airflow 3 + `uv`). |
| 6 | |
| 7 | > **To set up a new project**, see the **setting-up-astro-project** skill. |
| 8 | > **When Airflow is running**, use MCP tools from **authoring-dags** and **testing-dags** skills. |
| 9 | |
| 10 | --- |
| 11 | |
| 12 | ## Start / Stop / Restart (Docker) |
| 13 | |
| 14 | ```bash |
| 15 | # Start local Airflow (webserver at http://localhost:8080) |
| 16 | astro dev start |
| 17 | |
| 18 | # Stop containers (preserves data) |
| 19 | astro dev stop |
| 20 | |
| 21 | # Kill and remove volumes (clean slate) |
| 22 | astro dev kill |
| 23 | |
| 24 | # Restart all containers |
| 25 | astro dev restart |
| 26 | |
| 27 | # Restart specific component |
| 28 | astro dev restart --scheduler |
| 29 | astro dev restart --webserver |
| 30 | ``` |
| 31 | |
| 32 | **Default credentials:** admin / admin |
| 33 | |
| 34 | **Restart after modifying:** `requirements.txt`, `packages.txt`, `Dockerfile` |
| 35 | |
| 36 | > **Standalone mode?** See the next section. |
| 37 | |
| 38 | --- |
| 39 | |
| 40 | ## Standalone Mode |
| 41 | |
| 42 | Docker-free local development. Runs Airflow directly on your machine in a `.venv/` managed by `uv`. |
| 43 | |
| 44 | **Requirements:** Airflow 3 (runtime 3.x), `uv` on PATH. Not supported on Windows. |
| 45 | |
| 46 | > Plain `astro dev init` already pins a runtime 3.x image, so no version flag is needed. See **setting-up-astro-project** for project initialization. |
| 47 | |
| 48 | ### Start |
| 49 | |
| 50 | ```bash |
| 51 | # One-time: set standalone as default mode |
| 52 | astro config set dev.mode standalone |
| 53 | |
| 54 | # Or use the flag per invocation |
| 55 | astro dev start --standalone |
| 56 | ``` |
| 57 | |
| 58 | | Flag | Description | |
| 59 | |------|-------------| |
| 60 | | `--foreground` / `-f` | Stream output in foreground | |
| 61 | | `--port` / `-p` | Override webserver port (default: 8080) | |
| 62 | | `--no-proxy` | Disable reverse proxy | |
| 63 | |
| 64 | ### Stop / Kill / Restart |
| 65 | |
| 66 | ```bash |
| 67 | # Stop (preserves .venv) |
| 68 | astro dev stop |
| 69 | |
| 70 | # Kill (removes .venv and .astro/standalone/ — clean slate) |
| 71 | astro dev kill |
| 72 | |
| 73 | # Restart (preserves .venv for fast restart, use -k to kill first) |
| 74 | astro dev restart |
| 75 | ``` |
| 76 | |
| 77 | > If you used `--standalone` on start instead of setting the config, pass `--standalone` on every subsequent command too (stop, kill, restart, bash, run, logs, etc.). |
| 78 | |
| 79 | **State locations:** venv in `.venv/`, database and logs in `.astro/standalone/`, DAGs from `dags/`. |
| 80 | |
| 81 | --- |
| 82 | |
| 83 | ## Reverse Proxy |
| 84 | |
| 85 | Run multiple Airflow projects locally without port conflicts. Works in both Docker and standalone modes. |
| 86 | |
| 87 | Each project gets a hostname like `<project-name>.localhost:6563`. Visit `http://localhost:6563` to see all active projects. |
| 88 | |
| 89 | ```bash |
| 90 | # Check proxy status and active routes |
| 91 | astro dev proxy status |
| 92 | |
| 93 | # Force-stop proxy (auto-restarts on next astro dev start) |
| 94 | astro dev proxy stop |
| 95 | ``` |
| 96 | |
| 97 | | Config | Command | |
| 98 | |--------|---------| |
| 99 | | Change proxy port | `astro config set proxy.port <port>` | |
| 100 | | Disable per-start | `astro dev start --no-proxy` | |
| 101 | |
| 102 | Default proxy port: **6563** |
| 103 | |
| 104 | --- |
| 105 | |
| 106 | ## Check Status |
| 107 | |
| 108 | ```bash |
| 109 | astro dev ps |
| 110 | ``` |
| 111 | |
| 112 | --- |
| 113 | |
| 114 | ## View Logs |
| 115 | |
| 116 | ```bash |
| 117 | # All logs |
| 118 | astro dev logs |
| 119 | |
| 120 | # Specific component |
| 121 | astro dev logs --scheduler |
| 122 | astro dev logs --webserver |
| 123 | |
| 124 | # Follow in real-time |
| 125 | astro dev logs -f |
| 126 | ``` |
| 127 | |
| 128 | **Standalone:** `astro dev logs` works the same but shows a unified log (no per-component filtering). |
| 129 | |
| 130 | --- |
| 131 | |
| 132 | ## Run Airflow CLI Commands |
| 133 | |
| 134 | ```bash |
| 135 | # Open a shell with Airflow environment |
| 136 | astro dev bash |
| 137 | |
| 138 | # Run Airflow CLI commands |
| 139 | astro dev run airflow info |
| 140 | astro dev run airflow dags list |
| 141 | ``` |
| 142 | |
| 143 | **Standalone:** Same commands work — `bash` opens a venv-activated shell, `run` executes in the venv. |
| 144 | |
| 145 | --- |
| 146 | |
| 147 | ## Querying the Airflow API |
| 148 | |
| 149 | Use `astro api airflow` to query a running local Airflow instance. Prefer operation IDs over URL paths. |
| 150 | |
| 151 | **Defaults:** localhost:8080, admin/admin (auto-detected). Override with `--api-url`, `--username`, `--password`. |
| 152 | |
| 153 | ### Discovery |
| 154 | |
| 155 | ```bash |
| 156 | # List all endpoints |
| 157 | astro api airflow ls |
| 158 | |
| 159 | # Filter by keyword |
| 160 | astro api airflow ls dags |
| 161 | astro api airflow ls task |
| 162 | |
| 163 | # Show params and schema for an operation |
| 164 | astro api airflow describe get_dag |
| 165 | ``` |
| 166 | |
| 167 | ### Key Flags |
| 168 | |
| 169 | | Flag | Purpose | |
| 170 | |------|---------| |
| 171 | | `-p key=value` | Path parameters | |
| 172 | | `-F key=value` | Body/query fields (auto-converts booleans/numbers) | |
| 173 | | `-q` / `--jq` | jq filter on response | |
| 174 | | `--paginate` | Fetch all pages | |
| 175 | | `-X` / `--method` | Override HTTP method | |
| 176 | | `--generate` | Output curl command instead of executing | |
| 177 | |
| 178 | ### DAGs |
| 179 | |
| 180 | ```bash |
| 181 | # List all DAGs |
| 182 | astro api airflow get_dags |
| 183 | |
| 184 | # Filter by pattern (SQL LIKE — use % wildcards) |
| 185 | astro api airflow get_dags -F dag_id_pattern=%etl% |
| 186 | |
| 187 | # Get a specific DAG |
| 188 | astro api airflow get_dag -p dag_id=my_dag |
| 189 | |
| 190 | # Get full details (schedule, params, etc.) |
| 191 | astro api airflow get_dag_details -p dag_id=my_dag |
| 192 | |
| 193 | # Pause / unpause |
| 194 | astro api airflow patch_dag -p dag_id=my_dag -F is_paused=true |
| 195 | astro api airflow patch_dag -p dag_id=my_dag -F i |