Skip to main content

Module 2: Setting Up Your Development Environment

Setting Up Your Development Environment (Light) Setting Up Your Development Environment (Dark)

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.lock file ensuring that every developer gets the exact same package versions.
  • Python Version Management: uv can 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: Instant 1-Click Cloud Environments (Browser)โ€‹

If you don't want to install Docker, Python, or tools on your computer, launch a ready-to-code workspace directly in your browser:

Open in GitHub CodespacesOpen in Google Cloud Shell
  • GitHub Codespaces: Launches a full VS Code browser IDE pre-configured with Python 3.11, uv, gcloud, and all course dependencies.
  • Google Cloud Shell: Clones the repository directly into your Google Cloud web shell, launches the Cloud Shell Editor, and opens the interactive Project Selector Walkthrough panel (tutorial.md).

[!WARNING] Cloud Shell Account & Project Isolation Guardrail: When opening Google Cloud Shell, it immediately attaches to whichever Google account and default GCP project is currently active in your browser. Before running any deployment or provisioning commands, always verify and set your dedicated sandbox/training project:

# 1. Verify your active identity
gcloud auth list

# 2. Check the currently selected project
gcloud config get-value project

# 3. Explicitly switch to your dedicated sandbox project
gcloud config set project <YOUR_TRAINING_PROJECT_ID>

๐Ÿณ 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:

  1. Prerequisites:
    • Install and start Docker Desktop.
    • Install VS Code.
    • Install the official Dev Containers extension in VS Code (search for ms-vscode-remote.remote-containers in the Extensions tab).
  2. 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 .
  3. 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 (or Cmd+Shift+P / Ctrl+Shift+P), type Dev Containers: Reopen in Container, and press Enter.
  4. 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):

  1. Install uv using 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"
  2. Verify installation: uv --version
  3. Initialize your project with Python 3.10+: uv init adk-training --python 3.10

๐Ÿค– Elevating Your Toolchain: Google Agents CLI (agents-cli)โ€‹

Google provides agents-cli (google-agents-cli), the official toolset designed to accelerate the complete agent development lifecycle:

# 1. Install agents-cli and register agent skills into your AI coding assistants
uvx google-agents-cli setup

What agents-cli setup does:

  • Installs the agents-cli global command-line utility.
  • Automatically configures ADK Agent Skills for your AI coding assistants (such as Antigravity, Claude Code, Cursor, and Gemini CLI).
  • Ensures your IDE understands ADK 2.0 object patterns, evaluation schemas, and deployment targets.

Pedagogical Note โ€” "De-Magic First, Accelerate Second":
In the first half of this course (Modules 01โ€“23), we will write pure Python code to master the internal mechanics of nodes, state, routing, and tools. In the second half (Modules 24โ€“36), we will leverage agents-cli to automate project scaffolding, evaluation flywheels, Cloud Run/GKE packaging, and Gemini Enterprise registry publication!

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.

The quickest way to get started is by using an API key from Google AI Studio.

  1. Get an API Key: Visit Google AI Studio.
  2. Set an Environment Variable: Provide this key through an environment variable named GOOGLE_API_KEY, typically stored in a .env file.

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.

Development Environment &amp; Authentication Architecture (Light) Development Environment &amp; Authentication Architecture (Dark) Figure 2.1: Modern ADK 2.0 developer environment architecture โ€” from high-speed dependency resolution with uv to credential injection and cloud validation with Gemini 3.5 Flash.

Troubleshooting Common Errorsโ€‹

1. ๐Ÿ›‘ 404: Model 'gemini-3.8-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-central1
  • us-east4
  • europe-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 .).

๐ŸŽฏ Knowledge CheckSelect Best Answer

When configuring an enterprise ADK 2.0 agent with Google Cloud Application Default Credentials (ADC), which environment variable routes calls to Vertex AI instead of Google AI Studio?

Key Takeawaysโ€‹

  • Python 3.10+ and google.adk >= 2.1.0 are strictly required.
  • uv is the recommended tool for managing Python projects and environments.
  • Use a .env file to manage your API key or project settings securely.
๐Ÿ“–

02: Environment Setup(Theory & Overview)

Part 1: Foundations โ€ข Module 02

Overall Course Progress:
0%(0/98)
Next Step: Challenge Lab ๐Ÿงช โ†’