1. How to use this course
What it is
Read in order. Tick the box when you finish a lesson. Your progress is saved in your browser. Each lesson has the same shape: What it is, Why it matters, Code to copy, Try it yourself, and Check questions with answers you can open. This page covers the whole program: 12 courses, about 12 hours in total, or 2 to 3 weeks at 4 to 6 hours a week. You go from what an AI agent is, to building one with Gemini Enterprise, to deploying it in production, to running multi-agent systems in a company, safely.
Why it matters
You do not need to do everything in one day. Ten minutes a day is enough. Do one lesson, try its code, then stop.
No code in this lesson
# No code in this lesson.
# Use the sidebar on the left to jump to any lesson.
# Tick "Done" when you finish a lesson.
# The practice code on this page runs offline.
Try it yourself
Open the sidebar and find Course 1. Tick this lesson Done.
Check
How long is this program?
About 12 hours in total, or 2 to 3 weeks at 4 to 6 hours a week.
Do I need to finish all 12 courses?
Yes, to cover everything. But you can learn one course at a time. Each course builds on the one before it.
2. Setup — what you need
What it is
You need: Python 3.11 or newer, a virtual environment (a clean, separate folder for Python packages), a text editor, and, for the real Google Cloud parts, a Google Cloud account and a Gemini API key (GOOGLE_API_KEY). Plain warning: Gemini Enterprise, Vertex AI Agent Engine, Cloud Run and GKE need a Google Cloud account and can cost money. The practice on this page runs offline, with a small simulated model and a local fake agent runtime. No API key and no cloud account are needed for the practice here. Short notes in the code show how to swap in the real Google Cloud services when you are ready. You also need basic Python, basic YAML, and a basic idea of cloud architectures and REST APIs — those are the prerequisites.
Why it matters
If setup is hard, learning stops. So setup is kept simple: Python, a virtual environment, and the practice code on this page needs nothing else.
Check Python and make a virtual environment
# 1. Check Python:
python3 --version
# You need Python 3.11 or newer.
# 2. Make a virtual environment (a clean folder for packages):
python3 -m venv .venv
source .venv/bin/activate # on Windows: .venv\Scripts\activate
# 3. For the real ADK (not needed for this page):
# pip install google-adk
# 4. For the real Gemini API (not needed for this page):
# Put this in a file called .env (never share this file):
# GOOGLE_API_KEY=your-key-here
Try it yourself
Run python3 --version on your computer and write down the number. Then make a virtual environment with the commands above.
Check
Do I need a Google Cloud account for this page?
No. The practice code here runs offline with a simulated model. You need a Google Cloud account only when you use the real Gemini Enterprise, Vertex AI Agent Engine, Cloud Run, or GKE.
Do I need an API key for the practice here?
No. The practice code uses a small fake model. The code notes show where a real GOOGLE_API_KEY would go.
3. What you will learn
What it is
By the end of this program you will be able to do four things. 1) Build, configure, and optimize AI agents using Python code, YAML, and Google's Gemini Enterprise. 2) Equip agents with tools, structured outputs, and real-time state management using session state and Memory Bank. 3) Deploy scalable agents and multi-agent trees to Vertex AI Agent Engine, serverless Cloud Run, and GKE. 4) Strategically orchestrate enterprise multi-agent systems using Gemini Enterprise and human-centered AI governance. In plain words: you will go from 'what is an agent' to 'a team of agents running in production, safely'.
Why it matters
These four skills are the whole journey. Each course teaches one part, and the parts join together in the capstone at the end.
Your learning path, in one picture
# The 12 courses, in order:
# 1. Introduction to AI Agents
# 2. Agent Fundamentals
# 3. Enterprise Agents and Use Cases
# 4. Build Agents with Gemini Enterprise
# 5. Build Your First Agent with Gemini Enterprise
# 6. Optimize Agent Behavior
# 7. Add Agent Capabilities With Tools
# 8. Manage Agent Memory and State
# 9. Build and Deploy Agents in Production
# 10. Deploy Your First Agent
# 11. Gen AI Agents: Transform Your Organization
# 12. Human-Centered AI
# Capstone: a production multi-agent system, with a human in the loop.
Try it yourself
Write down the four things above in your notebook, in your own words.
Check
What is the goal of this program?
To design, build, and run intelligent AI agents with Google Cloud's agent stack, from first agent to enterprise scale.
What does 'human-centered AI governance' mean, in short?
Rules and human checks that keep agents safe and fair, even when they act on their own.
4. Skills, tools, and career
What it is
Skills you will gain: AI Orchestration, Cloud Infrastructure, Cloud Hosting, Large Language Modeling, Cloud-Native Computing, YAML, AI Integrations, Cloud Deployment, Application Deployment, Responsible AI, Model Context Protocol, Artificial Intelligence, Maintainability, Process Design, AI Personalization, Systems Architecture, Organizational Change, Business Process Automation, and Scalability. The tool you will learn is Gemini. Together they show you can build and run agents, not just talk about them.
Why it matters
Employers want people who can build and operate agents in production. Your working agents are proof you practised exactly that.
Skills checklist
# Tick the skills you already have. Learn the rest here:
# [ ] AI Orchestration [ ] YAML [ ] Model Context Protocol
# [ ] Cloud Deployment [ ] Responsible AI [ ] Scalability
# [ ] Systems Architecture [ ] Business Process Automation
# Tool: Gemini (Google's AI model family).
Try it yourself
Tick the skills you already have, and circle the three you most want to learn.
Check
Which tool will you learn?
Gemini, Google's AI model family, used through Gemini Enterprise and the ADK.
5. Applied Learning Project
What it is
The Applied Learning Project is the hands-on work that runs through the whole program. You will: set up Gemini Enterprise development environments; build agents using both Python code and YAML configurations; optimize behavior with advanced instructions and structured outputs; equip agents with real-world tools; manage session state; configure long-term memory with Memory Bank; and deploy production-ready agents to Vertex AI Agent Engine and Cloud Run, while applying human-centered AI governance. On this page, the capstone at the end is your version of this project: one support agent, built step by step, then grown into a multi-agent system and deployed.
Why it matters
Reading about agents is not the same as building one. The project is where the learning becomes a skill.
The project, as a checklist
# Applied Learning Project — what you will build:
# [ ] Gemini Enterprise dev environment set up
# [ ] Agent built in Python AND in YAML
# [ ] Instructions optimized, with structured outputs
# [ ] Real tools added to the agent
# [ ] Session state working
# [ ] Memory Bank configured for long-term memory
# [ ] Agent deployed to Vertex AI Agent Engine and Cloud Run
# [ ] Human-centered AI governance applied
Try it yourself
Copy the checklist above into your notebook. Tick items as you finish them in the lessons.
Check
What is the Applied Learning Project?
The hands-on work of the program: build and deploy real agents with Google Cloud's stack, step by step.
Do I build one agent or many?
You start with one agent, then grow it into a multi-agent system in the capstone.
6. Core capabilities of AI agents
What it is
An AI agent has three core capabilities. 1) Autonomous action: it can act on its own to reach a goal, without a human clicking each step. 2) Reasoning: it can think through a problem, break it into steps, and choose what to do next. 3) Continuous learning: it can get better over time, by remembering what worked and what did not. A chatbot waits for your next message. An agent works toward a goal, even when you are not watching.
Why it matters
These three capabilities are the test for 'is this an agent?'. If it cannot act alone, reason, and learn, it is probably just a chatbot.
The three capabilities, as code (offline practice)
class FakeAgent:
def __init__(self, name, goal):
self.name = name
self.goal = goal
self.memory = [] # what it learned
def reason(self, task):
# Reasoning: break the goal into steps.
return ["understand the request", "pick a tool", "act", "check the result"]
def act(self, task):
steps = self.reason(task)
self.memory.append(task) # Continuous learning: remember it.
return f"{self.name} did: " + " -> ".join(steps)
agent = FakeAgent("support-agent", "help customers")
print(agent.act("my order is late"))
print("Learned so far:", agent.memory)
Try it yourself
Run the code above. Change the goal to something from your work and run it again.
Check
What are the three core capabilities of an AI agent?
Autonomous action, reasoning, and continuous learning.
What does 'autonomous action' mean?
The agent acts on its own to reach a goal, without a human doing each step.
7. Chatbots vs autonomous agents
What it is
A reactive, script-based chatbot only reacts: you write something, it matches a script or a pattern, and it answers. It has no goal of its own and no memory of the bigger job. An autonomous, goal-oriented agent is different: you give it a goal, and it plans, uses tools, checks its work, and keeps going until the goal is done. Example: a chatbot answers 'What is the delivery time?' An agent takes 'Sort out my late order', checks the order, contacts the courier, offers a new date, and tells you when it is fixed.
Why it matters
The difference matters because the two need different designs. A chatbot needs good answers. An agent needs a goal, tools, a plan, and checks.
Chatbot vs agent, side by side
# CHATBOT (reactive, script-based):
# You: "What is the delivery time?"
# Bot: "Delivery takes 3 to 5 days." <- one answer, job over.
#
# AGENT (autonomous, goal-oriented):
# You: "Sort out my late order."
# Agent: 1) look up the order 2) check the courier
# 3) offer a new date 4) confirm with you
# The agent keeps going until the goal is done.
def is_agent(can_act_alone, has_goal, uses_tools):
return can_act_alone and has_goal and uses_tools
print("Chatbot is an agent?", is_agent(False, False, False))
print("Support agent is an agent?", is_agent(True, True, True))
Try it yourself
Write down one chatbot task and one agent task from your work. What makes the second one an agent task?
Check
What is the main difference between a chatbot and an agent?
A chatbot reacts to each message. An agent works toward a goal, with a plan, tools, and checks.
Can a chatbot become an agent?
Yes, if you give it a goal, tools, memory, and the freedom to act step by step.
8. Multi-agent collaboration
What it is
Multi-agent collaboration means several agents work together on a big goal. Each agent has its own job, and they share knowledge and coordinate actions. Example: a support agent talks to the customer, a research agent looks up the order and the courier, and a booking agent offers a new date. Together they solve a problem no single agent could solve alone. The agents pass results to each other, like a team passing work along a line.
Why it matters
Big goals need teams. One agent doing everything gets slow, confused, and hard to fix. A team of small, focused agents is easier to build, test, and improve.
A tiny multi-agent team (offline practice)
class Agent:
def __init__(self, name, job):
self.name, self.job = name, job
def run(self, task):
return f"[{self.name}] {self.job}: {task}"
# Each agent has one job. They pass results along.
support = Agent("support", "talk to the customer")
research = Agent("research", "look up the order")
booking = Agent("booking", "offer a new date")
task = "my order is late"
print(support.run(task))
print(research.run("order #1234 is with the courier"))
print(booking.run("new date: Friday"))
Try it yourself
Add a fourth agent to the team above, for example a 'billing' agent, and give it one job.
Check
Why use several agents instead of one big agent?
Each agent has one focused job, so the team is easier to build, test, and fix.
How do agents collaborate?
They share knowledge and pass results to each other to reach a large-scale goal.
9. Agent architecture: models, tools, orchestration, runtime
What it is
Every agent is built from four parts. 1) Model: the AI brain, here Gemini, that understands and decides. 2) Tools: the hands — functions the agent can call, like looking up an order or sending a message. 3) Orchestration: the plan — how the agent decides which step comes next, and how agents work together. 4) Runtime: the place where the agent runs — your computer, a server, or the cloud. If any part is missing, the agent cannot work: a brain with no hands cannot act, and hands with no plan act at random.
Why it matters
These four parts are the map for the whole program. Courses 4 to 10 each teach one or two of them in detail.
The four parts, as a dictionary (offline practice)
architecture = {
"model": "Gemini — understands and decides",
"tools": ["look_up_order", "send_message"],
"orchestration": "plan: understand -> look up -> act -> check",
"runtime": "local computer now, Cloud Run later",
}
for part, detail in architecture.items():
print(f"{part}: {detail}")
# Check: an agent needs all four parts.
missing = [p for p in ["model", "tools", "orchestration", "runtime"]
if p not in architecture]
print("Missing parts:", missing or "none — the agent can work")
Try it yourself
Write down the four parts for a support agent at your work, with one example for each part.
Check
What are the four components of agent architecture?
Models, tools, orchestration, and runtime.
What happens if the agent has no tools?
It can think but cannot act — no looking up orders, no sending messages.
10. Define AI agents and autonomous goal achievement
What it is
An AI agent is a program that achieves a goal on its own. You give it the goal, not the steps. The agent figures out the steps, uses tools, checks its work, and finishes the job — or asks for help when it is stuck. 'Autonomous goal achievement' means exactly that: the goal is yours, the steps are the agent's. Example: goal 'book a meeting with the client'. The agent checks calendars, finds a free time, sends the invite, and confirms. You did not tell it each click.
Why it matters
This definition is the foundation of the program. Every later course is about one part of making this definition real.
A goal, not steps (offline practice)
def agent_run(goal, tools):
print(f"Goal: {goal}")
for step, tool in enumerate(tools, 1):
print(f" Step {step}: use {tool}")
print("Goal reached — no human clicked each step.")
agent_run("book a meeting with the client",
["check_calendar", "find_free_time", "send_invite", "confirm"])
Try it yourself
Write a goal from your work, then list the steps an agent would need to reach it.
Check
What is an AI agent, in one sentence?
A program that achieves a goal on its own, by planning steps and using tools.
What does 'autonomous goal achievement' mean?
You give the goal; the agent figures out the steps and finishes the job.
11. Core capabilities: action, reasoning, planning, learning
What it is
Course 1 gave three capabilities: autonomous action, reasoning, and continuous learning. This course adds a fourth: planning. Planning is making a plan before acting — breaking a goal into ordered steps, and changing the plan when something goes wrong. The four together work like this: reason about the problem, plan the steps, act on the plan, and learn from the result. A good agent does all four, in a loop, until the goal is done.
Why it matters
Planning is what stops an agent from acting at random. Reason, plan, act, learn — that loop is the heart of every agent you will build.
The agent loop (offline practice)
def agent_loop(goal):
plan = ["understand", "plan", "act", "check", "learn"]
for step in plan:
print(f" {step} -> goal: {goal}")
return "done"
print(agent_loop("help a customer with a late order"))
Try it yourself
Run the loop above. Then change the goal and run it again. What stays the same?
Check
What are the four core capabilities?
Autonomous action, reasoning, planning, and continuous learning.
Why does planning matter?
It stops the agent from acting at random. It orders the steps before acting.
12. Workplace use cases: customer service, marketing, research
What it is
Agents are already useful in three workplace areas. Customer service: answer questions, check orders, book appointments, and hand over to a human when needed. Marketing: draft campaigns, summarize customer feedback, and suggest next steps. Research: gather information from many sources, summarize it, and flag what matters. In each case the agent does the repetitive, multi-step work, and a human checks the important decisions.
Why it matters
Use cases turn theory into work. If you can name the use case, you can name the agent's goal, tools, and checks.
Three use cases, three agents (offline practice)
use_cases = {
"customer service": "answer, check order, book, hand over",
"marketing": "draft campaign, summarize feedback, suggest next steps",
"research": "gather sources, summarize, flag what matters",
}
for area, job in use_cases.items():
print(f"{area}: {job}")
Try it yourself
Pick one area above and write down a real task from your work that an agent could do in that area.
Check
Name one use case in each area.
Customer service: check an order. Marketing: draft a campaign. Research: summarize sources.
Who checks the important decisions?
A human. The agent does the repetitive work; the human checks what matters.
13. Agents vs traditional chatbots
What it is
An agent differs from a traditional chatbot in two ways. 1) Autonomous action: the agent acts on its own toward a goal; a chatbot only answers the last message. 2) System integration: the agent is connected to real systems — orders, calendars, CRM — and can read and write there; a chatbot usually only talks. A chatbot says 'Your order is late.' An agent checks the order, finds the problem, and fixes it.
Why it matters
If an agent is not connected to any system, it cannot act. Integration is what turns talk into work.
Connected or not? (offline practice)
def can_act(agent):
return agent["autonomous"] and len(agent["systems"]) > 0
chatbot = {"autonomous": False, "systems": []}
agent = {"autonomous": True, "systems": ["orders", "calendar", "crm"]}
print("Chatbot can act?", can_act(chatbot))
print("Agent can act?", can_act(agent))
Try it yourself
Name one system at your work an agent would need to connect to, and what it would read or write there.
Check
What two things separate agents from traditional chatbots?
Autonomous action and system integration.
Why does system integration matter?
Without it, the agent can talk but cannot read or write real data, so it cannot act.
14. Map agent types to business KPIs
What it is
A KPI is a Key Performance Indicator: a number that shows if the business is doing well, for example 'average time to answer a customer' or 'meetings booked per week'. Mapping an agent type to a KPI means: pick the agent that moves the number you care about. A support agent moves 'time to resolve'. A booking agent moves 'meetings booked'. If an agent does not move any KPI, it is a toy, not a business tool. Start from the KPI, then choose the agent.
Why it matters
Businesses pay for results, not for demos. The KPI is how you prove the agent is worth it.
From KPI to agent (offline practice)
kpis = {
"time to resolve a ticket": "support agent",
"meetings booked per week": "booking agent",
"hours saved on research": "research agent",
}
for kpi, agent in kpis.items():
print(f"KPI '{kpi}' -> build a {agent}")
Try it yourself
Pick one KPI from your work and write down which agent would move it.
Check
What is a KPI?
A Key Performance Indicator — a number that shows if the business is doing well.
Why start from the KPI, not from the technology?
Because the KPI proves the agent is worth it. Technology without a KPI is a toy.
15. The four components of an agentic workflow
What it is
An agentic workflow runs on the same four components as Course 1: models, tools, orchestration, and runtime. Models think. Tools act. Orchestration plans and coordinates. Runtime runs it all. In a business workflow, add one more idea: the workflow is the whole job, from the first message to the finished result. Example: a customer writes in, the model understands, the tools check the order, the orchestration decides the next step, and the runtime keeps it all running.
Why it matters
When a workflow fails, one of the four components is usually the cause. Knowing the four parts helps you find the problem fast.
Find the failing part (offline practice)
workflow = {"model": "ok", "tools": "ok", "orchestration": "broken", "runtime": "ok"}
for part, status in workflow.items():
if status != "ok":
print(f"Problem is in: {part} — fix the plan, not the model.")
Try it yourself
Think of a workflow that went wrong at your work. Which of the four parts was the problem?
Check
What are the four key components of an agentic workflow?
Models, tools, orchestration, and runtime.
What does orchestration do in a workflow?
It plans and coordinates the steps, and decides what comes next.
16. Ways to deploy agents
What it is
There are four ways to deploy an agent. 1) Google-built: use an agent Google already made. 2) No-code: build with clicks and forms, no programming. 3) High-code: build with Python and the ADK, full control. 4) Third-party integrations: connect agents from other companies. The right way depends on how much control you need and how fast you must move. No-code is fast and limited. High-code is slower to start and can do anything. Google-built is fastest when it already does your job.
Why it matters
Choosing the deployment way is a business decision, not just a technical one. Speed, control, and cost all matter.
Choose the way (offline practice)
def choose_way(need_control, need_speed):
if need_control:
return "high-code with Python and ADK"
if need_speed:
return "Google-built or no-code"
return "third-party integration"
print(choose_way(True, False)) # custom support agent
print(choose_way(False, True)) # quick FAQ assistant
Try it yourself
For a task at your work, would you pick no-code or high-code? Write down why.
Check
What are the four ways to deploy agents?
Google-built, no-code, high-code, and third-party integrations.
When is high-code the right choice?
When you need full control over what the agent does.
17. Pre-built assistant vs fully customized agent
What it is
A pre-built assistant is ready to use: it answers common questions, needs little setup, and you cannot change much. A fully customized agent is built for your business: your data, your tools, your rules, your tone. It takes more work, but it does your exact job. Rule of thumb: if the job is common and standard, start pre-built. If the job is special to your business, build custom. Many teams start pre-built and go custom when they outgrow it.
Why it matters
Picking the wrong fit wastes money: a custom agent for a standard job, or a pre-built assistant for a special job, both fail.
Pre-built or custom? (offline practice)
def decide(job_is_standard):
if job_is_standard:
return "pre-built assistant — fast, cheap, good enough"
return "fully customized agent — your data, tools, and rules"
print(decide(True)) # answer common FAQs
print(decide(False)) # handle our own order system
Try it yourself
Name one standard job and one special job at your work. Which fits pre-built, and which fits custom?
Check
When is a pre-built assistant the best fit?
When the job is common and standard, and speed matters more than control.
When do you need a fully customized agent?
When the job is special to your business — your data, tools, and rules.
18. What ADK is, and how it differs from prompt engineering
What it is
ADK is the Agent Development Kit: Google's toolkit for building agents in Python. Prompt engineering is writing a good instruction for one chat answer. ADK is more: it gives you agents, tools, sessions, memory, evaluation, and deployment, all in one kit. With prompt engineering you ask a question and get an answer. With ADK you build a program that plans, calls tools, remembers, and runs in production. Gemini Enterprise is the Google Cloud platform where these agents live and run.
Why it matters
Prompt engineering is a skill. ADK is the workshop where you build with that skill, and where the agent becomes a real product.
Prompt vs ADK agent (offline practice)
# PROMPT ENGINEERING: one instruction, one answer.
prompt = "Answer as a helpful support agent."
print("Prompt:", prompt)
# ADK: an agent object with a model, tools, and a runner.
# (Offline practice version — the real ADK is google.adk.)
class Agent:
def __init__(self, name, model, instruction, tools=None):
self.name, self.model, self.instruction = name, model, instruction
self.tools = tools or []
agent = Agent("support_agent", "gemini-2.0-flash",
"You help customers with orders.", tools=["look_up_order"])
print("ADK agent:", agent.name, "| model:", agent.model, "| tools:", agent.tools)
Try it yourself
Write down one task that prompt engineering can do, and one task that needs ADK. What is the difference?
Check
What is ADK?
The Agent Development Kit — Google's toolkit for building agents in Python, with tools, sessions, memory, and deployment.
How is ADK different from prompt engineering?
Prompt engineering is one good instruction for one answer. ADK builds a whole agent that plans, uses tools, remembers, and runs in production.
19. ADK developer tools: CLI, web UI, evaluation
What it is
ADK comes with developer tools. 1) The CLI (command line): commands like adk create, adk web, adk run, and adk api_server, which you will meet in Course 5. 2) The web-based UI: a page in your browser where you can talk to your agent, see its steps, and test it without writing test code. 3) Evaluation features: tools that check how well your agent does, by running it against test cases and scoring the answers. Together they cover the loop: build, try, measure, improve.
Why it matters
You cannot improve what you do not measure. The evaluation tools are what turn guessing into knowing.
The ADK loop (offline practice)
# Build -> Try -> Measure -> Improve
loop = ["build (adk create)", "try (adk web)", "measure (evaluation)", "improve (edit instruction)"]
for i, step in enumerate(loop, 1):
print(f"{i}. {step}")
Try it yourself
Write down the four steps of the ADK loop. Which step do you usually skip when you build something?
Check
What are the ADK developer tools?
The CLI, the web-based UI, and the evaluation features.
What is evaluation for?
To check how well your agent does, by running it against test cases and scoring the answers.
20. Three pathways for deploying containerized ADK agents
What it is
An ADK agent is shipped as a container: a sealed box with the agent and everything it needs to run. There are three primary pathways to deploy that container. 1) Managed runtime: Google runs it for you, for example Vertex AI Agent Engine. 2) Serverless: it runs only when needed, for example Cloud Run, and you pay only for what you use. 3) Custom infrastructure: you run it on your own machines or cluster, for example GKE, with full control. Managed is easiest, serverless is cheapest for spiky traffic, custom is most flexible.
Why it matters
Deployment is a choice about who manages the machines. The agent code stays the same; where it runs changes.
Three pathways, one agent (offline practice)
pathways = {
"Managed runtime": "Vertex AI Agent Engine — Google runs it",
"Serverless": "Cloud Run — runs when needed, pay per use",
"Custom infrastructure": "GKE — your cluster, full control",
}
for name, detail in pathways.items():
print(f"{name}: {detail}")
Try it yourself
Which pathway would you pick for an agent used once a day, and which for one used all day? Why?
Check
What are the three deployment pathways for containerized ADK agents?
Managed runtime, Serverless, and Custom infrastructure.
Give one example of each.
Managed: Vertex AI Agent Engine. Serverless: Cloud Run. Custom: GKE.
21. ADK installation with virtual environments
What it is
To install ADK you use a virtual environment: a clean, separate folder for Python packages, so your agent's packages do not mix with other projects. Steps: make the folder with python3 -m venv .venv, turn it on with source .venv/bin/activate, then install with pip install google-adk. A virtual environment is like a separate toolbox for each project: what you put in one box does not leak into another.
Why it matters
Without a virtual environment, packages from different projects fight each other, and things break in ways that are hard to find.
Install ADK, step by step
# 1. Make the virtual environment:
# python3 -m venv .venv
# 2. Turn it on:
# source .venv/bin/activate
# 3. Install ADK:
# pip install google-adk
# 4. Check it:
# adk --help
#
# Offline practice — simulate the check:
import sys
print("Python:", sys.version.split()[0])
print("ADK install command: pip install google-adk")
Try it yourself
Run the check above on your computer. What Python version do you have?
Check
Why use a virtual environment?
So each project's packages stay separate and do not fight each other.
What command installs ADK?
pip install google-adk, inside an activated virtual environment.
22. Four core parameters and the root_agent convention
What it is
Every ADK agent is defined by four core parameters. 1) model: which Gemini model to use, for example gemini-2.0-flash. 2) name: the agent's name, for example support_agent. 3) description: one line saying what the agent does. 4) instruction: the detailed instruction telling the agent how to behave. The root_agent naming convention: the main agent of a project must be called root_agent, so ADK tools can find it. Other agents get their own names, and root_agent calls them.
Why it matters
These four parameters are the DNA of every agent. Change the instruction, and you change the agent.
Your first agent (offline practice)
class Agent:
def __init__(self, model, name, description, instruction):
self.model, self.name = model, name
self.description, self.instruction = description, instruction
# The main agent of a project MUST be called root_agent.
root_agent = Agent(
model="gemini-2.0-flash",
name="support_agent",
description="Helps customers with orders and deliveries.",
instruction="Be polite and short. Look up the order before answering."
)
print(root_agent.name, "|", root_agent.model)
print("Description:", root_agent.description)
print("Instruction:", root_agent.instruction)
Try it yourself
Write the four parameters for an agent that helps your team, in your notebook.
Check
What are the four core parameters of an ADK agent?
Model, name, description, and instruction.
Why must the main agent be called root_agent?
So ADK tools can find it automatically.
23. Configure .env files with GOOGLE_API_KEY after adk create
What it is
After adk create makes your agent project, you add a file called .env with your key: GOOGLE_API_KEY=your-key-here. The .env file is how the agent knows it is you, and it is how it pays for the Gemini calls. Two rules: never share your .env file, and never put the key in your code or in a chat. The key is a secret, like a password. If it leaks, someone else can use your account.
Why it matters
A leaked key is a stolen wallet. Keep it in .env, keep .env out of git, and never paste the key anywhere.
.env, the safe way (offline practice)
# File: .env (never commit this file, never share it)
# GOOGLE_API_KEY=your-key-here
#
# In Python, read it without printing it:
import os
key = os.environ.get("GOOGLE_API_KEY", "NOT-SET-FOR-PRACTICE")
print("Key is set:", key != "NOT-SET-FOR-PRACTICE")
print("Key value shown? No — never print a key.")
Try it yourself
Check: does your project have a .env file? Is it in your .gitignore file?
Check
Where does GOOGLE_API_KEY go?
In a file called .env, after adk create. Never in code, never in chat.
Why must .env never go into git?
Because anyone who sees it can use your key and your account.
24. Three execution modes and programmatic execution with Runner
What it is
ADK has three execution modes. 1) adk web: a web page in your browser to chat with your agent and see its steps. 2) adk run: run the agent once from the command line. 3) adk api_server: run the agent as a server, so other programs can call it over the internet. For code, you use a Runner: it takes your agent, starts a session, and runs the agent on each message. A session is one conversation. The Runner is the engine; the modes are the doors into it.
Why it matters
Try in the web UI first, run once with adk run, then serve with adk api_server. Each mode is for a different stage.
Run an agent with a Runner (offline practice)
class Runner:
def __init__(self, agent):
self.agent = agent
self.session = [] # one conversation
def run(self, message):
self.session.append(("user", message))
reply = f"[{self.agent.name}] I will help with: {message}"
self.session.append(("agent", reply))
return reply
class Agent:
def __init__(self, name):
self.name = name
root_agent = Agent("support_agent")
runner = Runner(root_agent)
print(runner.run("my order is late"))
print("Session so far:", runner.session)
Try it yourself
Run the code above, then send a second message through the same runner. What does the session hold now?
Check
What are the three execution modes?
adk web, adk run, and adk api_server.
What does a Runner do?
It takes your agent, starts a session, and runs the agent on each message. A session is one conversation.
25. YAML-based Agent Config and when to use YAML vs Python
What it is
YAML is a simple text format for settings, with no code. ADK lets you define an agent in YAML instead of Python: name, model, description, and instruction, written as plain lines. This is called Agent Config, and it is code-free agent definition. Use YAML when the agent is simple and you want to change its instruction without touching code. Use Python when the agent needs custom tools, logic, or conditions. Many teams use both: YAML for simple agents, Python for the clever ones.
Why it matters
YAML is fast to change. Python is powerful. Pick the tool that fits the agent, not the other way round.
The same agent in YAML and in Python
# YAML version (file: support_agent.yaml):
# name: support_agent
# model: gemini-2.0-flash
# description: Helps customers with orders and deliveries.
# instruction: Be polite and short. Look up the order first.
#
# Python version of the same agent:
agent_yaml = {
"name": "support_agent",
"model": "gemini-2.0-flash",
"description": "Helps customers with orders and deliveries.",
"instruction": "Be polite and short. Look up the order first.",
}
print(agent_yaml)
print("YAML = simple, fast to change. Python = custom tools and logic.")
Try it yourself
Write the YAML for your own agent from the last lesson. Which parts would need Python instead?
Check
When should you use YAML for an agent?
When the agent is simple and you want to change its instruction without touching code.
When should you use Python instead?
When the agent needs custom tools, logic, or conditions.
26. Writing sophisticated multi-section instructions
What it is
A sophisticated instruction is not one long paragraph. It has sections, each with one job: Role (who the agent is), Goal (what it must achieve), Rules (what it must and must not do), Steps (the order of work), and Output (what the answer should look like). The agent reads the sections in order, so a clear structure means clear behavior. One messy paragraph gives messy behavior. Five clear sections give steady behavior.
Why it matters
Structure is control. If the agent behaves badly, the first place to look is the instruction's structure.
A multi-section instruction (offline practice)
instruction = """
Role: You are a support agent for an online shop.
Goal: Help the customer with their order, fast and politely.
Rules: Look up the order before answering. Never invent a date.
Steps: 1) Ask for the order number. 2) Look it up. 3) Explain and offer a fix.
Output: Short answer, plain words, end with a question.
"""
sections = [line.split(":")[0] for line in instruction.strip().splitlines()]
print("Sections:", sections)
print(instruction)
Try it yourself
Write a multi-section instruction for your agent, with all five sections.
Check
What are the five sections of a good instruction?
Role, Goal, Rules, Steps, and Output.
Why do sections help?
The agent reads them in order, so clear structure gives steady behavior.
27. Creating consistent agent personalities
What it is
A personality is how the agent sounds and acts, every time. Pick three traits, for example polite, short, and calm. Write them into the instruction, and give one example of each. Then test: ask the agent five different questions. If it sounds the same in all five, the personality is working. If it changes, the instruction is too weak. Consistency builds trust: customers know what to expect.
Why it matters
People trust what is steady. An agent that is polite on Monday and rude on Tuesday loses customers.
Test the personality (offline practice)
traits = ["polite", "short", "calm"]
def check_reply(reply):
problems = []
if len(reply) > 120:
problems.append("too long — not short")
if "please" not in reply.lower() and "sorry" not in reply.lower():
problems.append("not polite")
return problems or ["OK — matches the personality"]
print(check_reply("Sorry about the delay. Please share your order number."))
print(check_reply("Your order is late and there is nothing I can do about it, it is a very long and complicated story."))
Try it yourself
Pick three traits for your agent and write one example reply for each trait.
Check
How do you create a consistent personality?
Pick three traits, write them into the instruction with examples, and test with different questions.
Why does consistency matter?
People trust what is steady. A changing tone loses customers.
28. Implementing ethical boundaries
What it is
Ethical boundaries are lines the agent must never cross. Write them as plain rules in the instruction: never lie, never invent facts or dates, never share private data, never be rude, never decide about money without a human check. Boundaries are not suggestions — they are rules, and the agent must follow them even if the user asks it not to. Test them: try to make the agent break a boundary, and check that it refuses politely.
Why it matters
Boundaries protect the customer, the business, and you. An agent without boundaries is a risk, not a helper.
Boundaries as rules (offline practice)
boundaries = [
"never invent a date or a price",
"never share private customer data",
"never decide about money without a human check",
]
def allowed(action):
for rule in boundaries:
if "invent" in rule and "invent" in action:
return "REFUSED: " + rule
if "money" in rule and "refund" in action:
return "NEEDS HUMAN: " + rule
return "ALLOWED"
print(allowed("invent a delivery date"))
print(allowed("give a refund"))
print(allowed("look up the order"))
Try it yourself
Write three boundaries for your agent, then try to break each one in a test message.
Check
What is an ethical boundary?
A line the agent must never cross, written as a plain rule in the instruction.
Should the agent follow a boundary if the user asks it not to?
Yes. Boundaries are rules, not suggestions.
29. Using examples to guide behavior
What it is
Examples teach faster than rules. Instead of writing 'be polite', show one polite reply. Instead of writing 'be short', show one short reply. This is called few-shot prompting: a few examples before the task. Give two or three good examples, then the real question. The agent copies the pattern of the examples: the tone, the length, the format. If the agent's answers drift, add a better example — do not add a longer rule.
Why it matters
Show, do not just tell. One good example is worth a page of rules.
Examples before the task (offline practice)
examples = [
("Q: Where is my order?", "A: Sorry for the wait. Please share your order number and I will check."),
("Q: Can I change the date?", "A: Yes. Please tell me the new date you want."),
]
for q, a in examples:
print(q)
print(a)
# Now the agent answers the new question in the same style.
print("Q: My order is late. What do I do?")
print("A: Sorry about the delay. Please share your order number and I will check.")
Try it yourself
Write two example question-and-answer pairs for your agent, in the style you want it to use.
Check
What are examples in an instruction called?
Few-shot prompting — a few examples before the task.
Why do examples work better than long rules?
The agent copies the pattern: tone, length, and format, directly from the examples.
30. Core tool concepts
What it is
A tool is a function the agent can call to do something real: look up an order, check a calendar, send a message. The agent cannot do these things by thinking alone — it needs tools as its hands. A tool has a name, a description of what it does, and inputs it needs. The agent reads the description, decides when to use it, and the program runs it. Good tools do one thing well, and their names say what they do.
Why it matters
Tools turn a talking agent into a working agent. Without tools, the agent can only guess.
A first tool (offline practice)
def look_up_order(order_number):
"""Look up an order by its number. Returns the order status."""
orders = {"1234": "with the courier, arrives Friday",
"5678": "delivered yesterday"}
return orders.get(order_number, "order not found")
print(look_up_order("1234"))
print(look_up_order("9999"))
Try it yourself
Write down three tools your agent needs, with one line each saying what each tool does.
Check
What is a tool?
A function the agent can call to do something real, like looking up an order.
Why does a tool need a description?
So the agent can read it and decide when to use it.
31. Built-in tools
What it is
Built-in tools come with the platform — you do not write them. Examples: web search, code execution, and tools that read files or documents. In Gemini Enterprise and ADK, built-in tools are ready to add to your agent with one line. Use them first, before writing your own: they are tested, maintained, and free to use. Only write a custom tool when no built-in tool does the job.
Why it matters
Do not rebuild what already exists. Built-in tools save time and bugs.
Use a built-in tool first (offline practice)
# Built-in tools are ready to add. In ADK, you list them like tools.
# In this offline practice, we simulate a web search tool.
def web_search(query):
"""Built-in style tool: search the web. (Simulated here.)"""
return f"Search results for '{query}': 3 pages found."
print(web_search("delivery times for order 1234"))
print("Rule: use a built-in tool before writing your own.")
Try it yourself
Name one job for your agent that a built-in tool could do, for example searching or reading a file.
Check
What are built-in tools?
Tools that come with the platform, ready to add, so you do not write them yourself.
When should you write a custom tool instead?
Only when no built-in tool does the job.
32. MCP tools
What it is
MCP is the Model Context Protocol: a standard way for agents to use tools from other programs. Think of it like a plug: any tool that speaks MCP can plug into any agent that speaks MCP. Instead of writing a new connection for every tool, you connect once through MCP, and the agent can use tools from many servers: calendars, files, databases, and more. MCP tools are listed to the agent just like other tools, but they run on an MCP server, not in your code.
Why it matters
MCP stops you from rebuilding the same connection again and again. One standard plug, many tools.
An MCP tool, in plain code (offline practice)
# MCP = Model Context Protocol: a standard plug for tools.
# In real ADK code you connect to an MCP server like this:
# from google.adk.tools.mcp_tool import McpToolset
# tools = McpToolset(connection_params=...)
# In this offline practice, we simulate one MCP tool.
def mcp_calendar_check(date):
"""MCP tool (simulated): check a calendar through an MCP server."""
return f"{date}: free at 10:00 and 14:00."
print(mcp_calendar_check("Friday"))
Try it yourself
Name one tool at your work that could come through MCP, for example a calendar or a database.
Check
What is MCP?
The Model Context Protocol — a standard way for agents to use tools from other programs, like one plug for many tools.
Why use MCP instead of writing your own connection?
So you connect once and reuse tools from many servers, instead of rebuilding each connection.
33. Custom function tools
What it is
A custom function tool is a tool you write yourself in Python, for a job only your business has: looking up an order in your system, checking your stock, or calculating a price. You write a normal Python function, add a clear description, and give it to the agent. The agent calls it by name, with the inputs it needs. Keep it small, keep it safe: a tool should never delete data or spend money without a check.
Why it matters
Your business is special. Custom tools are how the agent learns your business.
A custom function tool (offline practice)
def check_stock(product):
"""Check how many of a product are in stock."""
stock = {"shoes": 12, "hat": 0, "jacket": 5}
return stock.get(product, "unknown product")
def book_appointment(date, time):
"""Book an appointment. Only books, never cancels."""
return f"Booked: {date} at {time}."
print(check_stock("shoes"))
print(check_stock("hat"))
print(book_appointment("Friday", "10:00"))
Try it yourself
Write one custom function tool for your agent, with a clear description and one job only.
Check
What is a custom function tool?
A tool you write yourself in Python, for a job only your business has.
What should a custom tool never do without a check?
Delete data or spend money.
34. State fundamentals
What it is
State is what the agent remembers during a conversation. Session state is the memory of one conversation: the order number, what the customer already said, what step you are on. Without state, the agent asks the same question again and again. With state, it remembers. State is stored as simple key-value pairs, like a dictionary: state['order_number'] = '1234'. The agent reads state before answering, and updates it after each step.
Why it matters
State is the agent's short-term memory. Without it, every message feels like the first message.
Session state as a dictionary (offline practice)
state = {} # session state: memory of ONE conversation
state["order_number"] = "1234"
state["step"] = "waiting for delivery date"
state["customer_name"] = "Ana"
print("Order:", state["order_number"])
print("Step:", state["step"])
print("The agent remembers Ana and order 1234 — no need to ask again.")
Try it yourself
Write down three things your agent should remember in one conversation.
Check
What is session state?
The memory of one conversation: order number, what was said, what step you are on.
How is state stored?
As simple key-value pairs, like a dictionary.
35. State-driven patterns
What it is
A state-driven pattern is a rule that says: what the agent does next depends on the state. Example: if state['step'] is 'waiting for order number', ask for the order number. If state['step'] is 'order found', offer a fix. The state drives the behavior, like a traffic light drives cars. Patterns like this keep the agent on track, even in long conversations. Write the states first, then the rules for each state.
Why it matters
If the agent does not know what step it is on, it wanders. State-driven patterns keep it on the road.
State drives the next step (offline practice)
def next_action(state):
step = state.get("step", "start")
if step == "start":
return "Ask for the order number."
if step == "order_found":
return "Offer a fix: new date or refund."
if step == "done":
return "Say goodbye and close the chat."
return "Ask what else they need."
print(next_action({"step": "start"}))
print(next_action({"step": "order_found"}))
print(next_action({"step": "done"}))
Try it yourself
Write the states for your agent's job, and one action for each state.
Check
What is a state-driven pattern?
A rule that says: what the agent does next depends on the state it is in.
Why use states instead of one long instruction?
Because the state keeps the agent on track, even in long conversations.
36. State persistence
What it is
State persistence means the memory survives after the conversation ends. Session state lives only during one chat. Persistent state is saved — in a file, a database, or Memory Bank — so the next conversation can use it. Example: the customer comes back a week later, and the agent remembers their last order and their preferences. Persistence is what turns one good chat into a long relationship. But save only what you need, and follow privacy rules.
Why it matters
Memory that disappears after each chat is a stranger every time. Persistence makes the agent remember the customer.
Save state, load it later (offline practice)
import json
# Save the state (persistence):
state = {"customer": "Ana", "last_order": "1234", "prefers": "morning delivery"}
with open("/tmp/agent_state.json", "w") as f:
json.dump(state, f)
# Later, in a new conversation, load it back:
with open("/tmp/agent_state.json") as f:
loaded = json.load(f)
print("Welcome back,", loaded["customer"], "— last order:", loaded["last_order"])
Try it yourself
Run the code above, then change the customer name and run it again. What does it remember now?
Check
What is state persistence?
Saving memory so it survives after the conversation ends, and can be used next time.
What should you not save?
Private data you do not need, and anything the privacy rules forbid.
37. Build stateful agents
What it is
A stateful agent is an agent that uses state in every step: it reads state before answering, updates state after acting, and saves state when the conversation ends. Build it in three steps. 1) Decide what to remember: order number, step, preferences. 2) Update the state after each tool call. 3) Save the state, and load it at the start of the next conversation. Test it: talk to the agent, stop, start again, and check that it remembers.
Why it matters
A stateless agent forgets. A stateful agent remembers, and customers can tell the difference.
A stateful agent, end to end (offline practice)
class StatefulAgent:
def __init__(self):
self.state = {}
def handle(self, message):
if "order" in message and "1234" in message:
self.state["order_number"] = "1234" # update state
return "Found order 1234. It arrives Friday."
if "my order" in message and "order_number" in self.state:
return f"Your order {self.state['order_number']} arrives Friday."
return "Please share your order number."
agent = StatefulAgent()
print(agent.handle("my order 1234 is late"))
print(agent.handle("when does my order arrive?")) # no order number needed now
Try it yourself
Talk to the agent above twice. What does it remember the second time?
Check
What is a stateful agent?
An agent that reads state before answering, updates it after acting, and saves it for next time.
What are the three steps to build one?
Decide what to remember, update state after each tool call, save and load it.
38. Design hierarchical architectures
What it is
A hierarchical architecture is a tree of agents: one root agent at the top, and specialist agents below it. The root agent understands the request and passes it to the right specialist. Example: root_agent receives 'my order is late', passes it to the support agent, which passes the booking to the booking agent. This is called a multi-agent tree. Each agent does one job well, and the root coordinates. It is easier to test, fix, and grow than one giant agent.
Why it matters
One giant agent is hard to fix. A tree of small agents is easy to grow: add a new branch when you need a new skill.
A multi-agent tree (offline practice)
class Agent:
def __init__(self, name, children=None):
self.name, self.children = name, children or {}
def handle(self, task):
if task in self.children:
return self.children[task].handle(task)
return f"[{self.name}] handling: {task}"
booking = Agent("booking_agent")
support = Agent("support_agent", {"book": booking})
root_agent = Agent("root_agent", {"order": support, "book": booking})
print(root_agent.handle("order"))
print(root_agent.handle("book"))
Try it yourself
Draw the tree for your agents: root at the top, specialists below. Who calls whom?
Check
What is a hierarchical architecture?
A tree of agents: one root agent at the top, specialist agents below it, each doing one job.
Why is a tree better than one giant agent?
It is easier to test, fix, and grow — add a new branch when you need a new skill.
39. Implement workflow logic
What it is
Workflow logic is the code that decides the order of work: what happens first, what happens next, and what happens if something fails. Common patterns: sequence (do A, then B, then C), parallel (do A and B at the same time), and loop (repeat until done). In ADK, workflow agents run these patterns. Example: first look up the order, then check the courier, then offer a fix — that is a sequence. If the lookup fails, stop and ask a human — that is the failure rule. Write the logic down before you code it.
Why it matters
A workflow without logic is a hope. Logic is what makes the steps happen in the right order, every time.
Sequence, parallel, loop (offline practice)
def sequence(steps):
for step in steps:
print(f" do: {step}")
return "sequence done"
print(sequence(["look up order", "check courier", "offer a fix"]))
# Parallel: independent steps, done together.
tasks = ["check stock", "check courier"]
print("parallel:", ", ".join(tasks), "— at the same time")
# Loop: repeat until done.
for attempt in range(1, 4):
print(f"loop attempt {attempt}: try to reach the courier")
Try it yourself
Write the workflow for your agent's main job, using sequence, parallel, or loop.
Check
What are the three common workflow patterns?
Sequence (one after another), parallel (at the same time), and loop (repeat until done).
What should the workflow say about failure?
What happens if a step fails — for example, stop and ask a human.
40. Evaluate deployment environments
What it is
Before you deploy, evaluate the environment: where will the agent run? Ask four questions. 1) Traffic: how many users, and when? 2) Cost: what will it cost per month? 3) Control: how much control do you need over the machines? 4) Rules: what do security and privacy require? Cloud Run fits spiky traffic and low cost. Vertex AI Agent Engine fits managed, Google-run agents. GKE fits full control and big, steady traffic. Pick the environment that fits the answers, not the one that sounds best.
Why it matters
The wrong environment costs money or breaks under load. Four questions first, then choose.
Score the environments (offline practice)
def score(env, traffic, control):
scores = {"Cloud Run": 0, "Vertex AI Agent Engine": 0, "GKE": 0}
if traffic == "spiky":
scores["Cloud Run"] += 2
if traffic == "steady and big":
scores["GKE"] += 2
if control == "full":
scores["GKE"] += 2
if control == "let Google run it":
scores["Vertex AI Agent Engine"] += 2
return scores
print(score("x", "spiky", "let Google run it"))
print(score("x", "steady and big", "full"))
Try it yourself
Answer the four questions for your agent: traffic, cost, control, rules. Which environment fits?
Check
What four questions should you ask before deploying?
Traffic, cost, control, and security/privacy rules.
Which environment fits spiky traffic?
Cloud Run — it runs when needed and you pay only for what you use.
41. Configure security and observability
What it is
Security means: who can use the agent, what data it can see, and what it can change. Use keys and permissions, keep secrets in .env or a secret store, and never let the agent delete data or spend money without approval. Observability means: you can see what the agent does. Keep logs of every step, every tool call, and every decision. If something goes wrong, the logs tell you where and why. Security without observability is blind; observability without security is open.
Why it matters
You cannot fix what you cannot see, and you cannot trust what is not protected. Both are needed before production.
Log every step (offline practice)
import datetime
log = []
def log_step(agent, action):
entry = f"{datetime.datetime.now().isoformat()} [{agent}] {action}"
log.append(entry)
print(entry)
log_step("support_agent", "looked up order 1234")
log_step("support_agent", "offered new date Friday")
print("Log entries saved:", len(log))
Try it yourself
Add a log line to the agent code from Course 5, so every step is recorded.
Check
What is observability?
Being able to see what the agent does: logs of every step, tool call, and decision.
What is the first security rule for an agent?
Keep secrets safe, use permissions, and never let the agent delete data or spend money without approval.
42. Deploy to production
What it is
Deploying to production means putting your agent where real users can reach it, and where it stays up. Steps: 1) Test it locally with adk web. 2) Put it in a container (a sealed box with everything it needs). 3) Push the container to the cloud. 4) Start it on your chosen environment — Vertex AI Agent Engine, Cloud Run, or GKE. 5) Check it works with a real request. 6) Watch the logs. Deployment is not the end: it is the start of running the agent for real users.
Why it matters
Local testing is practice. Production is the real game: real users, real data, real problems.
Deployment checklist, as code (offline practice)
checklist = [
"tested locally with adk web",
"container built and pushed",
"started on Cloud Run / Vertex AI Agent Engine / GKE",
"real request tested",
"logs being watched",
]
for i, item in enumerate(checklist, 1):
print(f"[ ] {i}. {item}")
Try it yourself
Tick the steps you have already done for a project, and circle the next one.
Check
What are the steps to deploy an agent?
Test locally, put it in a container, push it to the cloud, start it, test with a real request, watch the logs.
What is a container, in short?
A sealed box with the agent and everything it needs to run.
43. Production session state
What it is
In production, session state must work for many users at the same time, and it must not mix them up. Each user gets their own session, with their own state. The state is stored outside the agent's memory — in a database or a session service — so it survives restarts and works across servers. Rule: never store one user's state where another user can see it. Test with two users at once, and check that their states stay separate.
Why it matters
Mixing up users is one of the worst production bugs. Separate sessions, separate state, always.
Two users, two sessions (offline practice)
sessions = {}
def get_session(user_id):
if user_id not in sessions:
sessions[user_id] = {"user": user_id, "order_number": None}
return sessions[user_id]
ana = get_session("ana")
ana["order_number"] = "1234"
ben = get_session("ben")
ben["order_number"] = "5678"
print("Ana:", sessions["ana"])
print("Ben:", sessions["ben"])
print("Separate:", sessions["ana"]["order_number"] != sessions["ben"]["order_number"])
Try it yourself
Run the code above. What would happen if both users shared one session dictionary?
Check
What is production session state?
Each user's own session memory, stored outside the agent, so it survives restarts and works across servers.
Why must sessions stay separate?
So one user's data never leaks into another user's conversation.
44. Cross-session memory
What it is
Cross-session memory is memory across conversations: what the agent remembers about a user from last week, not just from this chat. This is where Memory Bank comes in: a long-term memory store for agents. It keeps facts like 'Ana prefers morning delivery' and 'Ana's last order was 1234', and the agent can read them in a new session. Session state is short-term. Memory Bank is long-term. Together they make the agent feel like it knows the customer.
Why it matters
Short-term memory helps one chat. Long-term memory builds a relationship over months.
Memory Bank, in plain code (offline practice)
class MemoryBank:
"""Long-term memory: facts that survive across sessions."""
def __init__(self):
self.facts = {}
def remember(self, user, fact):
self.facts.setdefault(user, []).append(fact)
def recall(self, user):
return self.facts.get(user, [])
bank = MemoryBank()
bank.remember("Ana", "prefers morning delivery")
bank.remember("Ana", "last order was 1234")
print("New session. What do we know about Ana?")
print(bank.recall("Ana"))
Try it yourself
Write three facts about a customer that your agent should remember across sessions.
Check
What is cross-session memory?
Memory across conversations — what the agent remembers about a user from last time.
What is Memory Bank?
A long-term memory store for agents, holding facts that survive across sessions.
45. Deployment options
What it is
Your deployment options, in one place: Vertex AI Agent Engine (managed runtime, Google runs it), Cloud Run (serverless, pay per use), and GKE (custom infrastructure, full control). Choose by traffic, cost, control, and rules — the four questions from Course 9. You can also start on one and move later: the agent code stays the same, only the deployment changes. Many teams start on Cloud Run, then move to Vertex AI Agent Engine when they need managed scale.
Why it matters
There is no single best option. There is only the best option for your traffic, cost, and control needs.
Pick an option (offline practice)
def deploy_option(traffic, control):
if control == "full":
return "GKE"
if traffic == "spiky":
return "Cloud Run"
return "Vertex AI Agent Engine"
print(deploy_option("spiky", "some"))
print(deploy_option("steady", "full"))
print(deploy_option("steady", "some"))
Try it yourself
Pick an option for your agent and write down why, using traffic and control.
Check
What are the three deployment options?
Vertex AI Agent Engine, Cloud Run, and GKE.
Can you change deployment option later?
Yes. The agent code stays the same; only where it runs changes.
46. Components of generative AI agents
What it is
Generative AI agents are built from components that work together: a model (Gemini) that understands and generates, tools that act, memory that remembers, orchestration that plans, and a runtime that runs it all. Each component alone is useful. Together they make a system that can do real work: read a request, plan, use tools, remember, and finish the job. If you know the components, you can build any agent, because every agent is the same parts in a new arrangement.
Why it matters
Components are Lego bricks. Learn the bricks once, and you can build many different agents.
The components, together (offline practice)
components = {
"model": "Gemini — understands and generates",
"tools": "look up orders, send messages",
"memory": "session state + Memory Bank",
"orchestration": "plan the steps, coordinate agents",
"runtime": "Cloud Run / Vertex AI Agent Engine",
}
for name, job in components.items():
print(f"{name}: {job}")
Try it yourself
Write down the five components for your own agent, with one example for each.
Check
What are the components of a generative AI agent?
Model, tools, memory, orchestration, and runtime, working together.
Why learn components instead of one finished agent?
Because every agent is the same parts in a new arrangement — learn the parts once, build many agents.
47. Combine components to build powerful solutions
What it is
Combining components means putting them together to solve a real problem. Example: a customer writes in. The model understands the request. Memory recalls the customer. Tools look up the order. Orchestration plans the fix. The runtime keeps it running. The power is not in one component — it is in how they work together. Start with the problem, pick the components you need, connect them, and test the whole flow end to end.
Why it matters
A powerful solution is not a powerful part. It is parts working together, in the right order.
Combine the parts, step by step (offline practice)
def solve(request, memory, tools):
print(f"1. Model understands: {request}")
print(f"2. Memory recalls: {memory}")
print(f"3. Tools act: {tools}")
print("4. Orchestration: put the answer together.")
return "Solved: new delivery date is Friday."
print(solve("my order is late", "Ana prefers mornings", "look_up_order"))
Try it yourself
Pick a problem at your work and write down which components it needs, in order.
Check
Where does the power of a solution come from?
From the components working together, in the right order — not from one powerful part.
What should you start with when combining components?
The problem. Then pick the components you need, connect them, and test end to end.
48. Use Google Cloud's gen AI products
What it is
Google Cloud's gen AI products are the building blocks you have already met: Gemini (the model), Gemini Enterprise (the platform to build agents), Vertex AI Agent Engine (managed runtime), Cloud Run (serverless), and MCP (the standard plug for tools). You do not need to use all of them. Pick the ones your solution needs: Gemini for thinking, Gemini Enterprise for building, Agent Engine or Cloud Run for running, MCP for connecting tools. Each product does one job well.
Why it matters
Use the right product for each job. A hammer is not a screwdriver, even if both are tools.
Match the product to the job (offline practice)
products = {
"Gemini": "the model — thinks and generates",
"Gemini Enterprise": "the platform — build agents",
"Vertex AI Agent Engine": "managed runtime — Google runs it",
"Cloud Run": "serverless — pay per use",
"MCP": "standard plug — connect tools",
}
for product, job in products.items():
print(f"{product}: {job}")
Try it yourself
For your agent, write down which Google Cloud product does each job: think, build, run, connect.
Check
Which product is the model?
Gemini.
Which products run the agent?
Vertex AI Agent Engine (managed) or Cloud Run (serverless).
49. Lead and manage organizational transformation with gen AI
What it is
Leading transformation means helping a whole company change how it works with gen AI. It is not only about technology. It is about people: explain what agents do, start with small wins, train staff, listen to worries, and measure results. Change fails when people are surprised. It works when people are involved early, see a small success, and trust the process. Start small, prove value, then grow.
Why it matters
Technology is the easy part. People are the hard part — and the part that decides if transformation works.
Start small, prove value, grow (offline practice)
steps = [
"1. Pick ONE small job with a clear KPI",
"2. Build ONE agent for it",
"3. Measure the result for 2 weeks",
"4. Show the result to the team",
"5. Grow to the next job",
]
for step in steps:
print(step)
Try it yourself
Write down one small job at your work that could be the first win, and its KPI.
Check
What is the first step of organizational transformation?
Pick one small job with a clear KPI, and build one agent for it.
Why start small?
So people see a real success early, trust the process, and support the next step.
50. Augmentation vs automation
What it is
Augmentation means AI helps a human do their job better: the human stays in charge, and AI does the heavy work. Automation means AI does the whole job alone, with no human involved. Both are useful, for different jobs. Augmentation fits jobs where judgment matters: the agent drafts, the human decides. Automation fits high-volume, rule-based jobs: the agent does it all, the same way, every time. The question is not 'which is better?' but 'which fits this job?'
Why it matters
Humans and AI are a team. Augmentation keeps the human in the team. Automation removes the human — only do that when the job is safe to remove them from.
Augment or automate? (offline practice)
def decide(job_needs_judgment):
if job_needs_judgment:
return "AUGMENT: agent drafts, human decides."
return "AUTOMATE: agent does the whole job alone."
print(decide(True)) # approve a refund
print(decide(False)) # send a delivery update
Try it yourself
Name one job at your work to augment, and one to automate. Why is each the right choice?
Check
What is augmentation?
AI helps a human do their job better — the human stays in charge.
What is automation?
AI does the whole job alone, with no human involved.
51. Gen AI for strategic cognitive enhancement
What it is
Strategic cognitive enhancement means using Gen AI to make human thinking better, not to replace it. Examples: the agent summarizes a long report so a manager can decide faster; it lists options with pros and cons so a team can choose well; it spots patterns in data a human would miss. The human still decides — but with better information, faster. The agent is a thinking partner, not a replacement thinker.
Why it matters
The best decisions come from a human with good information. Gen AI gives the information; the human makes the call.
A thinking partner (offline practice)
def enhance(decision, options):
print(f"Decision: {decision}")
for name, pro, con in options:
print(f" Option {name}: pro — {pro}; con — {con}")
print("The human decides. The agent only prepared the options.")
enhance("new delivery date", [("Friday", "fast", "costs more"), ("Monday", "cheap", "customer waits")])
Try it yourself
Pick a decision at your work and write down two options with one pro and one con each.
Check
What is strategic cognitive enhancement?
Using Gen AI to make human thinking better — better information, faster — while the human still decides.
Who makes the final decision?
The human. The agent prepares options; the human chooses.
52. Identify and automate high-volume, rule-based tasks
What it is
High-volume, rule-based tasks are jobs that happen often and always follow the same rules: send a delivery update, reset a password, check a form is complete. These are the best jobs to automate, because the rules are clear, the volume is high, and a human adds little by doing them by hand. To find them: list the jobs your team does every day, count how often each happens, and check if the rules are clear. High count + clear rules = automate first.
Why it matters
Automate the boring, repeated, clear jobs first. Keep the human for the rare, unclear, important ones.
Find the best task to automate (offline practice)
tasks = [
("send delivery update", 200, True), # name, times per week, rules clear?
("approve a refund", 5, False),
("check a form is complete", 120, True),
]
for name, times, clear in tasks:
if times >= 50 and clear:
print(f"AUTOMATE FIRST: {name} ({times}/week, clear rules)")
else:
print(f"Keep human: {name} ({times}/week)")
Try it yourself
List three jobs your team does every week, with how often each happens and whether the rules are clear.
Check
What makes a task a good candidate for automation?
High volume and clear rules — it happens often and always follows the same steps.
What should stay with a human?
Rare, unclear, or important jobs where judgment matters.
53. Implement Human-in-the-Loop frameworks
What it is
A Human-in-the-Loop (HITL) framework is a set of rules that decides when a human must check the agent's work. The loop works like this: the agent does the work, then stops at a checkpoint for anything risky — money, private data, or a decision that is hard to undo. A human approves or rejects, and the agent continues. Without HITL, the agent can make an expensive mistake alone. With HITL, the human stays in control of what matters, and the agent does the rest fast.
Why it matters
HITL is the safety net. The agent runs fast on its own, and a human catches the risky parts.
Human-in-the-Loop, as code (offline practice)
def needs_human(action):
risky = ["refund", "delete", "share private data", "send payment"]
return any(word in action for word in risky)
def run_agent(action):
if needs_human(action):
return f"STOP — human approval needed before: {action}"
return f"Done automatically: {action}"
print(run_agent("look up order 1234"))
print(run_agent("give a refund of $50"))
print(run_agent("send delivery update"))
Try it yourself
Write down three actions your agent should do alone, and three that need a human check.
Check
What is a Human-in-the-Loop framework?
Rules that decide when a human must check the agent's work before it continues.
When must a human step in?
For risky actions: money, private data, or decisions that are hard to undo.
54. Capstone: a production-ready multi-agent system
What it is
Now put it all together. Build a production-ready multi-agent system for customer support. Three agents: a support agent (talks to the customer), a research agent (looks up orders and couriers), and a booking agent (offers dates). The root_agent coordinates them. Add: session state (remember the order number), Memory Bank (remember the customer), tools (look up, book, send), structured outputs (answers in a fixed format), evaluation (test cases with scores), and a Human-in-the-Loop checkpoint before any refund. Then a deployment checklist: container, Cloud Run or Vertex AI Agent Engine, logs, and a human approval step for risky actions. This capstone is extra practice, clearly marked — it uses everything in the program, in one system.
Why it matters
The capstone is the proof. If you can build this, you can build a real production agent system.
The whole system, in one file (offline practice)
class Agent:
def __init__(self, name, job):
self.name, self.job = name, job
def run(self, task):
return f"[{self.name}] {self.job}: {task}"
class MemoryBank:
def __init__(self):
self.facts = {}
def recall(self, user):
return self.facts.get(user, [])
def needs_human(action):
return "refund" in action
# The multi-agent tree:
support = Agent("support_agent", "talk to the customer")
research = Agent("research_agent", "look up the order")
booking = Agent("booking_agent", "offer a new date")
bank = MemoryBank()
bank.facts["Ana"] = ["prefers morning delivery"]
print("Memory:", bank.recall("Ana"))
print(support.run("my order is late"))
print(research.run("order 1234 is with the courier"))
print(booking.run("new date: Friday 10:00"))
print("Refund?", "STOP — human approval needed" if needs_human("refund $50") else "go")
Try it yourself
Build the three agents above, then add one more: a billing agent. What is its job, and who calls it?
Check
What does the capstone system include?
Support, research, and booking agents, a root agent, session state, Memory Bank, tools, structured outputs, evaluation, and a Human-in-the-Loop checkpoint.
Where does it deploy?
To Cloud Run or Vertex AI Agent Engine, as a container, with logs and a deployment checklist.
55. Final checklist
What it is
You have finished the lessons. Now check you can do the work. Tick each item when you can do it without looking at the page. If you cannot do one, go back to that course and try it again.
Why it matters
Finishing means you can do it, not just that you read it. The checklist proves you can do it.
Final checklist
[ ] I can explain what an AI agent is, in plain words
[ ] I can name the four parts of agent architecture
[ ] I can map an agent to a business KPI
[ ] I can explain ADK and Gemini Enterprise
[ ] I can build a first agent: model, name, description, instruction
[ ] I can run an agent with adk web, adk run, and adk api_server
[ ] I can write a multi-section instruction with boundaries and examples
[ ] I can give an agent built-in, MCP, and custom function tools
[ ] I can build a stateful agent with session state and Memory Bank
[ ] I can design a multi-agent tree and its workflow logic
[ ] I can choose a deployment: Vertex AI Agent Engine, Cloud Run, or GKE
[ ] I can deploy an agent and keep sessions separate
[ ] I can explain augmentation vs automation and Human-in-the-Loop
Try it yourself
Tick each item you can do without looking at the page. Go back to any course you cannot tick yet.
Check
How do I know I am ready?
When you can tick every item without looking at the page.
What if I cannot tick one item?
Go back to that course and try its task again.
56. What to do next
What it is
Next steps, in plain words: 1) Do the capstone above, end to end. 2) Set up a real Google Cloud account and try the ADK with a real Gemini API key, on a small test project — remember it can cost money, so set a budget. 3) In this repo, continue with the Local-First AI Agents, Ready for the Cloud workshop, then the Agent Workflows as Graphs workshop. 4) Keep a notebook of agents you built, what worked, and what failed. 5) Use one agent at work every week — that habit turns a course into a skill.
Why it matters
Learning stops when practice stops. One agent a week keeps the skill alive.
Your next 7 days
Day 1: Do the capstone on this page.
Day 2: Install ADK in a virtual environment.
Day 3: Build your first real agent with adk web.
Day 4: Add one tool to it.
Day 5: Add session state.
Day 6: Start the Local-First AI Agents workshop.
Day 7: Write down what worked and what failed.
# Remember: real Google Cloud use can cost money. Set a budget first.
Try it yourself
Write down your plan for the next 7 days in your notebook.
Check
What is the best next step after this program?
Do the capstone, then build one real agent with ADK and a Gemini API key, on a small test project.
Which workshop in this repo comes next?
Local-First AI Agents, Ready for the Cloud, then Agent Workflows as Graphs.
Try the agent here
Type a request, then press the button. A simulated Gemini Enterprise agent shows: its instruction, the tools it uses, what it remembers in session state and Memory Bank, and its answer. If the action is sensitive, like a refund, it stops for a human approval.