The Agent Development Kit (ADK) is an open-source, code-first Python framework for building, evaluating, and deploying sophisticated AI agents. ADK enables developers to define agent logic, tools, and orchestration directly in Python code for maximum flexibility, testability, and version control.
This documentation covers the entire ADK Python system, from core execution abstractions through deployment. While ADK is optimized for Google's Gemini models and ecosystem (Vertex AI, BigQuery, Cloud Run), it is model-agnostic and deployment-agnostic, supporting multiple LLM providers and target platforms.
Installation: The framework is distributed as google-adk on PyPI and requires Python 3.10 or higher.
For details on specific subsystems, see: Getting Started, Agent System, Execution and Orchestration, LLM Integration, Tools and Extensions, Deployment.
Sources: README.md1-180 pyproject.toml1-218
ADK's architecture is organized into distinct layers that separate concerns between execution, integration, persistence, and user interfaces.
Key Architectural Principles:
Stateless Orchestration: The Runner class does not hold conversation state. It retrieves sessions from BaseSessionService, executes agent logic, and persists events back to the service.
Agent Composition: Complex behaviors emerge from composing simple agents. The BaseAgent hierarchy supports multi-agent systems through sub_agents.
Service Abstractions: Core capabilities (sessions, artifacts, memory) are defined as abstract base classes with multiple implementations (in-memory, cloud-backed).
Tool Extensibility: The BaseTool interface enables integration with any external capability, from Python functions to REST APIs to Model Context Protocol servers.
Sources: src/google/adk/runners.py src/google/adk/agents/base_agent.py src/google/adk/agents/invocation_context.py High-Level Architecture Diagram 1
The execution engine consists of three primary abstractions:
| Abstraction | Code Entity | Responsibility |
|---|---|---|
| Runner | google.adk.runners.Runner | Stateless orchestration of agent execution. Manages invocation lifecycle, plugin callbacks, event compaction. |
| Agent | google.adk.agents.base_agent.BaseAgent | Blueprint defining identity, instructions, tools, and sub-agents. Implements run_async() for execution logic. |
| InvocationContext | google.adk.agents.invocation_context.InvocationContext | Container for execution state: session, services, agent states, configuration. Passed to agents during execution. |
Execution Flow:
Runner.run_async(session_id, message) is calledSession from BaseSessionServiceInvocationContext with session, services, and configurationagent.run_async(context)Event objects streamed to callerSessionServiceSources: src/google/adk/runners.py src/google/adk/agents/base_agent.py src/google/adk/agents/invocation_context.py AGENTS.md37-72
ADK provides multiple agent types for different orchestration patterns:
LlmAgent: Standard agent that calls an LLM with tools and instructions. Supports multi-agent composition via sub_agents list.SequentialAgent: Executes sub-agents in sequence, passing state between them.ParallelAgent: Executes sub-agents concurrently, merging their results.LoopAgent: Repeatedly executes sub-agents until a termination condition is met.All agents inherit from BaseAgent and implement run_async(context: InvocationContext).
Sources: src/google/adk/agents/llm_agent.py src/google/adk/agents/sequential_agent.py src/google/adk/agents/parallel_agent.py src/google/adk/agents/loop_agent.py
The tool system provides extensible capabilities through a unified interface:
Tools are defined by implementing BaseTool or by decorating Python functions. The framework provides:
transfer_to_agent, code execution, Google SearchOpenAPIToolset auto-generates tools from OpenAPI specsMcpToolset connects to Model Context Protocol serversBigQueryToolset provides SQL execution and ML functionsSources: src/google/adk/tools/base_tool.py src/google/adk/tools/openapi_tool/ src/google/adk/tools/mcp_tool/ src/google/adk/tools/bigquery_tool/ Tool Integration Architecture Diagram 3
The persistence layer defines abstract service interfaces with multiple implementations:
| Service | Interface | Implementations | Purpose |
|---|---|---|---|
| Session | BaseSessionService | In-Memory, Database, Vertex AI | Conversation history and state |
| Artifact | BaseArtifactService | In-Memory, GCS | Binary data (images, audio, files) |
| Memory | BaseMemoryService | In-Memory, Vertex RAG | Long-term recall across sessions |
Services are configured via URI schemes (e.g., sqlite://, gs://bucket, rag://corpus_id) and registered in the service_registry.
Sources: src/google/adk/sessions/base_session_service.py src/google/adk/artifacts/base_artifact_service.py src/google/adk/memory/base_memory_service.py src/google/adk/cli/service_registry.py Session State Management Diagram 4
ADK provides three primary interfaces for interacting with agents:
The CLI is implemented in src/google/adk/cli/cli_tools_click.py using Click and provides commands for:
adk web, adk run for local testingadk eval for quality assessmentadk deploy with targets for Cloud Run, Vertex AI Agent Engine, and GKESources: src/google/adk/cli/cli_tools_click.py1-1336 pyproject.toml79-80
The development UI consists of:
src/google/adk/cli/browser/get_fast_api_app() in src/google/adk/cli/fast_api.py/run_sse endpoint)/debug/trace/ endpoints)Sources: src/google/adk/cli/fast_api.py55-403 src/google/adk/cli/adk_web_server.py401-1502 Web UI and API Architecture Diagram 7
For production deployments, ADK provides AdkWebServer.get_fast_api_app() which returns a configurable FastAPI instance. The server supports:
The same FastAPI instance can serve both the development UI and production API endpoints.
Sources: src/google/adk/cli/adk_web_server.py628-702 src/google/adk/cli/fast_api.py55-403
The development lifecycle follows these stages:
Agents must follow the required directory structure:
my_agent/
├── __init__.py # Must contain: from . import agent
└── agent.py # Must contain: root_agent = Agent(...)
Agents can be defined as simple Agent instances or wrapped in App for advanced configuration (plugins, event compaction).
Sources: AGENTS.md138-166 contributing/adk_project_overview_and_architecture.md27-47
adk run: Interactive REPL for quick functional testingadk web: Full-featured development UI with event inspectionpytest: Automated unit and integration testsThe evaluation framework assesses agent quality using:
*.evalset.json)ToolTrajectoryMetric, ResponseMatchMetric, SafetyMetricadk eval my_agent eval_set.jsonResults are stored via EvalSetResultsManager (local or GCS-backed).
Sources: src/google/adk/evaluation/ Development to Deployment Lifecycle Diagram 5
The adk deploy command supports three targets:
| Target | Command | Generated Artifacts | Use Case |
|---|---|---|---|
| Cloud Run | adk deploy cloud_run | Dockerfile | Containerized API server |
| Vertex AI Agent Engine | adk deploy agent_engine | ReasoningEngine Python code | Managed agent hosting |
| GKE | adk deploy gke | Dockerfile, deployment.yaml | Kubernetes cluster deployment |
All deployment targets automatically configure:
Sources: src/google/adk/cli/cli_deploy.py1-1336 src/google/adk/cli/cli_tools_click.py118-337
ADK defines a BaseLlm interface with two primary methods:
generate_content_async(): Standard request/response for text generationconnect(): Bidirectional streaming for real-time interactions (Gemini Live API)Supported Providers:
google-genai SDK. Supports context caching, live streaming, multiple API versions.Agents specify their LLM via the model parameter, which accepts either a string identifier (e.g., "gemini-2.5-flash") or a BaseLlm instance.
Sources: src/google/adk/models/base_llm.py src/google/adk/models/gemini.py src/google/adk/models/litellm.py src/google/adk/models/anthropic_llm.py LLM Provider Integration Diagram 6
adk-python/
├── src/google/adk/
│ ├── agents/ # Agent implementations
│ ├── runners.py # Runner orchestration
│ ├── tools/ # Tool ecosystem (50+ files)
│ │ ├── openapi_tool/
│ │ ├── mcp_tool/
│ │ └── bigquery_tool/
│ ├── models/ # LLM integrations
│ ├── flows/ # Execution flow management
│ ├── sessions/ # Session persistence
│ ├── memory/ # Long-term memory
│ ├── artifacts/ # Artifact storage
│ ├── evaluation/ # Evaluation framework
│ ├── cli/ # CLI and web server
│ ├── a2a/ # Agent-to-Agent protocol
│ └── telemetry/ # Observability
├── tests/
│ ├── unittests/ # 2600+ unit tests
│ └── integration/ # Integration tests
├── pyproject.toml # Package configuration
└── README.md # Project overview
Key Directories:
src/google/adk/agents/: All agent types and execution logicsrc/google/adk/tools/: Built-in and integration toolssrc/google/adk/cli/: CLI commands, FastAPI server, Angular UIsrc/google/adk/evaluation/: Evaluation framework (47 files)tests/unittests/: Comprehensive test coverage (236+ files)Sources: AGENTS.md79-99 contributing/adk_project_overview_and_architecture.md1-108
Minimum Requirements:
Installation:
Optional Dependencies:
The framework provides several optional dependency groups:
[eval]: Evaluation framework dependencies[test]: Testing dependencies (pytest, etc.)[a2a]: Agent-to-Agent protocol support[extensions]: Extended integrations (LiteLLM, LangGraph, etc.)[community]: Community-contributed toolsExample: pip install google-adk[eval,test]
Sources: README.md62-84 pyproject.toml26-161 CONTRIBUTING.md168-189
Refresh this wiki
This wiki was recently refreshed. Please wait 6 days to refresh again.