Skip to main content
The Human Bit

Build guide · Google ADK · Checked 17 July 2026

Build an agent that looks up office hours.

This first agent has one tool and one job: return a known office closing time. The tool is deliberately fake so you can understand the agent loop before connecting real systems.

Done means: the agent uses the tool for a known office and admits when the office is missing.

1. Create the project

Terminal

python3 -m venv .venv
source .venv/bin/activate
pip install google-adk
adk create office_agent

The generated folder contains the agent code and an environment file for your API key. Never commit that key to GitHub.

2. Add a tool that reads sample hours

Replace the contents of office_agent/agent.py with this example. The hours are invented for this exercise.

Python

from google.adk.agents.llm_agent import Agent

def get_closing_time(office: str) -> dict:
    hours = {"melbourne": "5:00 PM", "sydney": "5:30 PM"}
    result = hours.get(office.lower())
    if not result:
        return {"status": "not_found", "office": office}
    return {"status": "success", "office": office, "closing_time": result}

root_agent = Agent(
    model="gemini-flash-latest",
    name="office_agent",
    description="Returns the approved closing time for an office.",
    instruction=(
        "Use get_closing_time for office hours. "
        "If the tool returns not_found, say you do not know."
    ),
    tools=[get_closing_time],
)

3. Test the behaviour

Terminal

adk run office_agent

0 of 3 checked

What you just built

The model understands the request. The instruction tells it when to use the tool. The function supplies controlled information. Your tests define acceptable behaviour.

That is already an agent. More tools and more autonomy do not automatically make it more useful.

Before connecting real systems

Add authentication, permission checks, logs, cost limits, error handling and approval before any write, send, purchase or deletion. A local demonstration is not production software.

Deploy only when the local behaviour is worth keeping

Google’s Cloud Run guide can build and deploy an ADK service from source with gcloud run deploy --source . Deployment also introduces billing, cloud permissions, public-access decisions, logging and cleanup.

Connect the build to a real workflow