For a hands-on demo of using AI agents in local data engineering, watch the recording of the Local data engineering in the agentic era webinar.
Assumed knowledge
To get the most out of this guide, you should have:- An Astro project on your computer. See Run Airflow locally.
Dev containers
A dev container runs your editor’s tooling (language servers, linters, debuggers) inside the same container as your code. There are two ways to get one: attach your editor to the scheduler container thatastro dev start is already running, or define the container declaratively in a devcontainer.json file that builds from your project’s Dockerfile.
A dev container gives your editor:
- Autocomplete and type checking against the exact classes and provider packages installed in your Airflow project.
- Warnings for deprecated or unused imports before you run the Dag.
- Breakpoints and step-through debugging.
VS Code
The Dev Containers extension can attach to a container that’s already running.- Start Airflow with
astro dev start. - Open the command palette (Shift+Cmd+P on macOS, Shift+Ctrl+P on Windows/Linux) and run Dev Containers: Attach to Running Container. Select
<project>-scheduler-1. - In the new window, open
/usr/local/airflow. - Install the Python extension inside the container. To skip this step on future attaches, set
dev.containers.defaultExtensionsin your VS Code settings.
devcontainer.json file. This is useful for sharing one VS Code setup across a team and builds a single container from your project’s Dockerfile that you and your AI agent can use for editing, type checking, and dag.test(). Because the dev container doesn’t start all five containers from astro dev start, the following example uses a dedicated, disposable SQLite metadata database for any functionality that requires database interaction.
-
In your Astro project, create a
.devcontainerfolder with adevcontainer.jsonfile: - Open the command palette and run Dev Containers: Reopen in Container.
extensions list decides which tooling your agent can see. For example, ms-python.vscode-pylance adds type checking and import resolution. See the VS Code Extension Marketplace for more information.
PyCharm
The PyCharm Dev Containers feature can use the same.devcontainer/devcontainer.json file from the preceding VS Code section.
-
Connect PyCharm to Docker: open Settings, go to Build, Execution, Deployment > Docker, click
+, and connect to your Docker daemon. -
Add a new folder called exactly
.devcontainerto your Airflow project’s root and create adevcontainer.jsonfile in it, with the same contents as in the preceding VS Code section. Open the file. -
Click the Dev Container icon in the editor’s left gutter, next to the file’s first line, and select Create Dev Container and Mount Sources…, then choose your backend IDE.
If the icon doesn’t appear, restart PyCharm. It might not detect adevcontainer.jsonfile created while the project was already open. - Watch the build progress in the Services tool window (View > Tool Windows > Services), then click Open Project after it finishes.
Debug with dag.test()
dag.test() runs every task in a Dag inside a single Python process, without requiring a running Airflow environment. Because it runs as regular Python code, you can set breakpoints and step through task logic with your IDE’s debugger.
For more information, see Debug interactively with dag.test().