| layout | default |
|---|---|
| title | Chapter 2: Architecture and Runner Lifecycle |
| nav_order | 2 |
| parent | ADK Python Tutorial |
Welcome to Chapter 2: Architecture and Runner Lifecycle. In this part of ADK Python Tutorial: Production-Grade Agent Engineering with Google's ADK, you will build an intuitive mental model first, then move into concrete implementation details and practical production tradeoffs.
This chapter explains ADK's execution model so you can reason about behavior under load and during failures.
- understand the stateless runner model
- map invocation lifecycle steps end-to-end
- see where sessions, artifacts, and memory fit
- design around event persistence and compaction
- retrieve session state from session service
- build invocation context for current turn
- run agent reason-act loop
- stream and persist events
- optionally compact historical events
- keep agent code deterministic per invocation
- treat persistence services as system boundaries
- design event schemas for observability and replay
You now understand why ADK runner behavior is reliable when state is externalized and lifecycle boundaries are explicit.
Next: Chapter 3: Agent Design and Multi-Agent Composition
The Runner class in google/adk/runners.py is the entry point for the architecture covered in this chapter. It wires together the agent, session service, and memory service into the request/response lifecycle. Tracing the run_async method shows how events flow from user input through the agent graph and back to the caller, which is the central architectural pattern this chapter explains.