Skip to content

Google ADK - Architecture Diagrams


┌─────────────────────────────────────────────────────────────┐
│ Application Layer │
│ (REST API, Webhooks, CLI, WebUI, Scheduled Tasks) │
└─────────────────────────────┬─────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│ Runner/Executor │
│ • Orchestrates agent execution │
│ • Manages sessions and state │
│ • Handles tool invocation │
│ • Manages concurrency and timeouts │
└─────────────────────────────┬─────────────────────────────────┘
┌─────────────┼─────────────┐
│ │ │
▼ ▼ ▼
┌──────────┐ ┌─────────┐ ┌─────────┐
│ Agent │ │ Tools │ │ Models │
│ Logic │ │ Executor│ │ API │
└──────────┘ └─────────┘ └─────────┘
│ │ │
└─────────────┼─────────────┘
┌─────────────┼─────────────┐
│ │ │
▼ ▼ ▼
┌──────────┐ ┌──────────┐ ┌──────────┐
│ Sessions │ │ Artifacts│ │ Memory │
│ Service │ │ Service │ │ Service │
└──────────┘ └──────────┘ └──────────┘

┌────────────────────┐
│ Root Coordinator │
│ Agent │
└────────┬───────────┘
┌──────────────────┼──────────────────┐
│ │ │
▼ ▼ ▼
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ Specialist1 │ │ Specialist2 │ │ Specialist3 │
│ (Research) │ │ (Analysis) │ │ (Writing) │
└──────────────┘ └──────────────┘ └──────────────┘
│ │ │
┌─────┴─────┐ ┌─────┴─────┐ ┌─────┴─────┐
│ │ │ │ │ │
▼ ▼ ▼ ▼ ▼ ▼
┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐
│ A │ │ B │ │ C │ │ D │ │ E │ │ F │
└───┘ └───┘ └───┘ └───┘ └───┘ └───┘
(Tools) (Tools) (Tools) (Tools) (Tools) (Tools)

User Query
┌──────────────────┐
│ Research Agent │
│ • Search web │
│ • Gather data │
└─────────┬────────┘
┌──────────────────┐
│ Analysis Agent │
│ • Process data │
│ • Extract key │
│ points │
└─────────┬────────┘
┌──────────────────┐
│ Writer Agent │
│ • Draft content │
│ • Format output │
└─────────┬────────┘
┌──────────────────┐
│ Editor Agent │
│ • Review │
│ • Polish │
└─────────┬────────┘
Result

User Input
┌─────────┼─────────┐
│ │ │
▼ ▼ ▼
┌────────┐ ┌────────┐ ┌────────┐
│Parser │ │Analyzer│ │Checker │
│ │ │ │ │ │
│Process │ │Identify│ │Verify │
│input │ │patterns│ │results │
└────┬───┘ └───┬────┘ └───┬────┘
│ │ │
└─────────┼─────────┘
┌──────────────────┐
│ Aggregator Agent │
│ • Combine results│
│ • Generate final │
│ response │
└──────────┬───────┘
Output

┌─────────────────┐
│ Start Problem │
└────────┬────────┘
┌─────────────────┐
│ THOUGHT: │
│ What do I know? │
│ What do I need? │
└────────┬────────┘
┌─────────────────┐
│ ACTION: │
│ Call a tool or │
│ make conclusion │
└────────┬────────┘
┌─────────────────┐
│ OBSERVATION: │
│ Tool result / │
│ feedback │
└────────┬────────┘
┌─────────────────┐
│ REASONING: │
│ Interpret what │
│ I learned │
└────────┬────────┘
┌────────────────┼────────────────┐
│ │
▼ ▼
┌──────────────┐ ┌──────────────┐
│ More Work │ │ Final Answer │
│ Needed? │ │ Ready │
└──────┬───────┘ └──────┬───────┘
│ │
Yes │ │ No
└─────────────┬─────────────────┘
(Loop back to THOUGHT)

┌──────────────────┐
│ Agent Decides │
│ to Call Tool │
└────────┬─────────┘
┌──────────────────┐
│ Construct Tool │
│ Call with Params │
└────────┬─────────┘
┌──────────────────┐
│ Validate Inputs │
│ Check Schemas │
└────────┬─────────┘
┌──────────────────┐
│ Execute Tool │
│ (Sync/Async) │
└────────┬─────────┘
┌───────┴────────┐
│ │
▼ ▼
┌────────┐ ┌─────────┐
│Success │ │ Error │
└────┬───┘ └────┬────┘
│ │
▼ ▼
┌─────────┐ ┌─────────┐
│ Result │ │ Handle │
│Feedback │ │ Error │
└────┬────┘ └────┬────┘
│ │
└──────────┬───────┘
┌────────────────────┐
│ Update Agent State │
│ Continue Reasoning │
└────────────────────┘

┌──────────────────────────────────────────────────────┐
│ Session Lifecycle │
└──────────────────────────────────────────────────────┘
Create Session
┌─────────────────┐
│ Initialize │
│ State │
│ - User ID │
│ - Session ID │
│ - Metadata │
└────────┬────────┘
┌─────────────────┐
│ Store Session │
│ (Memory/DB) │
└────────┬────────┘
┌────────┴────────┐
│ │
▼ ▼
┌────────┐ ┌────────┐
│Agent │ ◄───┤Session │
│Call 1 │ │Updated │
└────────┘ └────────┘
┌────────┐
│Agent │
│Call 2 │
└────────┘
┌────────┐
│Agent │
│Call N │
└────────┘
Retrieve/Delete Session

┌────────────────┐
│ Agent │
└────────┬───────┘
┌───────────────────┼───────────────────┐
│ │ │
▼ ▼ ▼
┌─────────┐ ┌──────────┐ ┌──────────┐
│ Immediate│ │ Short-Term│ │ Long-Term│
│ Memory │ │ Memory │ │ Memory │
│(Context)│ │(Session) │ │(Persistent)│
└─────────┘ └──────────┘ └──────────┘
│ │ │
│ │ ┌────────┴────────┐
│ │ │ │
│ │ ▼ ▼
│ │ ┌────────┐ ┌──────────┐
│ │ │Firestore│ │Vector DB │
│ │ │(State) │ │(Semantic)│
│ │ └────────┘ └──────────┘
│ │
└───────────────────┼─────────────────────────┐
│ │
▼ ▼
┌──────────────────────────────────┐
│ Memory Management │
│ • Expiration │
│ • Cleanup │
│ • Prioritisation │
└──────────────────────────────────┘

┌──────────────────────────────────────────────────────────┐
│ ADK Application │
└──────────────────────────────────────────────────────────┘
┌──────────────────┼──────────────────┐
│ │ │
▼ ▼ ▼
┌─────────┐ ┌──────────┐ ┌───────────┐
│ Gemini │ │Vertex AI │ │Google │
│API │ │Search │ │Services │
└────┬────┘ └────┬─────┘ └─────┬─────┘
│ │ │
│ │ │
└────────────────┼──────────────────┘
┌────────────────┼────────────────┐
│ │ │
▼ ▼ ▼
┌──────────┐ ┌─────────────┐ ┌──────────┐
│ Firestore│ │ Cloud │ │BigQuery │
│(Sessions)│ │Storage │ │(Analytics)
│(Memory) │ │(Artifacts) │ │ │
└──────────┘ └─────────────┘ └──────────┘

┌─────────────────┐
│ Orchestrator │
│ Agent │
└────────┬────────┘
┌────────────────────┼────────────────────┐
│ │ │
▼ ▼ ▼
┌────────┐ ┌────────┐ ┌────────┐
│Routing │ │State │ │Tool │
│Service │ │Manager │ │Broker │
└───┬────┘ └───┬────┘ └───┬────┘
│ │ │
▼ ▼ ▼
┌────────────┐ ┌────────────┐ ┌────────────┐
│Agent Pool │ │Session │ │Tool │
│- Agent A │ │Registry │ │Registry │
│- Agent B │ │- Session 1 │ │- Tool A │
│- Agent C │ │- Session 2 │ │- Tool B │
└────────────┘ │- Session N │ │- Tool C │
└────────────┘ └────────────┘

┌──────────────────────────────────────────────────────────┐
│ Cloud Build │
│ • Test │
│ • Build │
│ • Push to Registry │
└──────────────────────┬─────────────────────────────────┘
┌───────────┴───────────┐
│ │
▼ ▼
┌─────────────┐ ┌─────────────┐
│ Cloud Run │ │ Vertex AI │
│ (Serverless)│ │ Agent Engine│
└──────┬──────┘ └──────┬──────┘
│ │
▼ ▼
┌─────────────┐ ┌─────────────┐
│ US-Central1 │ │ EU-West1 │
│ (Region 1) │ │ (Region 2) │
└──────┬──────┘ └──────┬──────┘
│ │
└──────────┬──────────┘
┌─────────────────────┐
│ Load Balancer │
│ (Traffic routing) │
└──────────┬──────────┘
┌─────────────────┐
│ End Users │
└─────────────────┘

┌──────────────────────────────────────────────────────────┐
│ ADK Application │
└──────────────────────────┬───────────────────────────────┘
┌──────────────────┼──────────────────┐
│ │ │
▼ ▼ ▼
┌──────────┐ ┌───────────┐ ┌─────────┐
│ Logging │ │ Metrics │ │ Tracing │
│ (Logs) │ │(Monitoring) │(Trace) │
└────┬─────┘ └─────┬─────┘ └────┬────┘
│ │ │
└───────────────────┼───────────────┘
┌──────────────────────────────────┐
│ Cloud Logging Dashboard │
│ Cloud Monitoring Dashboard │
│ Cloud Trace Dashboard │
└──────────────┬───────────────────┘
┌──────────────────────────────────┐
│ Alerting & Notification │
│ • Email │
│ • SMS │
│ • Slack │
│ • PagerDuty │
└──────────────────────────────────┘

┌──────────────────────────────────────────────────────────┐
│ Request Flow │
└──────────────────────────┬───────────────────────────────┘
┌──────────────────────────────────┐
│ API Gateway / Load Balancer │
│ - SSL/TLS Termination │
│ - DDoS Protection │
└─────────────────┬────────────────┘
┌──────────────────────────────────┐
│ Authentication │
│ - JWT Validation │
│ - Service Account │
│ - OAuth2 │
└─────────────────┬────────────────┘
┌──────────────────────────────────┐
│ Authorization (RBAC) │
│ - Role Check │
│ - Permission Check │
│ - Resource ACL │
└─────────────────┬────────────────┘
┌──────────────────────────────────┐
│ Input Validation │
│ - Schema Validation │
│ - Content Scanning │
│ - Rate Limiting │
└─────────────────┬────────────────┘
┌──────────────────────────────────┐
│ ADK Agent Processing │
│ - Execute with security context │
│ - Encrypted communication │
│ - Audit logging │
└─────────────────┬────────────────┘
┌──────────────────────────────────┐
│ Response Encryption │
│ - HTTPS/SSL │
│ - Field-level encryption │
└──────────────────────────────────┘

┌────────────────────────────────────────────────────────┐
│ Query Analysis │
└────────────────────┬─────────────────────────────────┘
┌───────────┴────────────┐
│ │
▼ ▼
┌─────────┐ ┌──────────┐
│Simple? │ │Complex? │
│<1000 T │ │>1000 T │
└────┬────┘ └────┬─────┘
│ │
▼ ▼
┌───────────┐ ┌──────────┐
│Flash Model│ │Pro Model │
│$0.075/1M │ │$3/1M │
└─────┬─────┘ └────┬─────┘
│ │
└───────────┬───────────┘
┌────────────────────┐
│ Execute & Log Cost │
└────────┬───────────┘
┌────────────────────┐
│ Update Budget │
│ Track Spending │
└────────────────────┘

┌────────────────────────────────────────────────────────┐
│ Test Suite Organization │
└────────────────────┬─────────────────────────────────┘
┌───────────┼────────────┬─────────────┐
│ │ │ │
▼ ▼ ▼ ▼
┌────────┐ ┌────────┐ ┌────────┐ ┌─────────┐
│ Unit │ │Integration│Performance│Smoke │
│Tests │ │Tests │Tests │Tests │
└───┬────┘ └────┬─────┘ └───┬──────┘ └────┬────┘
│ │ │ │
▼ ▼ ▼ ▼
┌─────────────────────────────────────────────────┐
│ Continuous Integration │
│ • Run on each commit │
│ • Generate coverage reports │
│ • Block on failures │
│ • Create test reports │
└──────────────────┬────────────────────────────┘
┌──────────────────────────────────────────────────┐
│ Deploy to Production (if passing) │
└──────────────────────────────────────────────────┘

1. User Request
2. API Gateway
│ ├─ Validate request
│ ├─ Check authentication
│ └─ Apply rate limiting
3. Session Service
│ ├─ Load/create session
│ └─ Restore state
4. Agent
│ ├─ Receive input
│ ├─ Process with reasoning
│ ├─ Call tools as needed
│ └─ Generate response
5. Tool Execution
│ ├─ Validate inputs
│ ├─ Execute (possibly calling external services)
│ └─ Return results
6. Response Generation
│ ├─ Format response
│ ├─ Validate output schema
│ └─ Prepare for return
7. Session Update
│ ├─ Update state
│ ├─ Store artifacts
│ └─ Log interaction
8. Response Return
│ ├─ Encrypt response
│ ├─ Add metadata
│ └─ Send to client
9. Monitoring
│ ├─ Log interaction
│ ├─ Record metrics
│ ├─ Track costs
│ └─ Update dashboards
User Receives Response

These diagrams provide visual representations of key ADK concepts and architectures. Refer to the comprehensive and production guides for detailed explanations.