Module 2: Setting Up Your Development Environment
Theoryโ
The Importance of a Clean Environmentโ
Before diving into building agents, it's crucial to set up a proper development environment. A well-structured environment ensures that your project's dependencies are isolated, preventing conflicts with other Python projects on your system. It makes your project self-contained and easily reproducible by others.
Python 3.10+ and ADK 2.0 Requirementsโ
The ADK uses modern Python features like advanced type hints and improved asynchronous handling.
- Python Requirement: Strictly 3.10 or higher.
- ADK Requirement: This course is built for google.adk >= 2.1.0, which introduces the Workflow Graph Runtime. Older versions (1.x) are not compatible with the advanced orchestration patterns taught in this course.
Enter uv: The Modern Standardโ
Enterprise agent development has moved to uv.
uv is an extremely fast Python package and project manager written in Rust. It replaces pip, venv, and other tools with a single, unified interface that is orders of magnitude faster.
Key Benefits of uv:
- Speed: It resolves dependencies and installs packages in a fraction of the time.
- Deterministic Builds: It automatically manages a
uv.lockfile ensuring that every developer gets the exact same package versions. - Python Version Management:
uvcan automatically download and use the correct Python version if you specify it during initialization (e.g.,uv init --python 3.10).
Development Workflow Options: Choose Your Pathโ
You can complete this training course using any of the following approaches depending on your preference:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ CHOOSE YOUR WORKFLOW โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโค
โ Path 1: Codespaces โ Path 2: DevContainer โ Path 3: Local `uv` โ
โ (1-Click in Browser) โ (VS Code + Docker) โ (Terminal / Host OS) โ
โ โญ Recommended for 100% โ โญ Best if you use โ โญ Best for standard โ
โ zero local installation โ Docker locally โ local development โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโ
๐ Path 1: GitHub Codespaces (1-Click Browser Environment)โ
If you don't want to install Docker, Python, or tools on your computer, you can run the entire course directly in your browser:
- Open the GitHub repository in your browser:
https://github.com/mauripsale/doc-adk-training. - Click the green
<> Codebutton near the top right. - Switch to the Codespaces tab.
- Click "Create codespace on main" (or your active branch).
- A full VS Code interface will launch in your browser. It automatically detects the
.devcontainerconfiguration, installs Python 3.11,uv, andgcloud, and gives you a ready-to-use terminal.
๐ณ Path 2: VS Code Dev Containers (Local Docker)โ
A DevContainer (Development Container) packages an entire development environment inside a Docker container. It guarantees that Python 3.11, uv, google-cloud-cli, and all VS Code extensions are configured identically, avoiding "works on my machine" issues.
How to start it step-by-step:
- Prerequisites:
- Install and start Docker Desktop.
- Install VS Code.
- Install the official Dev Containers extension in VS Code (search for
ms-vscode-remote.remote-containersin the Extensions tab).
- Open the Project:
- Clone the repository and open the folder in VS Code:
git clone https://github.com/mauripsale/doc-adk-training.git
cd doc-adk-training
code .
- Clone the repository and open the folder in VS Code:
- Reopen in Container:
- VS Code will show a popup in the bottom right corner: "Folder contains a Dev Container configuration file. Reopen in Container?" โ Click "Reopen in Container".
- (Alternative): Press
F1(orCmd+Shift+P/Ctrl+Shift+P), typeDev Containers: Reopen in Container, and pressEnter.
- Ready! VS Code builds the container in the background (1โ2 minutes the first time). Once finished, the bottom-left corner of VS Code will show
Dev Container: ADK 2.0 Training Environment. Any terminal you open (Ctrl+\``) is already inside Linux with Python 3.11,uv`, and the Google Cloud CLI ready to use.
๐ป Path 3: Standard Local Setup (uv CLI on Host OS)โ
If you prefer to work directly on your host operating system (macOS, Linux, or Windows):
- Install
uvusing the official installer:- macOS / Linux:
curl -LsSf https://astral.sh/uv/install.sh | sh - Windows (PowerShell):
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
- macOS / Linux:
- Verify installation:
uv --version - Initialize your project with Python 3.10+:
uv init adk-training --python 3.10
Authentication: Connecting to Google Servicesโ
To use the ADK, your agent needs to communicate with Google's services. There are two primary ways to authenticate.
Option A: API Key (Recommended for Beginners)โ
The quickest way to get started is by using an API key from Google AI Studio.
- Get an API Key: Visit Google AI Studio.
- Set an Environment Variable: Provide this key through an environment variable named
GOOGLE_API_KEY, typically stored in a.envfile.
Option B: Google Cloud Authentication (Enterprise)โ
For production, use Application Default Credentials (ADC) via the Google Cloud CLI (gcloud).
gcloud auth application-default login
gcloud config set project YOUR_PROJECT_ID
The ADK automatically detects these credentials.
Troubleshooting Common Errorsโ
1. ๐ 404: Model 'gemini-3.5-flash' not foundโ
This error usually occurs when the model has not yet been deployed to your specific Google Cloud location.
The Fix:
Change your GOOGLE_CLOUD_LOCATION (or LOCATION in .env) to one of the following high-availability regions:
us-central1us-east4europe-west9
2. ๐ PermissionDenied: 403โ
Your user or service account does not have the "Agent Platform User" role.
The Fix: Go to IAM in the Cloud Console and grant your account the roles/aiplatform.user role.
3. ๐ ModuleNotFoundError: No module named 'google'โ
This happens if you are not running the command inside the virtual environment.
The Fix: Always prefix your commands with uv run (e.g., uv run adk web .).
Key Takeawaysโ
- Python 3.10+ and google.adk >= 2.1.0 are strictly required.
uvis the recommended tool for managing Python projects and environments.- Use a
.envfile to manage your API key or project settings securely.