AgentProtocolController
@RestController public class AgentProtocolController
源码Source
io/agentscope/extensions/agentprotocol/AgentProtocolController.java:41–183智能体协议控制器,为框架提供通用类型与基础能力。位于 io.agentscope.extensions.agentprotocol 包。核心成员包括 submit、get、waitFor、cancel、events、resume。
Internal AgentScope task protocol (/tasks/...).
构造器摘要Constructor Summary
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public ResponseEntity<Map<String, Object>> submit(Map<String, Object> body) | 设置提交。 Performs the submit operation. |
public Map<String, Object> get(String taskId) | 按条件读取数据。 Performs the get operation. |
public Map<String, Object> waitFor(String taskId, long timeoutSeconds) throws Exception | 等待用于。 Blocks until the task completes. |
public ResponseEntity<Void> cancel(String taskId) | 执行取消相关操作。 Performs the cancel operation. |
public Flux<ServerSentEvent<String>> events(String taskId, Long fromSeq, String lastEventId) | 用于任务的SSE 事件流。 SSE event stream for a task. |
public ResponseEntity<Map<String, Object>> resume(String taskId, Map<String, Object> body) | 执行恢复相关操作。 Performs the resume operation. |
构造器详情Constructor Detail
AgentProtocolController
public AgentProtocolController(AgentProtocolTaskStore store, AgentProtocolProperties properties)
初始化 AgentProtocolController 实例。
Creates a new instance.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
store | AgentProtocolTaskStore | 存储实例(类型 `AgentProtocolTaskStore`)。The store. |
properties | AgentProtocolProperties | 属性(类型 `AgentProtocolProperties`)。The properties. |
源码Source
io/agentscope/extensions/agentprotocol/AgentProtocolController.java:49–53AgentProtocolController
public AgentProtocolController(AgentProtocolTaskStore store)
初始化 AgentProtocolController 实例。
Creates a new instance.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
store | AgentProtocolTaskStore | 存储实例(类型 `AgentProtocolTaskStore`)。The store. |
源码Source
io/agentscope/extensions/agentprotocol/AgentProtocolController.java:55–57方法详情Method Detail
submit
public ResponseEntity<Map<String, Object>> submit(Map<String, Object> body)
设置提交。
Performs the submit operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
body | Map<String, Object> | 正文(类型 `Map`)。The body. |
ResponseEntity<Map<String, Object>>返回ResponseEntity>。Returns response entity.
源码Source
io/agentscope/extensions/agentprotocol/AgentProtocolController.java:59–79get
public Map<String, Object> get(String taskId)
按条件读取数据。
Performs the get operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
taskId | String | 任务标识(类型 `String`)。The task id. |
Map<String, Object>返回映射。Returns map.
源码Source
io/agentscope/extensions/agentprotocol/AgentProtocolController.java:81–84waitFor
public Map<String, Object> waitFor(String taskId, long timeoutSeconds) throws Exception
等待用于。
Blocks until the task completes.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
taskId | String | 任务标识(类型 `String`)。The task id. |
timeoutSeconds | long | 超时秒(类型 `long`)。The timeout seconds. |
Map<String, Object>返回映射。Returns map.
Exception可能抛出 `Exception`。Thrown when the operation cannot be completed.
源码Source
io/agentscope/extensions/agentprotocol/AgentProtocolController.java:87–93cancel
public ResponseEntity<Void> cancel(String taskId)
执行取消相关操作。
Performs the cancel operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
taskId | String | 任务标识(类型 `String`)。The task id. |
ResponseEntity<Void>返回ResponseEntity。Returns response entity.
源码Source
io/agentscope/extensions/agentprotocol/AgentProtocolController.java:95–99events
public Flux<ServerSentEvent<String>> events(String taskId, Long fromSeq, String lastEventId)
用于任务的SSE 事件流。
SSE event stream for a task.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
taskId | String | 任务标识(类型 `String`)。The task id. |
fromSeq | Long | 来自 Seq(类型 `Long`)。The from seq. |
lastEventId | String | 最后事件标识(类型 `String`)。The last event id. |
Flux<ServerSentEvent<String>>返回Flux>。Returns flux.
源码Source
io/agentscope/extensions/agentprotocol/AgentProtocolController.java:105–124resume
public ResponseEntity<Map<String, Object>> resume(String taskId, Map<String, Object> body)
执行恢复相关操作。
Performs the resume operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
taskId | String | 任务标识(类型 `String`)。The task id. |
body | Map<String, Object> | 正文(类型 `Map`)。The body. |
ResponseEntity<Map<String, Object>>返回ResponseEntity>。Returns response entity.
源码Source
io/agentscope/extensions/agentprotocol/AgentProtocolController.java:126–139