How google/adk-java works
Main components
• Core Library (core module)
• Agent abstractions (BaseAgent, LlmAgent, LoopAgent, etc.)
• Tool & plugin framework (BaseTool, PluginManager)
• Session, memory, artifact, event services
• LLM connectors (Gemini, OpenAI, Vertex)
• A2A Integration (a2a + a2a/webservice modules)
• A2AClient, converters, send/receive executor
• Remote Webservice (Spring Boot-style A2ARemoteController + A2ARemoteService)
• Development UI (dev module + dev/browser assets)
• Backend: AdkWebServer, controllers, WebSocket handler
• Frontend: static JS/CSS served to browser for live debugging
• Maven Plugin (maven_plugin module)
• WebMojo, AgentLoader, ConfigAgentWatcher for build-time code generation and hot-reload
• Samples & Tutorials (contrib, tutorials modules)
• Example agent code illustrating usage patterns – not part of the runtime product
• External Services
• Google Cloud (GCS for artifacts, Vertex AI for LLM & speech)
• Third-party LLM APIs (Gemini, OpenAI, Anthropic, Ollama)
Component interactions and data flows
• Build‐time: Developer invokes Maven; maven_plugin hooks generate support code → compiles into deployable JAR.
• Runtime – Agent Execution:
• Agent code ← linked against core library.
• Core invokes LLM connectors → external LLM APIs.
• Core persists/retrieves state via in-memory or GCS artifact & session services.
• Agents call tools → may invoke code executors or external HTTP services.
• Runtime – A2A: Local agent ↔ remote agent communication via A2AClient ↔ A2ARemoteController over HTTP.
• Runtime – Dev UI: Browser UI ↔ AdkWebServer REST/WebSocket endpoints ↔ live agent instance for stepping, inspection, telemetry.
Architectural patterns
• Modular Multi-module Maven Project: Clear separation of library, protocol, plugin, server, and samples.
• Builder & Strategy Patterns: Agent.builder(), pluggable ToolResolver, SessionService strategy.
• Plugin Architecture: PluginManager loads runtime plugins (e.g., telemetry, replay).
• MVC/WebSocket for Dev UI: Controllers (REST + WS) serve static assets + live agent hooks.
• Protocol Layer: A2A converters abstract message/part/event translation.