Agent Development Kit (ADK) Samples

repository·main·Indexed 27 days ago

https://github.com/google/adk-samples

A collection of runnable agent recipes and patterns using the Agent Development Kit (ADK). Includes implementations for an Ambient Expense Agent with Human-in-the-Loop (HITL) workflows, a Memory Bank sample for cross-session memory, and a Deep Search agent utilizing a multi-agent architecture (planner, researcher, critic, and composer). Provides instructions for local development with Google AI Studio or Vertex AI, and deployment options for Agent Runtime and Cloud Run.

Tokens
38K
Snippets
88
Records
231
Agent score
95%

What's inside adk-samples

  1. Overview of ADK Core Recipes

    main
    The core/ directory contains canonical, machine-readable Agent Development Kit (ADK) patterns. These recipes are designed as small, focused building blocks for fundamental agent capabilities, such as OAuth flows, session memory, guardrails, and Retrieval-Augmented Generation (RAG). They are intended to be consumed and composed by tooling (like agents-cli or Antigravity CLI) or used by developers to build larger, more complex agents.
  2. Overview of adk-samples

    main
    adk-samples is a curated collection of runnable Agent Development Kit (ADK) agent examples. Each example is referred to as a recipe. A recipe is a focused, self-contained agent located under the contrib/ directory that demonstrates a specific, concrete ADK pattern.
  3. Explore ADK Recipes

    main

    The adk-samples repository contains a collection of small, runnable agents designed to demonstrate how to solve real-world problems using the Agent Development Kit (ADK). You can use these recipes as a starting point for your own projects or to learn specific agentic patterns.

    Recipes are organized into two main categories:

    • core/: Canonical patterns curated by the agents-cli team. These are small, focused recipes covering topics like OAuth flows, session memory, guardrails, and RAG patterns.
    • contrib/: Community-contributed recipes that are broader in scope and serve as self-contained examples for specific use cases or industry workflows.

    Each recipe directory contains its own README.md with specific setup and execution instructions.

  4. Explore the Kotlin Samples repository structure

    main

    The Kotlin samples are organized with a central directory containing individual agent implementations. Each agent is self-contained with its own documentation.

    .
    ├── kotlin                      # Contains all the Kotlin sample code
    │   ├── agents                  # Contains individual agent samples
    │   │   ├── agent1              # Specific agent directory
    │   │   │   └── README.md       # Agent-specific instructions
    │   │   ├── agent2
    │   │   │   └── README.md
    │   │   └── ...
    │   └── README.md               # This file (Repository overview)
  5. Repository structure for Go samples

    main

    The Go samples are organized within the go/ directory. Individual agents are located in the agents/ subdirectory, and each agent contains its own README.md with specific setup and execution instructions.

    .
    ├── go                      # Contains all the Go sample code
    │   ├── agents                  # Contains individual agent samples
    │   │   ├── agent1              # Specific agent directory
    │   │   │   └── README.md       # Agent-specific instructions
    │   │   ├── agent2
    │   │   │   └── README.md
    │   │   └── ...
    │   └── README.md               # This file (Repository overview)
  6. Deep Search Agent Technologies Overview

    main

    The Deep Search Agent is built using the following technology stack:

    Backend:

    • Agent Development Kit (ADK): The core framework for building stateful, multi-turn agents.
    • FastAPI: High-performance web framework for the backend API.
    • Google Gemini: Powers planning, reasoning, search query generation, and final synthesis.

    Frontend:

    • React (with Vite): For the interactive user interface.
    • Tailwind CSS: For utility-first styling.
    • Shadcn UI: For accessible UI components.
  7. Understand the TypeScript Samples repository structure

    main

    The TypeScript samples are organized as follows:

    • typescript/: Root directory for all TypeScript sample code.
    • typescript/agents/: Contains individual agent samples. Each subdirectory (e.g., agent1/) contains its own README.md with specific instructions for that agent.
    .
    ├── typescript                  # Contains all the TypeScript sample code
    │   ├── agents                  # Contains individual agent samples
    │   │   ├── agent1              # Specific agent directory
    │   │   │   └── README.md       # Agent-specific instructions
    │   │   ├── agent2
    │   │   │   └── README.md
    │   │   └── ...
    │   └── README.md               # This file (Repository overview)
  8. Quickstart the GenMedia for Commerce Agent

    main

    The GenMedia for Commerce Agent is an orchestrator designed for retail media generation, including Virtual Try-On (VTO) videos and 360° product spins using Veo 3.1 and Gemini.

    Prerequisites

    • Python 3.11+
    • Node.js 20+
    • uv (dependency management)
    • Terraform (infrastructure)
    • Google Cloud SDK (gcloud)

    Setup Steps

    1. Get the Code:
      • Clone the repo: git clone https://github.com/google/adk-samples.git && cd adk-samples/python/agents/genmedia-for-commerce
      • OR use the Google Agents CLI:
        uvx google-agents-cli setup
        agents-cli create genmedia4commerce -a adk@genmedia-for-commerce
        (Select None for deployment when prompted).
    2. Configure Environment:
      cp config.env.example config.env
      Edit config.env to set PROJECT_ID and IMAGE_NAME (e.g., gcr.io/your-gcp-project-id/genmedia-for-commerce).
    3. Install Dependencies:
      make install
    4. Authenticate:
      gcloud auth login
      gcloud auth application-default login
      gcloud config set project your-gcp-project-id
    5. Infrastructure Setup:
      make setup-infra

    Local Development

    Run the backend and frontend development servers using:

    make dev
    # Clone and navigate
    git clone https://github.com/google/adk-samples.git
    cd adk-samples/python/agents/genmedia-for-commerce
    
    # Configure environment
    cp config.env.example config.env
    
    # Install and run
    make install
    make dev
  9. Deploy the ADK agent to Agent Runtime

    main

    Deploy only the ADK agent (conversational interface) to Agent Runtime as a managed service. This is ideal for managed infrastructure and minimal operations. Note that this deployment does not include REST API endpoints (such as VTO or spinning); those require a Cloud Run deployment.

    Deployment Details:

    • Command: make deploy-agent-engine
    • Mechanism: Source code is packaged and uploaded directly (no Dockerfile required).
    • Entrypoint: genmedia4commerce/agent_engine_app.py
    make deploy-agent-engine
  10. Setup the Ambient Expense Agent locally

    main

    To run the Ambient Expense Agent on your local machine, follow these steps:

    1. Clone the repository:

      git clone https://github.com/google/adk-samples.git
      cd adk-samples/python/agents/ambient-expense-agent
    2. Configure authentication: Create a .env file. You can use either Google AI Studio or Google Cloud Vertex AI.

      Option A: Google AI Studio

      echo "GOOGLE_API_KEY=YOUR_AI_STUDIO_API_KEY" >> .env

      Option B: Google Cloud Vertex AI

      echo "GOOGLE_GENAI_USE_VERTEXAI=TRUE" >> .env
      echo "GOOGLE_CLOUD_PROJECT=YOUR_PROJECT_ID" >> .env
      echo "GOOGLE_CLOUD_LOCATION=global" >> .env
      gcloud auth application-default login
    3. Install and run the services: Start the backend in one terminal:

      make install && make dev

      Start the approval UI in a separate terminal:

      make install-frontend && make dev-frontend
    git clone https://github.com/google/adk-samples.git
    cd adk-samples/python/agents/ambient-expense-agent
    
    # For Google AI Studio
    echo "GOOGLE_API_KEY=YOUR_AI_STUDIO_API_KEY" >> .env
    
    # Start services
    make install && make dev
    
    # Start frontend
    make install-frontend && make dev-frontend