Skip to content

Google ADK

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.

<dependency>
<groupId>org.atmosphere</groupId>
<artifactId>atmosphere-adk</artifactId>
<version>LATEST</version> <!-- check Maven Central for latest -->
</dependency>
Browser <- WS/SSE/gRPC -> Broadcaster <- AdkEventAdapter <- Flowable<Event> <- Runner <- LlmAgent
@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
}
}
// Build an ADK agent
LlmAgent 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 AtmosphereResource
var session = StreamingSessions.start(resource);
adkAdapter.stream(new AdkRequest(runner, userId, sessionId, prompt), session);

Bridge ADK events directly to a Broadcaster:

Flowable<Event> events = runner.runAsync(userId, sessionId,
Content.fromParts(Part.fromText(prompt)));
AdkEventAdapter.bridge(events, broadcaster);

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();
ClassPurpose
AdkEventAdapterSubscribes to Flowable<Event> and forwards streaming texts to StreamingSession
AdkBroadcastToolADK BaseTool that broadcasts messages via Atmosphere Broadcaster
AdkStreamingAdapterAiStreamingAdapter SPI impl bridging ADK Runner to StreamingSession
AdkAiSupportAiSupport SPI implementation (priority 100)