showcase/shell-docs/src/content/ag-ui/sdk/java/server/overview.mdx
Server-side utilities for building agents and streaming events to clients.
com.agui.server — local agents and event helpers
LocalAgent — implement server-side agents that emit eventsEventFactory — convenience methods to create eventsstreamer.AgentStreamer — bridge agents to EventStreamcom.agui.server.spring — Spring Boot integration
AgUiService — run agents and stream SseEmitterAgUiParameters — HTTP payload mapped to RunAgentParametersExtend LocalAgent and implement run(RunAgentInput, AgentSubscriber) to emit events. Use emitEvent(event, subscriber) to dispatch to the correct subscriber method.
public class EchoAgent extends LocalAgent {
public EchoAgent() { super("echo", new State(), null, "You are echo."); }
@Override
protected void run(RunAgentInput input, AgentSubscriber sub) {
var runId = input.getRunId();
emitEvent(EventFactory.runStartedEvent(input.getThreadId(), runId), sub);
var messageId = UUID.randomUUID().toString();
emitEvent(EventFactory.textMessageStartEvent(messageId, "assistant"), sub);
emitEvent(EventFactory.textMessageContentEvent(messageId, "Hello"), sub);
emitEvent(EventFactory.textMessageEndEvent(messageId), sub);
emitEvent(EventFactory.runFinishedEvent(input.getThreadId(), runId), sub);
}
}