Install it and make an agent
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-adkPython 3.10 or later. A virtual environment is the usual advice and it applies here, because ADK brings a web server and a lot of integrations with it.
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])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 something actually 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. You do not need one to follow this course: the next lesson writes a model that answers with no network at all. Lesson 23 sets a real key up, when you want one.- Run
adk create my_agentand read the three files it wrote. - Change the instruction in the snippet above and print it again. Notice nothing else changes.
Little by little, you're building something great.