Installation and setup
One install, and an agent is an object you can print. Nothing runs when you make one, which is worth seeing before anything else.
pip install google-adkIt needs Python 3.10 or later. ADK brings a web server and many integrations with it, so the download is large.
An agent, made but not run
agent = LlmAgent(
name="support",
model="gemini-flash-latest",
description="Answers questions about orders.",
instruction="Help customers with their orders.",
tools=[lookup_order],
)
print("name: ", agent.name)
print("model:", agent.model)
print("tools:", [t.__name__ for t in agent.tools])name: support model: gemini-flash-latest tools: ['lookup_order']
Nothing was sent anywhere. Creating an agent builds a description of one: a name, a model to use, an instruction, and the functions it may call. The model string is not checked until the agent runs.
The four fields worth knowing on day one
| Field | What it is for |
|---|---|
name | How ADK refers to this agent, and how another agent hands work to it |
model | Which model to use, as a string or a model object |
description | What this agent is for. Another agent reads it when deciding whether to hand over |
instruction | What this agent should do. The model reads it every turn |
The difference between description and instruction catches everybody once. The instruction is for the model doing the work. The description is for whoever is deciding which agent should do it, which becomes lesson 16.
The project layout ADK expects
There is a command that makes one for you, and it is worth running once to see the shape.
adk create my_agentmy_agent/
agent.py # the agent, in a variable called root_agent
.env # API keys or project ids
__init__.pyThe only thing ADK requires is a variable named root_agent in agent.py. That is what the command line tools and the dev UI look for, which is lesson 24.
.env. The next lesson writes a model that answers without a network call, which is what every lesson up to 24 runs on. Lesson 25 sets a real one up.- Run
adk create my_agentand read the three files it wrote. - Change the instruction in the snippet above and print it again. Only the instruction changes.
Little by little, you're building something great.