Feature Request: Support running dbt commands locally via Astro CLI with Cosmos
- [Y] I have checked that a similar feature request does not already exist.
✍️ Is your feature request related to a problem? Please describe.
Currently, Cosmos only supports running dbt models through Airflow DAGs. Platform users who want to run dbt commands locally must rely on a manual process that involves entering the scheduler container, activating the dbt virtual environment, and running dbt commands with explicit project and profile paths.
To serve dbt docs, additional steps such as modifying docker-compose.override.yml for port mappings are required.
This workflow is not user-friendly, error-prone, and creates friction for users who simply want to run or test dbt locally without involving Airflow.
🧩 Describe the solution you'd like
Enable Cosmos to run dbt commands locally via the Astro CLI, without requiring Airflow or DAGs. Users should be able to execute common dbt commands directly, such as:
dbt docs generate
dbt docs serve
dbt test
This would provide a straightforward developer experience, allowing experimentation, validation, and documentation workflows locally in a Cosmos-managed environment.
🤔 Describe alternatives you've considered
Running manual commands through astro dev bash scheduler and managing dbt environments manually.
Using Docker overrides and port mappings to expose dbt docs locally.
Relying solely on Airflow DAGs for dbt execution.
All of these alternatives add complexity and don’t provide the simplicity or consistency that developers expect.
Added a port mapping to docker-compose.override.yml e.g.:
astro dev bash scheduler source dbt_venv/bin/activate dbt clean --project-dir "$AIRFLOW_HOME/dags/dbt_test/" --profiles-dir “$AIRFLOW_HOME/dags/dbt_test/” dbt docs generate --project-dir "$AIRFLOW_HOME/dags/dbt_test/" --profiles-dir “$AIRFLOW_HOME/dags/dbt_test/” dbt docs serve --project-dir "$AIRFLOW_HOME/dags/dbt_test/" --profiles-dir "$AIRFLOW_HOME/dags/dbt_test/" --port 8085 --host 0.0.0.0 --no-browser
Is your feature request specific to a particular Astronomer Platform?
- [Y] Astro
- [ ] Software
- [ ] None/Unknown
💡 Additional context We’ve tested this by running manual steps inside the Astro scheduler container and were able to get dbt docs and tests working. However, this requires technical knowledge that platform users may not have, and it makes adoption harder. A native CLI feature would significantly improve usability and adoption of Cosmos for both orchestration and local development.
I'm very interested in the outcome of this request. It'd be great to have an easy way to run dbt docs, test, etc via Astro dev.