Class AguiRestController

java.lang.Object
io.agentscope.spring.boot.agui.mvc.AguiRestController

@RestController public class AguiRestController extends Object
REST controller for AG-UI protocol endpoints.

This controller exposes the AG-UI run endpoints for Spring MVC applications. It delegates the actual processing to AguiMvcController.

  • Constructor Summary

    Constructors
    Constructor
    Description
    AguiRestController(AguiMvcController aguiMvcController, String pathPrefix, boolean enablePathRouting)
    Creates a new AguiRestController.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.springframework.web.servlet.mvc.method.annotation.SseEmitter
    run(io.agentscope.core.agui.model.RunAgentInput input, String agentIdHeader)
    Handle an AG-UI run request.
    org.springframework.web.servlet.mvc.method.annotation.SseEmitter
    runWithAgentId(String agentId, io.agentscope.core.agui.model.RunAgentInput input, String agentIdHeader)
    Handle an AG-UI run request with agent ID in the URL path.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AguiRestController

      public AguiRestController(AguiMvcController aguiMvcController, String pathPrefix, boolean enablePathRouting)
      Creates a new AguiRestController.
      Parameters:
      aguiMvcController - The AG-UI MVC controller
      pathPrefix - The path prefix for endpoints
      enablePathRouting - Whether to enable path variable routing
  • Method Details

    • run

      @PostMapping(value="${agentscope.agui.path-prefix:/agui}/run", consumes="application/json", produces="text/event-stream") public org.springframework.web.servlet.mvc.method.annotation.SseEmitter run(@RequestBody io.agentscope.core.agui.model.RunAgentInput input, @RequestHeader(value="${agentscope.agui.agent-id-header:X-Agent-Id}",required=false) String agentIdHeader)
      Handle an AG-UI run request.

      Agent ID is resolved from (in priority order):

      1. HTTP header (configurable, default: X-Agent-Id)
      2. forwardedProps.agentId in request body
      3. config.defaultAgentId
      4. "default"
      Parameters:
      input - The run agent input
      agentIdHeader - The agent ID from HTTP header (optional)
      Returns:
      An SseEmitter for streaming AG-UI events
    • runWithAgentId

      @PostMapping(value="${agentscope.agui.path-prefix:/agui}/run/{agentId}", consumes="application/json", produces="text/event-stream") public org.springframework.web.servlet.mvc.method.annotation.SseEmitter runWithAgentId(@PathVariable String agentId, @RequestBody io.agentscope.core.agui.model.RunAgentInput input, @RequestHeader(value="${agentscope.agui.agent-id-header:X-Agent-Id}",required=false) String agentIdHeader)
      Handle an AG-UI run request with agent ID in the URL path.

      The path variable takes highest priority for agent resolution.

      Parameters:
      agentId - The agent ID from path variable
      input - The run agent input
      agentIdHeader - The agent ID from HTTP header (optional)
      Returns:
      An SseEmitter for streaming AG-UI events