Skip to main content
The Human BitAsk Bit

Build guide · Google ADK · Checked 17 July 2026

Build one small agent before building an “AI workforce.”

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

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. Give it one safe tool

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

adk run office_agent
  1. Ask when the Melbourne office closes. It should use the tool and return 5:00 PM.
  2. Ask about Brisbane. It should say it does not know, not invent a time.
  3. Ask it to change the closing time. It should have no tool capable of doing that.

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