Google ADK with Python for AI Agents
Build a bounded support assistant with Google's Agent Development Kit (ADK) in Python: it answers from public product docs and reads synthetic ticket status through typed, read-only tools. Along the way you learn when a direct model call, a deterministic workflow, a single agent or several agents fits the job. The path pins one stable ADK 2.x release, uses the matching docs and labels preview features. Modules 1–2 are beginner ADK, modules 3–6 are intermediate agent building, and modules 7–10 cover advanced evaluation, deployment and architecture. You should know Python functions, type hints and packages, HTTP and JSON, Git, and have made at least one model API call; Python from Zero and AI Engineering with Python cover those. Every exercise has a local mock-model or fixture path, so a paid Gemini or Google Cloud account is optional, and the managed runtime topic can be done as a design-only comparison.
What you will be able to do
- Build, run and debug an ADK agent locally with the CLI, web UI and event traces
- Design typed, read-only tools and per-user session boundaries with clear retention
- Choose between a model call, a workflow, a single agent and delegation for a given requirement
- Evaluate answers and tool trajectories with fixtures, live-model checks and CI gates
- Serve an authenticated, observable agent endpoint on Cloud Run with a rollback plan
Roadmap
Bar length shows each module's share of study time.
- 16h 30m3 topics
Agents, workflows and the local development loop
Beginner. When an agent is the right tool, a pinned ADK setup, and the first traced request. Prerequisites: Python packages, HTTP and JSON, and one model API call.
Show topicsNot startedChoose between a single model call, a deterministic workflow and a tool-using agent for a requirement and justify it on reliability, cost and latency.
- Compare the three shapes on one task
- Weigh reliability against autonomy
- Estimate cost and latency per shape
- Spot when autonomy is unnecessary
- Write a one-line shape decision
Install a pinned ADK version in a virtual environment, keep model credentials out of source and run a small agent with adk run and adk web.
- Pin google-adk in a virtual environment
- Load credentials from a .env outside Git
- Lay out the agent package
- Run the agent with adk run and adk web
- Note names that changed from older examples
Follow one request through instructions, runtime, model call, events and final response, and read it in the local debug trace.
- Write clear agent instructions
- Follow the request through the runtime
- Read events in the web UI trace
- Find the final response event
- Swap in a mock model for repeatable runs
- 28h3 topics
Runners, events and session lifecycle
Beginner. How the runner drives an agent, what sessions, state and memory hold, and how to keep users apart.
Show topicsNot startedExplain the roles of app, agent, runner and event in the pinned release and point to where execution starts, where the session enters and how final output is chosen.
- Name the app, agent and runner roles
- Start a run with a user and session ID
- Read the event stream
- Pick out the final response
- Compare this with older Runner examples
Put each piece of agent data in the right place: session history, temporary context, state, long-term memory or artifacts, and choose in-memory or persistent services.
- Separate history from state
- Use state key prefixes and scopes
- Know when memory is needed
- Store files as artifacts
- Compare in-memory and database session services
Derive the user ID from authentication, scope sessions per user, apply retention and deletion, and prove isolation with two synthetic users.
- Take the user ID from the auth layer
- Scope sessions per user
- Set retention and delete sessions
- Test isolation with two synthetic users
- Record what the check proved
- 39h3 topics
Structured tools and grounded behavior
Intermediate. Typed read-only function tools, contract tests outside the model, and grounded lookups with source IDs.
Show topicsNot startedDefine a typed, read-only ticket-status tool with a clear docstring, structured input and output, and predictable errors over local records.
- Type parameters and return values
- Write a docstring the model can use
- Return structured results
- Report errors as data
- Read from local synthetic tickets
Validate arguments and authorisation in code, not in the prompt, and test tools with timeouts, deterministic fakes, typed errors and call budgets.
- Validate arguments in the tool
- Check authorisation from session state
- Add timeouts and call budgets
- Fake dependencies in pytest
- Log each tool call
Add a small grounded knowledge lookup that returns source IDs, says when it does not know, and keeps tool data inside the app's trust boundary.
- Index a small public doc set
- Return source IDs with each passage
- Answer unknown when nothing matches
- Keep retrieved text inside the app
- Show citations in the reply
Module resources:ADK: custom tools ↗ - 49h3 topics
Predictable workflows and agent coordination
Intermediate. Fixed workflows, delegation to specialised agents, and hard limits on steps, time and tool calls.
Show topicsNot startedBuild fixed routing and data handoffs with the workflow primitives in the pinned release, including sequential, parallel and bounded loop steps.
- Chain steps with a sequential workflow
- Fan out with a parallel workflow
- Bound a loop with max iterations
- Pass data between steps through state
- Use graph routes where supported
Compare routing, specialised sub-agents and direct tool calls, show when delegation adds cost, and keep handoff context narrow.
- Route with a coordinator agent
- Wrap an agent as a tool
- Compare with one agent and more tools
- Keep handoff context narrow
- Count the extra model calls
Limit steps, elapsed time and tool calls per run, and show a fallback and human handoff using synthetic timeouts and empty results.
- Set a maximum number of calls
- Add a deadline per run
- Stop on repeated tool failures
- Fall back to a safe reply
- Hand off to a human with context
Module resources:ADK: workflows ↗ - 58h 30m3 topics
API, streaming, MCP and A2A
Intermediate. Serve the agent over HTTP with streamed events, connect an MCP server, and see where A2A fits.
Show topicsNot startedExpose the agent through the ADK API server or a small FastAPI wrapper with authenticated session creation, streamed events, errors and disconnect handling.
- Start the ADK API server
- Wrap the runner in FastAPI
- Create sessions for the signed-in user
- Stream events to a client
- Handle errors and disconnects
Connect a local read-only MCP server, restrict which tools are exposed, and replace it with a mock in tests.
- Run a local MCP server
- Attach it with an MCP toolset
- Filter the exposed tools
- Keep permissions read-only
- Mock the server in tests
Explain A2A concepts, contrast them with app-to-tool connections, and optionally call a fixed, trusted demo peer.
- Read an agent card
- Compare A2A with MCP
- Expose an agent over A2A
- Consume a trusted demo peer
- Decide when A2A is worth it
- 68h 30m3 topics
Bound application actions
Intermediate. Keep untrusted text from changing what the agent may do, require approval for writes, and trace without leaking data.
Show topicsNot startedSeparate developer instructions from user input, tool data and retrieved text, and prove with benign conflict fixtures that tools and data access stay scoped.
- Label each source of text
- Keep scope checks in code
- Screen inputs with callbacks
- Write benign conflict fixtures
- Prove tool access did not widen
Require human confirmation for external actions by returning dry-run proposals with audit evidence and keeping execution rights separate.
- Model writes as dry-run proposals
- Ask for confirmation on the tool
- Record who approved what
- Keep execution rights separate
- Resume after approval
Trace model and tool calls with execution IDs, tool latency, errors and cost while redacting private content.
- Turn on ADK traces
- Tag spans with execution IDs
- Measure tool latency and errors
- Record token use and cost
- Redact private content
- 78h 30m3 topics
Verify outputs and trajectories
Advanced. Evaluation datasets, tool-trajectory scoring and CI gates that separate fixtures from live-model checks.
Show topicsNot startedWrite representative cases for answer correctness, grounding, escalation, denied tools, state isolation and fallback.
- Cover the main user intents
- Add grounding and citation cases
- Add escalation and denied-tool cases
- Add isolation and fallback cases
- Store cases as eval sets
Measure tool choice, arguments, step limits, answer quality, latency and token use, accepting more than one valid trajectory where it makes sense.
- Score tool selection and arguments
- Allow several valid trajectories
- Check step limits were respected
- Grade the final answer
- Track latency and tokens
Split fast deterministic tests from optional live-model checks, set thresholds for variable results and triage regressions with CI evidence.
- Run fixture tests on every commit
- Schedule live-model checks
- Set thresholds for variability
- Triage a failing case
- Keep CI evidence
Module resources:ADK: evaluation ↗ - 89h 30m3 topics
From a local agent to a maintained service
Advanced. Deploy one authenticated Cloud Run service, compare the managed agent runtime, and plan for failures.
Show topicsNot startedDeploy the agent as one authenticated Cloud Run service with its own service identity, managed credentials, health checks, persistent sessions and rollback.
- Build and deploy the service
- Require authenticated invocations
- Run as a dedicated service account
- Store sessions outside the container
- Roll back to a previous revision
Compare local hosting, Cloud Run and Google's managed Agent Runtime on regions, pricing, state features and prerequisites, and record a choice.
- List what each option manages
- Check regional availability
- Compare pricing and quotas
- Compare session and memory features
- Record the choice and its limits
Plan budgets, rate limits, timeouts, streaming troubleshooting, version rollout and retention, and run an incident drill for tool and model failures.
- Set budgets and rate limits
- Tune timeouts end to end
- Troubleshoot broken streams
- Roll out a new version gradually
- Drill a tool and model outage
- 96h2 topics
Review real design trade-offs
Advanced. State topology across instances and the cost and latency of routing, tools and retrieval, argued from traces.
Show topicsNot startedCompare single- and multi-instance execution, handle concurrency and duplicate requests, choose durable state and record the decision.
- Compare one instance with many
- Handle concurrent turns in a session
- Make duplicate requests safe
- Pick a durable session store
- Write a decision record
Analyse example traces to compare the cost and latency of routing, sequential or parallel tools, retrieval depth and cache boundaries.
- Read cost and latency from traces
- Compare sequential and parallel tools
- Tune retrieval depth
- Use context caching
- Remove a routing hop
Module resources:Invicly: System Design ↗ - 1020h3 topics
Support assistant with evaluated behavior
Advanced. Define, build and release a read-only support assistant with mock tickets, an evaluation matrix and a rollback guide.
Show topicsNot startedDefine the allowed tools, session rules, response schema, escalation rules, budget and evaluation targets for the support assistant.
- List allowed read-only tools
- Define session and user scope
- Write the response schema
- Set escalation and stop rules
- Set budget and evaluation targets
Wire a public-doc lookup, a read-only mock ticket lookup, per-user state and an authenticated API with structured events, plus local stubs and a mock model.
- Build the doc lookup with source IDs
- Build the mock ticket tool
- Scope state per user
- Serve an authenticated streaming API
- Add a mock model and local stubs
- Build a workflow alternative to compare
Run fixture and regression tests, demonstrate denial and fallback, publish redacted traces and write the deployment and rollback guide.
- Run the evaluation matrix
- Demonstrate denial and fallback
- Publish redacted traces
- Draw the request and isolation diagrams
- Write the deployment and rollback guide
Module resources:ADK Python source ↗