BUILD · 5 MIN READ

Build with Google’s Agent Development Kit

Define a root agent and a Python function tool, then run it with ADK.

Where it fits

Google ADK provides agent definitions, function tools, and application workflow building blocks. An agent project exposes a root_agent that the development runner can load.

Prepare the project

Install google-adk. Create sample_agent/__init__.py containing from . import agent, and save the example as sample_agent/agent.py. Set GOOGLE_API_KEY and GOOGLE_MODEL to an available Gemini model. Run adk run sample_agent from the parent directory.

Shell · install in a virtual environment
pip install google-adk
Python · sample_agent/agent.py
import os
from google.adk.agents.llm_agent import Agent

def lookup_order(order_id: str) -> str:
    """Read an order status from a local demonstration fixture."""
    orders = {"A104": "Packed; awaiting courier pickup"}
    return orders.get(order_id, "Order not found")

root_agent = Agent(
    name="order_assistant",
    model=os.environ["GOOGLE_MODEL"],
    description="Answers status questions using sample order data.",
    instruction=(
        "Use lookup_order for order status. "
        "Report only the returned information."
    ),
    tools=[lookup_order],
)

Educational example. Uses your configured environment and credentials; no paid model call is made by this website.

Try the task

Ask “What is the status of A104?” The tool returns sample data. Inspect whether the answer reflects that result, then ask about an unknown order and check that the agent does not invent a status.

Keep state and tools distinct

As the application grows, decide which information belongs to the current session and which should persist across sessions. The tool service must enforce access independently of the agent’s instructions.

Keep exploring

A voice agent with Google Gemini LiveA layered architecture for agent memory