Skip to content

Latest commit

Β 

History

16 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Google ADK Engineering Lab

Python Google ADK Gemini Vertex AI Status

A hands-on engineering lab for exploring the Google Agent Development Kit (ADK). Each experiment investigates how ADK works internally through documentation, source code analysis, runtime verification, and database inspection, with every finding backed by practical experimentation.


Why this repository?

Most Google ADK examples demonstrate how to build an agent.

This repository focuses on understanding how Google ADK works internally.

Each experiment follows the same engineering methodology:

  • Read the official documentation
  • Explore the ADK source code
  • Build a runnable example
  • Verify runtime behavior
  • Inspect the SQLite database (where applicable)
  • Document only verified findings

The objective is to build a deep understanding of AI agent runtime architecture rather than simply producing working examples.


What You'll Learn

This repository explores:

  • Runtime Bootstrapping
  • Session Management
  • Persistent Conversation Memory
  • Conversation State
  • Event Lifecycle
  • Context Management
  • Event Compaction
  • Token Optimization
  • Streaming Responses
  • Model Context Protocol (MCP)
  • Semantic Routing
  • Agent Delegation
  • Invocation Lifecycle
  • Coordinator Agent Architecture

Future Explorations

  • Long-Term Memory
  • Retrieval-Augmented Generation (RAG)
  • Production Deployment Patterns

Technologies

  • Python 3.14
  • Google Agent Development Kit (ADK)
  • Google Gemini 2.5 Flash
  • Vertex AI
  • Google Cloud Platform
  • SQLite
  • Model Context Protocol (MCP)
  • Google Maps MCP Server
  • AgentTool

Repository Goals

The objective of this repository is to:

  • Explore Google ADK concepts through practical implementation
  • Understand the runtime architecture behind ADK
  • Document observations from each experiment
  • Evaluate production-oriented design patterns
  • Build reusable runtime components
  • Serve as a reference for future ADK projects

Current Progress

βœ… Completed

  • Custom Runtime Launcher
  • Runtime Bootstrapping
  • Runner
  • Session Management
  • In-Memory Session Service
  • Persistent Session Management
  • Conversation Memory
  • Environment Configuration
  • Event Lifecycle
  • Context Reconstruction
  • Event Compaction
  • Context Management
  • Token Optimization
  • Google Maps MCP Integration
  • Multi-Agent Coordination using AgentTool
  • Google Maps MCP Tool Integration
  • Coordinator Agent
  • Semantic Routing

🚧 Next Experiment

  • Streaming Responses

Current Focus: Investigating how Google ADK implements streaming responses, emits Partial Events, reconstructs final Events, and manages the complete streaming execution lifecycle.


Experiment Roadmap

Experiment Status
βœ… Experiment 01 – Building a Custom ADK Runtime Completed
βœ… Experiment 02 – Implementing Persistent Session Management Completed
βœ… Experiment 03 – Understanding Conversation State Completed
βœ… Experiment 04 – Understanding Event Lifecycle Completed
βœ… Experiment 05 – Context Management & Token Optimization Completed
🚧 Experiment 06 – Streaming Responses In Progress
βœ… Experiment 07 – Google Maps MCP Integration Completed
βœ… Experiment 08 – Multi-Agent Coordination using AgentTool Completed

Engineering Principles

The implementation in this repository follows these principles:

  • Single Responsibility Principle (SRP)
  • Separation of Concerns
  • Modular Runtime Design
  • Reusable Components
  • Production-Oriented Architecture
  • Incremental Experimentation

Verification Philosophy

Every conclusion in this repository is based on evidence rather than assumptions.

Whenever possible, findings are verified through:

  • Official Google ADK documentation
  • ADK source code analysis
  • Runtime experiments
  • SQLite database inspection

Only verified observations are documented.

Each experiment validates findings by comparing runtime behavior with the Google ADK source code to ensure conclusions accurately reflect the framework's implementation.


Runtime Architecture

The following diagram illustrates the high-level runtime architecture used throughout the experiments.

                 User
                  β”‚
                  β–Ό
         python -m launcher.run
                  β”‚
                  β–Ό
            bootstrap.py
                  β”‚
      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
      β–Ό           β–Ό            β–Ό
   env.py     session.py    runner.py
      β”‚           β–²            β”‚
      β–Ό           β”‚            β–Ό
Vertex AI Config  β”‚     Runner Execution
                  β”‚            β”‚
                  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                       β”‚
                       β–Ό
              DatabaseSessionService
                       β”‚
                       β–Ό
                 SQLite Database
                       β”‚
                       β–Ό
                  Session Events
                       β”‚
                       β–Ό
          Context Reconstruction
                       β”‚
                       β–Ό
             Event Compaction (Optional)
                       β”‚
                       β–Ό
                Coordinator Agent
                        β”‚
                        β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                        β–Ό              β–Ό
                  Conversation     Google Maps
                  Context Agent     MCP Agent
                        β”‚              β”‚
                        β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜
                               β–Ό
                           Gemini Model
                               β”‚
                               β–Ό
                          Final Response

Project Structure

.
β”‚
β”œβ”€β”€ launcher/
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ console.py
β”‚   └── run.py
β”‚
β”œβ”€β”€ runtime/
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ bootstrap.py
β”‚   β”œβ”€β”€ config.py
β”‚   β”œβ”€β”€ context.py
β”‚   β”œβ”€β”€ env.py
β”‚   β”œβ”€β”€ logger.py
β”‚   β”œβ”€β”€ runner.py
β”‚   └── session.py
β”‚
β”œβ”€β”€ experiments/
β”‚   β”œβ”€β”€ Experiment-01-Building-a-Custom-ADK-Launcher.md
β”‚   β”œβ”€β”€ Experiment-02-Implementing-Persistent-Session-Management.md
β”‚   β”œβ”€β”€ Experiment-03-Understanding-Conversation-State.md
β”‚   β”œβ”€β”€ Experiment-04-Understanding-Event-Lifecycle.md
β”‚   β”œβ”€β”€ Experiment-05-Context-Management-and-Token-Optimization.md
β”‚   β”œβ”€β”€ Experiment-05–Runtime-Verification-of-Event-Compaction.md
β”‚   β”œβ”€β”€ Experiment-07-Google-Maps-MCP-Integration.md
β”‚   └── Experiment-08-Multi-Agent-Coordination-using-AgentTool.md
β”‚
β”œβ”€β”€ data/
β”‚
β”œβ”€β”€ multi_tool_agent/
β”‚   β”œβ”€β”€ __init__.py
β”‚   └── agent.py
β”‚
β”œβ”€β”€ common/
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ agent.py
β”‚   └── coordinator/
β”‚       β”œβ”€β”€ __init__.py
β”‚       └── agent.py
β”‚
β”œβ”€β”€ context_agent/
β”‚   β”œβ”€β”€ __init__.py
β”‚   └── agent.py
β”‚
β”œβ”€β”€ mcp_integration/
β”‚   β”œβ”€β”€ __init__.py
β”‚   └── agent.py
β”‚
β”œβ”€β”€ .env.example
β”œβ”€β”€ .gitignore
β”œβ”€β”€ requirements.txt
└── README.md

Getting Started

Clone the Repository

git clone https://github.com/a1108/google-adk-experiments.git
cd google-adk-experiments

Create a Virtual Environment

python -m venv .venv

Activate the Virtual Environment

macOS / Linux

source .venv/bin/activate

Windows

.venv\Scripts\activate

Install Dependencies

pip install -r requirements.txt

Configure Environment Variables

Copy .env.example to .env and update the required values.

Example:

GOOGLE_GENAI_USE_VERTEXAI=TRUE
GOOGLE_CLOUD_PROJECT=<your-project-id>
GOOGLE_CLOUD_LOCATION=us-central1

Running the Application

Launch the custom runtime:

Custom Runtime

python -m launcher.run

ADK Web

adk web

The custom runtime automatically:

  • Loads environment variables
  • Initializes the session service
  • Loads or creates a conversation session
  • Creates the ADK Runner
  • Starts the interactive console

Experiment Index

Each experiment builds upon previous work and explores one architectural concept in Google ADK.

Every experiment documents:

  • Objective
  • Research Questions
  • Runtime Verification
  • Architecture / Runtime Flow
  • Findings
  • Verification Checklist
  • References
Experiment Status
Experiment 01 – Building a Custom ADK Runtime βœ…
Experiment 02 – Persistent Session Management βœ…
Experiment 03 – Understanding Conversation State βœ…
Experiment 04 – Understanding Event Lifecycle βœ…
Experiment 05 – Context Management & Token Optimization βœ…
Experiment 06 – Streaming Responses 🚧
Experiment 07 – Google Maps MCP Integration βœ…
Experiment 08 – Multi-Agent Coordination using AgentTool βœ…

Experiment Methodology

Every concept in this repository follows the same engineering process.

Read Documentation
        β”‚
        β–Ό
Explore Source Code
        β”‚
        β–Ό
Build Experiment
        β”‚
        β–Ό
Run & Verify
        β”‚
        β–Ό
Inspect Runtime
        β”‚
        β–Ό
Document Findings

The focus is on understanding the underlying architecture rather than simply building a working example.


Repository Highlights

βœ” Built a custom Google ADK runtime

βœ” Explored ADK runtime architecture through engineering experiments

βœ” Implemented persistent conversation memory

βœ” Investigated Event Lifecycle, Context Reconstruction, Event Compaction and Token Optimization

βœ” Built a Google Maps MCP specialist agent

βœ” Implemented a Coordinator Agent using AgentTool

βœ” Verified semantic routing using ADK Trace

βœ” Investigated Invocation lifecycle during delegated agent execution

βœ” Structured the repository as an engineering lab instead of isolated examples


References

  • Google Agent Development Kit (ADK) Documentation
  • Google ADK GitHub Repository
  • Google Gemini Documentation
  • Vertex AI Documentation
  • Model Context Protocol Specification

What's Next?

Upcoming experiments will explore:

  • Streaming Responses
  • Long-Term Memory
  • Retrieval-Augmented Generation (RAG)
  • Production Deployment Patterns
  • Advanced Multi-Agent Workflows

License

This repository is intended for educational purposes, experimentation, and knowledge sharing.

Feel free to explore the code, learn from the experiments, and adapt the ideas for your own projects.

About

Hands-on experiments exploring Google Agent Development Kit (ADK), runtime architecture, MCP, multi-agent systems, and production-ready AI agent development.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages