Skip to main content

Command Palette

Search for a command to run...

Engineer AI Agents with ADK – Challenge Lab (GSP540) Complete Guide

Updated
5 min read

Engineer AI Agents with Agent Development Kit (ADK) – Challenge Lab (GSP540)

https://miro.medium.com/v2/resize%3Afit%3A1200/0%2A5ufZKhefwoawy-ol.png https://docs.cloud.google.com/static/architecture/images/multiagent-ai-system-architecture.svg https://miro.medium.com/v2/resize%3Afit%3A1400/1%2Av9TQrcYF3RGRZF_pUewnjA.png

This Google Cloud Challenge Lab tests your ability to repair, configure, and run AI agents using the Agent Development Kit (ADK). Instead of following instructions, you apply skills learned in previous labs.

The lab simulates a travel company AI system where agents gather travel data, validate information, and correct marketing content.


1. Lab Objective 🎯

The main objective of this lab is to build and repair AI agents that perform automated tasks using ADK.

Core Goals

  1. Initialize an AI agent with external tools

    • Enable Google Search tool for the Travel Scout agent.
  2. Implement structured data output

    • Enforce strict JSON schema using Pydantic.
  3. Build a multi-agent workflow

    • Combine agents sequentially (Critic → Reviser).
  4. Run agents through multiple interfaces

    • Web UI

    • CLI

    • Python execution


2. Learning Outcomes 📘

After completing the lab, you will learn:

Skill Description
AI Agent Development Creating agents using ADK
Tool Integration Connecting agents with Google Search
Structured Output Enforcing JSON schemas
Multi-Agent Pipelines Agents collaborating sequentially
Agent Testing Running agents via CLI and Web UI
LLM Fact-Checking Detecting and correcting misinformation

3. Lab Architecture

https://miro.medium.com/v2/resize%3Afit%3A1060/1%2A2bWDr2tezIfg6NTbD19N4g.png https://codelabs.developers.google.com/static/codelabs/production-ready-ai-with-gc/3-developing-agents/img/adk_film_concept_team.png https://anadea.info/blog/how-to-build-ai-travel-agent/2-4-_hu06cfdf42baecc600ba0d1397ff5781a8_242134_0x0_q75_h2__3.webp

The system contains three agents working together.

Travel Scout

Searches the internet for travel information.

Destination Verifier

Returns structured geographic data.

Brochure Auditor

Checks and corrects marketing claims.

Flow of data:

User Query
   ↓
Travel Scout (Google Search)
   ↓
Geo Validator (Structured JSON)
   ↓
Brochure Auditor
   ├─ Critic Agent
   └─ Reviser Agent
   ↓
Corrected Information

4. Lab Practical Implementation


Task 1 — Install ADK

Step 1 Open Cloud Shell

Install ADK

export PATH=\(PATH:"/home/\){USER}/.local/bin"

python3 -m pip install google-adk

Authenticate Google Cloud

gcloud auth application-default login

Step 2 Download Lab Files

gcloud storage cp gs://qwiklabs-gcp-01-66819293da80-bucket/adk_project.zip .
unzip adk_project.zip
cd adk_project
pip install -r requirements.txt

Task 2 — Configure Travel Scout Agent

https://serpapi.com/blog/content/images/2025/02/image-82.png https://dz2cdn1.dzone.com/storage/temp/18312913-1743380519116.png https://www.researchgate.net/publication/381190070/figure/fig1/AS%3A11431281249750952%401717650790725/General-workflow-of-AI-agent-Typically-an-AI-agent-consists-of-three-components.png

Purpose

Enable the agent to search real-time travel events.


Create .env

Inside

my_google_search_agent

Create .env

GOOGLE_GENAI_USE_VERTEXAI=true
GOOGLE_CLOUD_PROJECT=PROJECT_ID
GOOGLE_CLOUD_LOCATION=global
MODEL=gemini-2.5-flash

Modify agent.py

Add Google Search tool.

from google.adk.agents import Agent
from google.adk.tools.google_search import google_search

agent = Agent(
    name="travel_scout",
    model="gemini-2.5-flash",
    tools=[google_search],
)

Run Web UI

cd ~/adk_project
adk web

Open:

http://127.0.0.1:8000

Ask:

What are major events in Tokyo in 2025?

The agent should perform real Google Search grounding.


Task 3 — Run Agent via CLI

Run agent directly:

adk run my_google_search_agent

Ask:

What is Japan currency exchange rate?

Task 4 — Enforce Structured Output

https://docs.spring.io/spring-ai/reference/_images/structured-output-architecture.jpg https://media2.dev.to/dynamic/image/width%3D800%2Cheight%3D%2Cfit%3Dscale-down%2Cgravity%3Dauto%2Cformat%3Dauto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fca73lor4ztlhgqgi6a73.png https://miro.medium.com/v2/resize%3Afit%3A1400/1%2AQI6mefN3V17AFChSoliGTg.png

Problem

Agent returns plain text.

Example:

The capital of France is Paris

But the booking system requires JSON format.


Create Schema

Edit geo_validator/agent.py

from pydantic import BaseModel

class CountryCapital(BaseModel):
    capital: str

Configure Agent

agent = Agent(
    name="geo_validator",
    model="gemini-2.5-flash",
    output_schema=CountryCapital,
    disallow_transfer_to_parent=True,
    disallow_transfer_to_peers=True
)

Run Agent

python3 geo_validator/agent.py

Output should be:

{
 "capital": "Paris"
}

Task 5 — Fix Brochure Auditor Pipeline

https://miro.medium.com/v2/resize%3Afit%3A2000/1%2AzdC2OcniC3JoRIWp669e-w.png https://miro.medium.com/v2/resize%3Afit%3A1400/1%2ABl8djbNq5DT1qOb1H8KpVA.png https://miro.medium.com/v2/resize%3Afit%3A1200/1%2A2eDMUUbuMEHxEENkWSRuaA.png

4

Problem

The Reviser agent was disabled.

Pipeline currently:

Critic → STOP

Correct pipeline:

Critic → Reviser

Edit agent.py

Uncomment import:

from reviser_agent import reviser_agent

Add reviser to pipeline.

agent = Agent(
    name="llm_auditor",
    sub_agents=[
        critic_agent,
        reviser_agent
    ]
)

Test in Web UI

Start server:

adk web

Ask:

Double check this: You can take a direct train from Hawaii to Japan

Expected result:

1️⃣ Critic → identifies claim false

2️⃣ Reviser → corrects claim

Correct output example:

There is no train from Hawaii to Japan because Hawaii is an island. Travel between them requires air or sea transportation.

5. Key Concepts Learned

AI Agent

A program that uses LLMs to perform tasks automatically.

Example:

Search information
Analyze data
Generate answers

Tools in Agents

Agents can interact with external services.

Examples:

  • Google Search

  • APIs

  • Databases


Grounding

Grounding means using real-time data instead of only LLM knowledge.

Example:

Gemini + Google Search

Multi-Agent System

Multiple agents collaborate.

Example:

Critic Agent → detects errors
Reviser Agent → fixes errors

6. Real-World Use Cases 🌍

This architecture is used in:

Travel companies

Financial fraud detection

Medical AI assistants

Customer service automation

Content verification systems


Final Result

You successfully built:

Agent Function
Travel Scout Searches travel information
Geo Validator Returns structured geographic data
Brochure Auditor Detects and fixes incorrect claims