Skip to content

Embabel

AiSupport implementation backed by Embabel AgentPlatform. When this JAR is on the classpath, @AiEndpoint can run Embabel agents and stream their output to browser clients.

<dependency>
<groupId>org.atmosphere</groupId>
<artifactId>atmosphere-embabel</artifactId>
<version>LATEST</version> <!-- check Maven Central for latest -->
</dependency>
@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 Embabel when atmosphere-embabel is on classpath
}
}

The agent name can be specified in AiRequest.hints()["agentName"].

val session = StreamingSessions.start(resource)
embabelAdapter.stream(AgentRequest("assistant") { channel ->
agentPlatform.run(prompt, channel)
}, session)
ClassPurpose
EmbabelStreamingAdapterAiStreamingAdapter bridging Embabel agents to StreamingSession
AtmosphereOutputChannelRoutes Embabel OutputChannelEvent to StreamingSession
EmbabelAiSupportAiSupport SPI implementation (priority 100)
AgentRequestWraps agent name and runner function
Embabel EventStreamingSession Action
MessageOutputChannelEventsession.send(content)
ContentOutputChannelEventsession.send(content)
ProgressOutputChannelEventsession.progress(message)
LoggingOutputChannelEvent (INFO+)session.progress(message)

AtmosphereEmbabelAutoConfiguration bridges a Spring-managed AgentPlatform bean to the SPI automatically.