AS AgentScopeAPI 手册 / API Reference

ControlPlaneTaskRepository

public final class ControlPlaneTaskRepository implements TaskRepository
源码Source io/agentscope/extensions/controlplane/store/ControlPlaneTaskRepository.java:62–852

控制面任务仓库,负责持久化与读取数据。位于 io.agentscope.extensions.controlplane.store 包,实现 TaskRepository。核心成员包括 setCompletionCallback、putTask、getTask、listTasks、cancelTask、findPendingDeliveries。

Control-plane hosted TaskRepository over /api/v1/dp/tasks/*.

Maintains in-memory BackgroundTask handles for tasks running on the current node while using the control plane as the authoritative persistence layer. Heartbeats live local tasks every {@value #HEARTBEAT_INTERVAL_SECONDS} seconds via POST /tasks/heartbeat; there is no client-side orphan sweeper.

方法摘要Method Summary

方法Method说明Description
public void setCompletionCallback(TaskCompletionCallback callback)
设置补全回调。
Sets the completion callback.
public BackgroundTask putTask(RuntimeContext rc, String taskId, String subAgentId, String sessionId, TaskRunSpec spec)
执行 `putTask` 方法。
Performs the put task operation.
public BackgroundTask getTask(RuntimeContext rc, String sessionId, String taskId)
获取任务。
Returns the task.
public Collection<BackgroundTask> listTasks(RuntimeContext rc, String sessionId, TaskStatus filter)
列出任务。
Lists the tasks.
public boolean cancelTask(RuntimeContext rc, String sessionId, String taskId)
执行取消任务相关操作。
Performs the cancel task operation.
public List<TaskDelivery> findPendingDeliveries(RuntimeContext rc, String sessionId)
查找 `findPendingDeliveries`。
Finds the pending deliveries.
public void markDelivered(RuntimeContext rc, String sessionId, String taskId)
执行 `markDelivered` 方法。
Performs the mark delivered operation.
public boolean isDelivered(RuntimeContext rc, String sessionId, String taskId)
判断是否 `isDelivered`。
Returns whether the delivered.
public void shutdown()
关闭资源并释放连接。
Releases resources and connections.

方法详情Method Detail

setCompletionCallback

public void setCompletionCallback(TaskCompletionCallback callback)

设置补全回调。

Sets the completion callback.

参数Parameters
名称Name类型Type说明Description
callbackTaskCompletionCallback回调函数(类型 `TaskCompletionCallback`)。The callback.
源码Source io/agentscope/extensions/controlplane/store/ControlPlaneTaskRepository.java:165–168

putTask

public BackgroundTask putTask(RuntimeContext rc, String taskId, String subAgentId, String sessionId, TaskRunSpec spec)

执行 putTask 方法。

Performs the put task operation.

参数Parameters
名称Name类型Type说明Description
rcRuntimeContextrc(类型 `RuntimeContext`)。The rc.
taskIdString任务标识(类型 `String`)。The task id.
subAgentIdString子智能体标识(类型 `String`)。The sub agent id.
sessionIdString会话标识(类型 `String`)。The session id.
specTaskRunSpec规格(类型 `TaskRunSpec`)。The spec.
返回Returns BackgroundTask
返回BackgroundTask。Returns background task.
源码Source io/agentscope/extensions/controlplane/store/ControlPlaneTaskRepository.java:170–250

getTask

public BackgroundTask getTask(RuntimeContext rc, String sessionId, String taskId)

获取任务。

Returns the task.

参数Parameters
名称Name类型Type说明Description
rcRuntimeContextrc(类型 `RuntimeContext`)。The rc.
sessionIdString会话标识(类型 `String`)。The session id.
taskIdString任务标识(类型 `String`)。The task id.
返回Returns BackgroundTask
返回BackgroundTask。Returns background task.
源码Source io/agentscope/extensions/controlplane/store/ControlPlaneTaskRepository.java:252–260

listTasks

public Collection<BackgroundTask> listTasks(RuntimeContext rc, String sessionId, TaskStatus filter)

列出任务。

Lists the tasks.

参数Parameters
名称Name类型Type说明Description
rcRuntimeContextrc(类型 `RuntimeContext`)。The rc.
sessionIdString会话标识(类型 `String`)。The session id.
filterTaskStatus过滤条件(类型 `TaskStatus`)。The filter.
返回Returns Collection<BackgroundTask>
返回集合。Returns collection.
源码Source io/agentscope/extensions/controlplane/store/ControlPlaneTaskRepository.java:262–283

cancelTask

public boolean cancelTask(RuntimeContext rc, String sessionId, String taskId)

执行取消任务相关操作。

Performs the cancel task operation.

参数Parameters
名称Name类型Type说明Description
rcRuntimeContextrc(类型 `RuntimeContext`)。The rc.
sessionIdString会话标识(类型 `String`)。The session id.
taskIdString任务标识(类型 `String`)。The task id.
返回Returns boolean
返回布尔值,表示判断结果。Returns a boolean result.
源码Source io/agentscope/extensions/controlplane/store/ControlPlaneTaskRepository.java:285–324

findPendingDeliveries

public List<TaskDelivery> findPendingDeliveries(RuntimeContext rc, String sessionId)

查找 findPendingDeliveries。

Finds the pending deliveries.

参数Parameters
名称Name类型Type说明Description
rcRuntimeContextrc(类型 `RuntimeContext`)。The rc.
sessionIdString会话标识(类型 `String`)。The session id.
返回Returns List<TaskDelivery>
返回列出。Returns list.
源码Source io/agentscope/extensions/controlplane/store/ControlPlaneTaskRepository.java:326–365

markDelivered

public void markDelivered(RuntimeContext rc, String sessionId, String taskId)

执行 markDelivered 方法。

Performs the mark delivered operation.

参数Parameters
名称Name类型Type说明Description
rcRuntimeContextrc(类型 `RuntimeContext`)。The rc.
sessionIdString会话标识(类型 `String`)。The session id.
taskIdString任务标识(类型 `String`)。The task id.
源码Source io/agentscope/extensions/controlplane/store/ControlPlaneTaskRepository.java:367–385

isDelivered

public boolean isDelivered(RuntimeContext rc, String sessionId, String taskId)

判断是否 isDelivered。

Returns whether the delivered.

参数Parameters
名称Name类型Type说明Description
rcRuntimeContextrc(类型 `RuntimeContext`)。The rc.
sessionIdString会话标识(类型 `String`)。The session id.
taskIdString任务标识(类型 `String`)。The task id.
返回Returns boolean
返回布尔值,表示判断结果。Returns a boolean result.
源码Source io/agentscope/extensions/controlplane/store/ControlPlaneTaskRepository.java:387–391

shutdown

public void shutdown()

关闭资源并释放连接。

Releases resources and connections.

源码Source io/agentscope/extensions/controlplane/store/ControlPlaneTaskRepository.java:393–417

继承成员Inherited Members

继承自Members inherited from TaskRepository
基于官方固定版本源码静态生成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.