How kop0311/adk-python works
Project type and purpose
• This is a code-first, modular Python framework (not a monolithic application) for building, evaluating, and deploying AI agents.
• It provides:
• A core “Agent Engine” library (src/google/adk/…)
• A CLI (adk commands via Click/FastAPI) and a browser-based dev UI
• Integrations with LLMs (Gemini, Vertex AI, LiteLLM, Anthropic, etc.) and Google Cloud services
• A rich tool ecosystem (BigQuery, Bigtable, OpenAPI, custom functions)
• Session, memory, artifact, auth, telemetry, evaluation modules
File structure
• Top-level “src/google/adk” directory subdivided into feature modules:
• a2a – agent-to-agent protocol converters & executors
• agents – core agent abstractions (LlmAgent, LoopAgent, ParallelAgent), configs, contexts
• flows – orchestration flows (NL planning, function calls, schema enforcement)
• tools – adapters for external services (BigQuery, Bigtable, OpenAPI, application integration)
• auth – credential management, exchangers, refreshers
• memory & sessions – state management (in-memory, Vertex AI)
• artifacts – persistence backends (GCS, in-memory)
• evaluation – eval set managers, metrics, judges
• cli – command-line entrypoints & browser UI (FastAPI, JS assets)
• telemetry – tracing & metrics (Google Cloud)
• code_executors – local, containerized, GKE, Vertex AI, unsafe local
• Configuration & schema files (AgentConfig.json, YAML agent configs under samples),
build scripts (pyproject.toml), test suites (unit + integration).
README for additional insights
• Describes core capabilities: agents + tools + flows
• Mentions Code-First and Config-First agent definitions
• Highlights deployment targets: Cloud Run, Vertex AI Agent Engine
• Shows multi-agent orchestration patterns
Main components
a. Frontends
• CLI interface (google.adk.cli.cli.py)
• Browser-based Dev UI (FastAPI server + JS assets)
b. Core Agent Engine
• Agent abstractions (agents/…)
• Flow orchestrators (flows/…)
• Model connectors (models/…)
c. Support Services
• Auth service (credential managers, exchangers, refreshers)
• Memory & Session services
• Artifact service
• Telemetry (tracing, metrics)
• Evaluation engine (eval sets, metrics, generators)
d. Tool Adapters
• Google Cloud tools (BigQuery, Bigtable, Spanner)
• OpenAPI tools
• Custom function tools
• Application Integration tool
• A2A executor
e. External Dependencies
• LLM endpoints (Gemini, Vertex AI, Anthropic, LiteLLM)
• Google Cloud Storage, BigQuery, Bigtable, Cloud Run, Vertex AI Agent Engine
• A2A protocol peers
Relationships & data flows
• User ▶ CLI / Browser UI ▶ Core Agent Engine ▶ Agents ▶ Flows ▶ Models (LLM calls)
• Agents ▶ Tools ▶ External services (e.g., BigQuery)
• Agents ▶ Auth service to retrieve credentials for Tools or LLM endpoints
• Agents ▶ Memory/Session service to read/write conversation context
• Agents ▶ Artifact service to store logs, files
• Core Engine ▶ Telemetry ▶ Google Cloud Monitoring
• CLI / UI ▶ Evaluation module (to run eval sets)
Architectural patterns & principles
• Layered modular architecture (separate concerns into subpackages)
• Plugin/adapter patterns for Tools, Auth, Memory, Artifact, Session
• Strategy pattern for code executors, evaluators, planners
• Dependency injection via config files and Python objects
• Event-driven flows (Agents emit events ▶ Flows process them)
Detail without over-splitting
• Major subpackages but avoid drawing every single class.
• One representative sample of each plugin type (e.g., one BigQuery tool, one Memory service).