Class AguiMvcController
java.lang.Object
io.agentscope.spring.boot.agui.mvc.AguiMvcController
MVC controller for AG-UI protocol requests.
This controller processes AG-UI run requests and returns Server-Sent Events (SSE)
streams with AG-UI protocol events using Spring MVC's SseEmitter.
Agent ID Resolution Priority:
- URL path variable:
/agui/run/{agentId} - HTTP header: configurable via
agentIdHeader(default: X-Agent-Id) - forwardedProps.agentId in request body
- config.defaultAgentId
- "default"
Usage:
AguiMvcController controller = AguiMvcController.builder()
.agentRegistry(registry)
.config(AguiAdapterConfig.defaultConfig())
.agentIdHeader("X-Agent-Id")
.build();
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder for AguiMvcController. -
Method Summary
Modifier and TypeMethodDescriptionstatic AguiMvcController.Builderbuilder()Creates a new builder for AguiMvcController.Get the agent ID header name.org.springframework.web.servlet.mvc.method.annotation.SseEmitterHandle an AG-UI run request.org.springframework.web.servlet.mvc.method.annotation.SseEmitterhandleWithAgentId(io.agentscope.core.agui.model.RunAgentInput input, String headerAgentId, String pathAgentId) Handle an AG-UI run request with agent ID in the URL path.
-
Method Details
-
handle
public org.springframework.web.servlet.mvc.method.annotation.SseEmitter handle(io.agentscope.core.agui.model.RunAgentInput input, String headerAgentId) Handle an AG-UI run request.- Parameters:
input- The run agent inputheaderAgentId- The agent ID from HTTP header (may be null)- Returns:
- An SseEmitter for streaming AG-UI events
-
handleWithAgentId
public org.springframework.web.servlet.mvc.method.annotation.SseEmitter handleWithAgentId(io.agentscope.core.agui.model.RunAgentInput input, String headerAgentId, String pathAgentId) Handle an AG-UI run request with agent ID in the URL path.- Parameters:
input- The run agent inputheaderAgentId- The agent ID from HTTP header (may be null)pathAgentId- The agent ID from URL path variable- Returns:
- An SseEmitter for streaming AG-UI events
-
getAgentIdHeader
Get the agent ID header name.- Returns:
- The header name
-
builder
Creates a new builder for AguiMvcController.- Returns:
- A new builder instance
-