AguiRestController
@RestController public class AguiRestController
源码Source
io/agentscope/spring/boot/agui/mvc/AguiRestController.java:41–148AGUI REST 控制器,承载智能体的部署、调度与服务化运行。位于 io.agentscope.spring.boot.agui.mvc 包。核心成员包括 run、runWithAgentId、handleParseError、AguiRestController。
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
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public SseEmitter run(String body, String agentIdHeader, HttpServletRequest request) | 处理AG-UI 运行请求。 Handle an AG-UI run request. |
public SseEmitter runWithAgentId(String agentId, String body, String agentIdHeader, HttpServletRequest request) | 处理AG-UI 运行请求使用智能体标识,使用 URL 路径。 Handle an AG-UI run request with agent ID in the URL path. |
public ResponseEntity<String> handleParseError(JsonException error) | 处理解析错误。 Return HTTP 400 for AG-UI request body parsing failures. |
构造器详情Constructor Detail
AguiRestController
public AguiRestController(AguiMvcController aguiMvcController, String pathPrefix, boolean enablePathRouting, AguiRequestBodyParser requestBodyParser)
创建新的AguiRestController。
Creates a new AguiRestController.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
aguiMvcController | AguiMvcController | AG-UI MVC 控制器。The AG-UI MVC controller |
pathPrefix | String | 路径 Prefix(类型 `String`)。The path prefix for endpoints |
enablePathRouting | boolean | 启用路径路由(类型 `boolean`)。Whether to enable path variable routing |
requestBodyParser | AguiRequestBodyParser | 请求正文解析器(类型 `AguiRequestBodyParser`)。The parser used to decode request bodies |
源码Source
io/agentscope/spring/boot/agui/mvc/AguiRestController.java:58–67方法详情Method Detail
run
public SseEmitter run(String body, String agentIdHeader, HttpServletRequest request)
处理AG-UI 运行请求。
Handle an AG-UI run request.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
body | String | 原始运行智能体输入 JSON。The raw run agent input JSON |
agentIdHeader | String | 智能体标识来自 HTTP 请求头(可选)。The agent ID from HTTP header (optional) |
request | HttpServletRequest | 请求(类型 `HttpServletRequest`)。The request. |
SseEmitter一种SseEmitter 用于流式 AG-UI 事件。An SseEmitter for streaming AG-UI events
源码Source
io/agentscope/spring/boot/agui/mvc/AguiRestController.java:84–97runWithAgentId
public SseEmitter runWithAgentId(String agentId, String body, String agentIdHeader, HttpServletRequest request)
处理AG-UI 运行请求使用智能体标识,使用 URL 路径。
Handle an AG-UI run request with agent ID in the URL path.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
agentId | String | 智能体标识(类型 `String`)。The agent ID from path variable |
body | String | 原始运行智能体输入 JSON。The raw run agent input JSON |
agentIdHeader | String | 智能体标识来自 HTTP 请求头(可选)。The agent ID from HTTP header (optional) |
request | HttpServletRequest | 请求(类型 `HttpServletRequest`)。The request. |
SseEmitter一种SseEmitter 用于流式 AG-UI 事件。An SseEmitter for streaming AG-UI events
源码Source
io/agentscope/spring/boot/agui/mvc/AguiRestController.java:109–123handleParseError
public ResponseEntity<String> handleParseError(JsonException error)
处理解析错误。
Return HTTP 400 for AG-UI request body parsing failures.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
error | JsonException | JSON 解析失败。the JSON parse failure |
ResponseEntity<String>返回ResponseEntity。an SSE-compatible bad request response
源码Source
io/agentscope/spring/boot/agui/mvc/AguiRestController.java:131–147