- scaffold an agent,
- register simple tools,
- and let the LLM decide which tool to call based on natural language.

- Create and activate a Python virtual environment
- Install google-adk
- Scaffold an ADK app
- Add two simple tools
- Run the agent and interact with it
__init__.py and agent.py). The generated agent.py is the canonical place to register your agent and tools.
Example agent.py
Below is a minimal agent.py that defines two deterministic tools and registers them with the root agent. These are intentionally hard-coded for clarity; replace them with real API calls in production.
- instruction: The text given to the LLM that defines the agent’s behavior and available tools.
- tools: A list of Python callables the model may invoke. The LLM chooses which tool to call based on the user query.
- The LLM acts as a router: the instruction plus the user query determines which tool (if any) gets invoked.
- Tools are plain Python callables and can wrap HTTP APIs, SDKs, or complex business logic.
- For production, use real services (timezone APIs, weather APIs), robust error handling, timeouts, and non-blocking I/O when appropriate.
- Keep tool signatures simple and well-documented (type hints and short docstrings improve the LLM’s ability to choose correctly).
| Component | Purpose | Example / Notes |
|---|---|---|
| Agent instruction | Tells the model what tools are available and how to behave | Use clear, concise language describing tools and when to use them |
| tools parameter | Registers Python callables the agent may invoke | Functions, API wrappers, async callables (if supported) |
| Model selection | Chooses the LLM that will act as the router and responder | gemini-2.5-flash used in this tutorial |
| Backend | Underlying runtime for the model | Google AI (AI Studio) or Vertex AI |
Tip: Keep your tool interfaces simple and well-documented (type hints and concise docstrings help the LLM choose the right tool). In production, prefer non-blocking calls and proper error handling in tools.
Warning: Some ADK features are experimental and may emit warnings at runtime. Pay attention to those messages and review the ADK changelog when upgrading.
- The model performs semantic routing: given the instruction and a user prompt, it decides which tool to call and how to format the call.
- This approach separates decision-making (LLM) from execution (tools/APIs), enabling safer, auditable, and extensible agents.
- It mirrors retrieval-augmented patterns: the LLM identifies the appropriate capability or data source and returns the result in natural language.
- We created a Python virtual environment, installed google-adk, scaffolded a project, added two deterministic tools, and ran an interactive agent that uses the LLM to choose tools based on natural language.
- To build a production-ready agent, replace the stub tools with real API integrations (timezone, weather, or other services), add robust error handling, and monitor agent behavior.
- Google ADK course
- AI Studio: https://aistudio.google.com/apikey
- For more on agent design patterns, consult the ADK documentation included with the package or the provider’s model docs.