How kolinatasha/adk-python works
Project Type and Purpose
• This is a full-featured, open-source Python framework (a library + CLI + dev UI) called “Agent Development Kit (ADK).”
• Purpose: provide a code-first toolkit for building, orchestrating, evaluating, and deploying AI agents, with pluggable tools, multi-agent flows, state/memory, authentication, execution backends, evaluation, and CI/CD support.
High-Level Architectural Layers
• Core Library (src/google/adk)
• Command-Line Interface & Dev UI (src/google/adk/cli + browser assets)
• External Integrations (tools → BigQuery, Vertex AI, OpenAPI, A2A protocol, GCS, OAuth)
• Execution Backends (built-in, container, unsafe local, Vertex AI code executors)
• State Management (memory services, session services, artifact services)
• Evaluation Subsystem (eval sets, metrics, LLM-as-judge)
• Plugins & Extensions (plugin manager, logging plugin, base plugin)
• Tests & Samples (tests/integration, tests/unittests, contributing/samples)
Main Components & Relationships
• Agents:
• Represented by classes under agents/ (LlmAgent, SequentialAgent, ParallelAgent, A2AAgent, etc.)
• Use InvocationContext, CallbackContext, AgentConfig, run_config.
• Flows:
• LLM flows (planning, code execution, instructions, auto_flow) orchestrate agent steps.
• Tools:
• A set of toolsets (bigquery, application_integration_tool, openapi_tool, retrieval, etc.)
• Agents invoke tools to perform external operations.
• Models:
• BaseLLMConnection, gemini_llm, google_llm, lite_llm, anthropic_llm, etc.
• Agents delegate requests to model connections.
• Authentication:
• Auth credential services (in-memory, session_state, exchangers, refreshers).
• CredentialManager, AuthHandler, AuthPreprocessor.
• Execution Backends:
• Code executors implementing BaseCodeExecutor (container, built-in, vertex_ai, unsafe_local).
• Flows invoke code execution via executor registry.
• State & Artifacts:
• Memory services (in_memory, vertex_ai_rag, memory bank).
• Session services (database, in_memory, vertex_ai).
• Artifact services (GCS, in_memory).
• Evaluation:
• EvalService, EvalSetsManager, metrics, trajectory evaluator, safety evaluator.
• GCS-backed or in-memory eval result stores.
• CLI & Dev UI:
• CLI commands (adk create, deploy, eval) use click-based cli.py / cli_tools_click.
• FastAPI web server (adk_web_server) with static React/JS frontend assets for interactive UI.
• Integrations:
• Agent2Agent (A2A) protocol for remote agent calls.
• External services: BigQuery, Vertex AI, GCS, secret stores, OpenAPI specs.
• Plugins:
• PluginManager loads plugins (logging, custom) to hook into agent lifecycle.
Architectural Patterns & Design Principles
• Modular packages: each concern (agents, flows, tools, auth, state, evaluation) isolated in its own package.
• Dependency Injection / Registry patterns: executors, credential exchangers, evaluators registered via registries.
• Strategy pattern: pluggable code executors, memory services, session services.
• Layered architecture:
1) Presentation: CLI & Dev UI
2) Application/Core: Agents, Flows, Tools
3) Infrastructure: Executors, Auth services, Memory/Session/Artifact services, Evaluation backends
4) External systems