Running and Deploying Agents with Google ADK 2.0
Google ADK 2.0
Serve, observe, evaluate and deploy ADK agents with runtime controls, context caching, traces, simulated users, Cloud Run and Agent Runtime.
- Prerequisites
- Python, HTTP and JSON, and the Building Agents with Google ADK 2.0 course.
- Duration
- about 8 hours of reading
- Cost
- Free, no sign-up
What you'll learn
- Serve an agent over HTTP, tune runs with RunConfig, and resume, rewind or migrate sessions.
- Run an agent from Pub/Sub and Eventarc deliveries behind an auth check.
- Reduce long-session context with caching and compaction, store artifacts and call REST APIs from an OpenAPI spec.
- Trace runs with OpenTelemetry, test against simulated users, and put identity, policy and confirmation guardrails around tools.
- Deploy an agent to Cloud Run and Agent Runtime with the agents-cli.
Lessons
Module 1 · 6 lessonsRun agents and manage sessions
Serve agents over HTTP, configure runs, resume sessions and handle event triggers.
Serve an agent over HTTP and drive it from the CLIRead
Serve a Google ADK 2.0 agent with adk api_server, call /run and /run_sse from a Python client, and script adk run with replay files and JSONL output.
Configure an ADK Agent with YAMLRead
Define a Google ADK 2.0 agent in root_agent.yaml, load it with from_config, and test which YAML the loader and the Visual Builder save endpoint refuse.
Tune a run with RunConfig and read the event loopRead
Set Google ADK 2.0 RunConfig per run to tag events, cap model calls and history, and time out the model, then trace when the Runner commits state.
Resume an interrupted agent runRead
Make a Google ADK 2.0 app resumable, finish a run whose process died inside a tool, and keep the retried tool from filing a duplicate issue.
Rewind a session and migrate its databaseRead
Undo turns in a Google ADK 2.0 session with rewind_async, see what it restores, and migrate a legacy pickle session database with adk migrate session.
Run an agent from event triggersRead
Start an ADK agent from Pub/Sub and Eventarc request bodies, authenticate local trigger calls, and deduplicate the review tool’s writes.
Module 2 · 2 lessonsManage context and artifacts
Compact conversation history, cache context, and save and load versioned files.
Keep long sessions in budget with compaction and context cachingRead
Cache the docs assistant's manual with ContextCacheConfig, summarize old turns with EventsCompactionConfig, and measure both in Gemini usage metadata.
Save and load files with ArtifactsRead
Store an uploaded ship.toml and versioned reviews as ADK artifacts on disk, load files only when needed, and see which survive a restart.
Module 3 · 3 lessonsConnect APIs and tools
Call authenticated REST APIs, run tools concurrently and expose an agent through MCP.
Call a REST API from an OpenAPI spec, with authenticationRead
Turn a release API's OpenAPI spec into ADK tools, send its API key outside the prompt, keep the agent read-only, and debug wrong keys.
Make tools parallel-readyRead
Measure how ADK runs several function calls from one Gemini response, and make them overlap with async tools or a tool thread pool.
Expose the docs assistant as an MCP serverRead
Serve the docs assistant as one MCP tool with to_mcp_server, call it from the MCP SDK and another ADK agent, and fix key and timeout failures.
Module 4 · 5 lessonsEvaluate, trace and apply guardrails
Inspect traces, test simulated users and tool failures, evaluate responses and apply tool guardrails.
Trace and measure agent runs with OpenTelemetryRead
Record ADK spans and GenAI metrics with OpenTelemetry, inspect one docs-assistant run, and control prompt and tool content in exported spans.
Test an agent against simulated usersRead
Evaluate a docs assistant with simulated novice and expert users, inspect multi-turn scores, and diagnose turn caps and unsupported metrics.
Inject tool failures with environment simulationRead
Inject docs-service failures with ADK environment simulation, replay the recorded responses, and test the limits of retry guidance and error rules.
Write a custom eval metric and optimize the instructionRead
Score citations against completed docs reads, optimize an ADK instruction with GEPA, and inspect copied facts and limits of the validation set.
Apply safety and security guardrails to agent toolsRead
Guard docs-assistant write tools with role checks, confirmation and path validation, then test refused calls and a followed prompt injection.
Module 5 · 4 lessonsDeploy agents on Google Cloud
Use managed sessions and Memory Bank, then deploy to Cloud Run and Agent Runtime.
Use Agent Platform models, sessions and Memory BankRead
Connect a local ADK runner to managed sessions and Memory Bank, separate model and storage locations, and inspect one cross-session recall run.
Scaffold and deploy an agent with the Agents CLIRead
Use an Agents CLI project for an existing ADK agent, inspect deployment defaults, set explicit resource limits, and resume a recorded remote session.
Deploy an ADK agent to Agent RuntimeRead
Deploy an ADK agent with the native CLI, call Agent Runtime session and streaming methods, and distinguish endpoint mistakes from user-session errors.
Deploy an ADK agent to Cloud RunRead
Serve an ADK agent on private Cloud Run, separate caller and runtime permissions, and inspect what happens to local sessions across a revision change.
