Google ADK
Google ADK Adapter
Section titled “Google ADK Adapter”Bridges Google Agent Development Kit (ADK) agent streams to Atmosphere’s real-time broadcast infrastructure. ADK agents can push streaming texts to WebSocket, SSE, and gRPC browser clients.
Maven Coordinates
Section titled “Maven Coordinates”<dependency> <groupId>org.atmosphere</groupId> <artifactId>atmosphere-adk</artifactId> <version>LATEST</version> <!-- check Maven Central for latest --></dependency>Architecture
Section titled “Architecture”Browser <- WS/SSE/gRPC -> Broadcaster <- AdkEventAdapter <- Flowable<Event> <- Runner <- LlmAgentQuick Start
Section titled “Quick Start”AiSupport SPI (auto-detected)
Section titled “AiSupport SPI (auto-detected)”@AiEndpoint(path = "/ai/chat", systemPrompt = "You are a helpful assistant")public class MyChat {
@Prompt public void onPrompt(String message, StreamingSession session) { session.stream(message); // uses ADK automatically when atmosphere-adk is on classpath }}Direct Adapter Usage
Section titled “Direct Adapter Usage”// Build an ADK agentLlmAgent agent = LlmAgent.builder() .name("assistant") .model("gemini-2.0-flash") .instruction("You are a helpful assistant.") .build();
Runner runner = Runner.builder() .agent(agent) .appName("my-app") .build();
// Stream to an AtmosphereResourcevar session = StreamingSessions.start(resource);adkAdapter.stream(new AdkRequest(runner, userId, sessionId, prompt), session);Low-Level Event Bridge
Section titled “Low-Level Event Bridge”Bridge ADK events directly to a Broadcaster:
Flowable<Event> events = runner.runAsync(userId, sessionId, Content.fromParts(Part.fromText(prompt)));AdkEventAdapter.bridge(events, broadcaster);ADK Broadcast Tool
Section titled “ADK Broadcast Tool”Give your ADK agent a tool that can push messages to browser clients:
AdkBroadcastTool broadcastTool = new AdkBroadcastTool(broadcaster);
LlmAgent agent = LlmAgent.builder() .name("notifier") .model("gemini-2.0-flash") .instruction("Use the broadcast tool to send updates to users.") .tools(broadcastTool) .build();Key Classes
Section titled “Key Classes”| Class | Purpose |
|---|---|
AdkEventAdapter | Subscribes to Flowable<Event> and forwards streaming texts to StreamingSession |
AdkBroadcastTool | ADK BaseTool that broadcasts messages via Atmosphere Broadcaster |
AdkStreamingAdapter | AiStreamingAdapter SPI impl bridging ADK Runner to StreamingSession |
AdkAiSupport | AiSupport SPI implementation (priority 100) |
Samples
Section titled “Samples”- Spring Boot ADK Chat — complete ADK chat example
- Spring Boot ADK Tools — ADK tools with broadcasting
See Also
Section titled “See Also”- AI Integration —
AiSupportSPI,@AiEndpoint, filters, routing - Spring AI Adapter
- LangChain4j Adapter
- Embabel Adapter
- Module README