Sitemap
Google Cloud - Community

A collection of technical articles and blogs published or curated by Google Cloud Developer Advocates. The views expressed are those of the authors and don't necessarily reflect those of Google.

Follow publication

Practical AI Agent Development Using ADK

--

We’ve all seen what large language models can do: answer questions, summarize docs, even write code. But when it comes to building real assistants that do things, we quickly hit a wall. We want something that can reason, act, and use tools, not just generate paragraphs.

This is where Google’s Agent Development Kit (ADK) steps in.

img src: https://google.github.io/

ADK lets us build AI agents that aren’t just conversational but they’re capable. Agents that can plan, invoke tools, and follow instructions with real structure, not just smart guessing. And the best part? We can go from a simple script to a multi-tool agent in under 100 lines of Python.

Whether you’re an engineer exploring agents for the first time, or someone looking to move beyond the chatbot hype, this could be a good place to start.

In this article, we’ll explore how to build a simple Book Recommendation Agent using ADK, demonstrating its flexibility and ease of use.

What is ADK?

Agent Development Kit (ADK) is a flexible and modular framework for developing and deploying AI agents. ADK was designed to make agent development feel more like software development, to make it easier for developers to create, deploy, and orchestrate agentic architectures that range from simple tasks to complex workflows.

With ADK, it becomes much easier for spinning up basic agent and run it locally in browser-based dev UI with feature of debugging. It provides a framework for building agents that:

  • Handle natural language input
  • Use tools (functions) to retrieve or generate structured data
  • Respond conversationally using foundation models
  • Run locally or be deployed via Vertex AI Agent Engine

ADK reduces the need of boilerplate and allow developers to build production-grade agents using a declarative structure.

Sample Use Case: A Book Recommender Assistant

Let’s build an agent that recommends books based on a user’s preferences, specifically genre and mood. The agent will call a Python function (recommend_book) containing the core logic.

Here’s the complete agent definition:

from google.adk.agents import Agent

def recommend_book(preferences: dict) -> dict:
"""Recommends a book based on user preferences.

Args:
preferences (dict): A dictionary with keys like 'genre' and 'mood'.

Returns:
dict: A dictionary with 'status' and either a 'recommendation' or an 'error_message'.
"""
genre = preferences.get("genre", "").lower()
mood = preferences.get("mood", "").lower()

# Simple hardcoded logic (can be replaced with LLM or API calls)
if genre == "science fiction" and "adventurous" in mood:
return {
"status": "success",
"recommendation": "I recommend *Project Hail Mary* by Andy Weir — it's an inventive, science-heavy adventure with emotional depth."
}
elif genre == "fantasy" and "escape" in mood:
return {
"status": "success",
"recommendation": "Try *The Name of the Wind* by Patrick Rothfuss — an immersive fantasy with lyrical prose and a compelling underdog hero."
}
elif genre == "mystery":
return {
"status": "success",
"recommendation": "You might enjoy *The Girl with the Dragon Tattoo* by Stieg Larsson — a gripping, gritty thriller full of twists."
}
else:
return {
"status": "error",
"error_message": "Sorry, I couldn't find a recommendation for those preferences."
}

root_agent = Agent(
name="book_recommender_agent",
model="gemini-2.0-flash",
description="Agent that recommends books based on your preferences.",
instruction="Ask me for a book recommendation based on genre and mood.",
tools=[recommend_book]
)

Running the Agent Using the ADK Console

First of all, we need to install google-adk python library and after defining the agent, we can run it using the adk web command, which launches a local web-based playground for interacting with your agent. We need to have __init__.py file in the root with imports:

from . import agent
adk web cli

In the screenshot below which is loaded on http://0.0.0.0:8000on browser, we can see a conversation with the agent:

adk browser based interactive UI
  • The user asks for a movie recommendation.
  • The agent informs it only handles book recommendations.
  • The user provides the genre and mood.
  • The agent invokes the recommend_book function and returns a relevant recommendation.

This interface is useful for testing agent logic, reviewing tool invocations, and refining instructions before deployment.

In the ADK Context

The line model="gemini-2.0-flash” in the Agent constructor specifies which large language model to use for reasoning, conversation flow, and planning.

In this case, gemini-2.0-flash is a lightweight, latency-optimized model ideal for tool-using agents. It’s fast, affordable, and suitable for scenarios where most of the thinking is delegated to tools, but the model still needs to guide the interaction intelligently.

ADK agents leverage the specified model to:

  • Interpret user input
  • Decide which tool to call
  • Summarize or refine tool responses conversationally

We can switch the model to better model if we need longer context or more complex reasoning.

Debugging via Dashboard with Events

By going through event flow, we can easily debug and see how the response is created.

Extending This Agent

This example can be evolved in several directions:

  • Replace the hardcoded tool logic with dynamic responses from other foundation models or APIs.
  • Add support for languages, ratings, or content warnings.
  • Integrate with external systems for real-time data.
  • Deploy it using Vertex AI Agent Engine.

Using Built-In Tool

Want to integrate Google Search for the same project and finish it in less than 20 lines? Here it is:

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

root_agent = Agent(
name="book_recommender",
model="gemini-2.0-flash",
description="Agent that recommends books based on your preferences.",
instruction=(
"Your goal is to recommend a book based on the user's genre and mood preferences.\n"
"1. Ask the user for their preferred genre and mood if they haven't provided them.\n"
"2. Use the `google_search` tool to find a recommendation based on the user's genre and mood.\n"
"4. Present the final recommendation to the user."
),
tools=[google_search]
)

By using built-in tool like google_search , we have our agent ready which interacts over Google Search while still asking for required context before giving result.

Built in google_search tool

The sample agent demonstrates the flexibility and power of Agent Development Kit. Whether you’re building assistants for customer support, content generation, or everyday decision-making, ADK provides a clean and extensible foundation. If you’re looking to build AI that not only understands but also acts, this is a solid place to begin.

--

--

Google Cloud - Community
Google Cloud - Community

Published in Google Cloud - Community

A collection of technical articles and blogs published or curated by Google Cloud Developer Advocates. The views expressed are those of the authors and don't necessarily reflect those of Google.

Raju Dawadi
Raju Dawadi

Responses (2)