AS AgentScopeAPI 手册 / API Reference

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

构造器Constructor说明Description
public AgentProtocolController(AgentProtocolTaskStore store, AgentProtocolProperties properties)
初始化 `AgentProtocolController` 实例。
Creates a new instance.
public AgentProtocolController(AgentProtocolTaskStore store)
初始化 `AgentProtocolController` 实例。
Creates a new instance.

方法摘要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
storeAgentProtocolTaskStore存储实例(类型 `AgentProtocolTaskStore`)。The store.
propertiesAgentProtocolProperties属性(类型 `AgentProtocolProperties`)。The properties.
源码Source io/agentscope/extensions/agentprotocol/AgentProtocolController.java:49–53

AgentProtocolController

public AgentProtocolController(AgentProtocolTaskStore store)

初始化 AgentProtocolController 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
storeAgentProtocolTaskStore存储实例(类型 `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
bodyMap<String, Object>正文(类型 `Map`)。The body.
返回Returns ResponseEntity<Map<String, Object>>
返回ResponseEntity>。Returns response entity.
源码Source io/agentscope/extensions/agentprotocol/AgentProtocolController.java:59–79

get

public Map<String, Object> get(String taskId)

按条件读取数据。

Performs the get operation.

参数Parameters
名称Name类型Type说明Description
taskIdString任务标识(类型 `String`)。The task id.
返回Returns Map<String, Object>
返回映射。Returns map.
源码Source io/agentscope/extensions/agentprotocol/AgentProtocolController.java:81–84

waitFor

public Map<String, Object> waitFor(String taskId, long timeoutSeconds) throws Exception

等待用于。

Blocks until the task completes.

参数Parameters
名称Name类型Type说明Description
taskIdString任务标识(类型 `String`)。The task id.
timeoutSecondslong超时秒(类型 `long`)。The timeout seconds.
返回Returns Map<String, Object>
返回映射。Returns map.
抛出Throws
  • Exception 可能抛出 `Exception`。Thrown when the operation cannot be completed.
源码Source io/agentscope/extensions/agentprotocol/AgentProtocolController.java:87–93

cancel

public ResponseEntity<Void> cancel(String taskId)

执行取消相关操作。

Performs the cancel operation.

参数Parameters
名称Name类型Type说明Description
taskIdString任务标识(类型 `String`)。The task id.
返回Returns ResponseEntity<Void>
返回ResponseEntity。Returns response entity.
源码Source io/agentscope/extensions/agentprotocol/AgentProtocolController.java:95–99

events

public Flux<ServerSentEvent<String>> events(String taskId, Long fromSeq, String lastEventId)

用于任务的SSE 事件流。

SSE event stream for a task.

参数Parameters
名称Name类型Type说明Description
taskIdString任务标识(类型 `String`)。The task id.
fromSeqLong来自 Seq(类型 `Long`)。The from seq.
lastEventIdString最后事件标识(类型 `String`)。The last event id.
返回Returns Flux<ServerSentEvent<String>>
返回Flux>。Returns flux.
源码Source io/agentscope/extensions/agentprotocol/AgentProtocolController.java:105–124

resume

public ResponseEntity<Map<String, Object>> resume(String taskId, Map<String, Object> body)

执行恢复相关操作。

Performs the resume operation.

参数Parameters
名称Name类型Type说明Description
taskIdString任务标识(类型 `String`)。The task id.
bodyMap<String, Object>正文(类型 `Map`)。The body.
返回Returns ResponseEntity<Map<String, Object>>
返回ResponseEntity>。Returns response entity.
源码Source io/agentscope/extensions/agentprotocol/AgentProtocolController.java:126–139
基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.