Spring Boot
The Spring integration exposes anyAgent bean as an AG-UI SSE endpoint. It comes in two variants. Both use the same routing and the same JacksonSerializer, and both work with the HttpAgent client.
All of these modules are at version
4.1.0 and target Spring Boot 4.1.x. Each auto-configuration activates only for its own web application type.
Quick start
Agent bean:
POST /agent with a JSON RunAgentInput now streams the agent’s events.
What gets auto-configured
You can replace any of these by defining a bean of the same type.
Endpoints
{path} defaults to /agent. Change it with a property:
text/event-stream. A body that cannot be deserialized returns 400 Bad Request. If the agent signals onError, the controller writes a final RUN_ERROR event and closes the stream.
Multiple agents
EachAgent bean is reachable under its bean name:
WebFlux and WebMVC differences
- WebFlux converts the agent’s
Flow.Publisherto aFlux<ServerSentEvent<String>>. Reactor handles backpressure and cancels the subscription when the client disconnects. - WebMVC streams through an
SseEmitterwith no timeout. It requests all events at once and relies onSseEmitter.sendblocking on the Servlet output for flow control. If a write fails, it cancels the subscription.
Wiring without auto-configuration
The controllers are plain classes, so you can create them yourself:AgUiController lives in com.agui.community.spring.server (WebFlux) and in com.agui.community.spring.webmvc (WebMVC).
Serving a Spring AI model
To serve a Spring AIChatClient as an agent, see Spring AI.