AS AgentScopeAPI 手册 / API Reference

EnvironmentWorkQueue

@Component public class EnvironmentWorkQueue
源码Source io/agentscope/builder/web/managed/EnvironmentWorkQueue.java:30–227

环境 Work 队列,承载智能体的部署、调度与服务化运行。位于 io.agentscope.builder.web.managed 包。核心成员包括 enqueue、poll、ack、stop、heartbeat、get。

Hands work-queue facade. Durability is provided by CoordinationStore so Brain replicas and out-of-process workers share the same queued/starting/active rows.

嵌套类摘要Nested Class Summary

类Class类型Kind说明Description
Status枚举enum
定义状态的枚举。
A enum in io.agentscope.builder.web.managed that defines enum values used when components deploys, schedules and serves agents.
WorkItem类class
Work 条目,承载智能体的部署、调度与服务化运行。
A class in io.agentscope.builder.web.managed that deploys, schedules and serves agents.

构造器摘要Constructor Summary

构造器Constructor说明Description
public EnvironmentWorkQueue(CoordinationStore coordinationStore)
初始化 `EnvironmentWorkQueue` 实例。
Creates a new instance.

方法摘要Method Summary

方法Method说明Description
public WorkItem enqueue(String sessionId, String environmentId, String ownerId)
执行 `enqueue` 方法。
Performs the enqueue operation.
public Optional<WorkItem> poll(String environmentId, String workerId, long timeoutMs) throws InterruptedException
执行 `poll` 方法。
Performs the poll operation.
public void ack(String leaseId, String workerId, String workDir)
执行确认相关操作。
Performs the ack operation.
public void stop(String leaseId)
设置停止。
Performs the stop operation.
public void heartbeat(String leaseId)
设置心跳。
Performs the heartbeat operation.
public Optional<WorkItem> get(String leaseId)
按条件读取数据。
Performs the get operation.
public List<WorkItem> list(String environmentId, String statusFilter)
执行列表相关操作。
Performs the list operation.
public CoordinationStore.WorkStats stats(String environmentId)
设置该参数。
Performs the stats operation.
public void registerWorker(String workerId, Object capabilities)
注册工作进程。
Registers the worker.
public Map<String, Long> workerHeartbeats()
返回 `workerHeartbeats` 结果。
Returns the worker heartbeats.
public int pendingCount()
返回待处理数量。
Returns the pending count.

构造器详情Constructor Detail

EnvironmentWorkQueue

public EnvironmentWorkQueue(CoordinationStore coordinationStore)

初始化 EnvironmentWorkQueue 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
coordinationStoreCoordinationStorecoordination 存储(类型 `CoordinationStore`)。The coordination store.
源码Source io/agentscope/builder/web/managed/EnvironmentWorkQueue.java:169–171

方法详情Method Detail

enqueue

public WorkItem enqueue(String sessionId, String environmentId, String ownerId)

执行 enqueue 方法。

Performs the enqueue operation.

参数Parameters
名称Name类型Type说明Description
sessionIdString会话标识(类型 `String`)。The session id.
environmentIdString环境标识(类型 `String`)。The environment id.
ownerIdString所有者标识(类型 `String`)。The owner id.
返回Returns WorkItem
返回WorkItem。Returns work item.
源码Source io/agentscope/builder/web/managed/EnvironmentWorkQueue.java:173–175

poll

public Optional<WorkItem> poll(String environmentId, String workerId, long timeoutMs) throws InterruptedException

执行 poll 方法。

Performs the poll operation.

参数Parameters
名称Name类型Type说明Description
environmentIdString环境标识(类型 `String`)。The environment id.
workerIdString工作进程标识(类型 `String`)。The worker id.
timeoutMslong超时 Ms(类型 `long`)。The timeout ms.
返回Returns Optional<WorkItem>
返回可选。Returns optional.
抛出Throws
  • InterruptedException 可能抛出 `InterruptedException`。Thrown when the operation cannot be completed.
源码Source io/agentscope/builder/web/managed/EnvironmentWorkQueue.java:177–180

ack

public void ack(String leaseId, String workerId, String workDir)

执行确认相关操作。

Performs the ack operation.

参数Parameters
名称Name类型Type说明Description
leaseIdStringlease 标识(类型 `String`)。The lease id.
workerIdString工作进程标识(类型 `String`)。The worker id.
workDirStringwork 目录(类型 `String`)。The work dir.
源码Source io/agentscope/builder/web/managed/EnvironmentWorkQueue.java:182–184

stop

public void stop(String leaseId)

设置停止。

Performs the stop operation.

参数Parameters
名称Name类型Type说明Description
leaseIdStringlease 标识(类型 `String`)。The lease id.
源码Source io/agentscope/builder/web/managed/EnvironmentWorkQueue.java:186–188

heartbeat

public void heartbeat(String leaseId)

设置心跳。

Performs the heartbeat operation.

参数Parameters
名称Name类型Type说明Description
leaseIdStringlease 标识(类型 `String`)。The lease id.
源码Source io/agentscope/builder/web/managed/EnvironmentWorkQueue.java:190–192

get

public Optional<WorkItem> get(String leaseId)

按条件读取数据。

Performs the get operation.

参数Parameters
名称Name类型Type说明Description
leaseIdStringlease 标识(类型 `String`)。The lease id.
返回Returns Optional<WorkItem>
返回可选。Returns optional.
源码Source io/agentscope/builder/web/managed/EnvironmentWorkQueue.java:194–196

list

public List<WorkItem> list(String environmentId, String statusFilter)

执行列表相关操作。

Performs the list operation.

参数Parameters
名称Name类型Type说明Description
environmentIdString环境标识(类型 `String`)。The environment id.
statusFilterString状态过滤器(类型 `String`)。The status filter.
返回Returns List<WorkItem>
返回列出。Returns list.
源码Source io/agentscope/builder/web/managed/EnvironmentWorkQueue.java:198–202

stats

public CoordinationStore.WorkStats stats(String environmentId)

设置该参数。

Performs the stats operation.

参数Parameters
名称Name类型Type说明Description
environmentIdString环境标识(类型 `String`)。The environment id.
返回Returns CoordinationStore.WorkStats
返回CoordinationStore.WorkStats。Returns coordination store work stats.
源码Source io/agentscope/builder/web/managed/EnvironmentWorkQueue.java:204–206

registerWorker

public void registerWorker(String workerId, Object capabilities)

注册工作进程。

Registers the worker.

参数Parameters
名称Name类型Type说明Description
workerIdString工作进程标识(类型 `String`)。The worker id.
capabilitiesObject能力(类型 `Object`)。The capabilities.
源码Source io/agentscope/builder/web/managed/EnvironmentWorkQueue.java:208–218

workerHeartbeats

public Map<String, Long> workerHeartbeats()

返回 workerHeartbeats 结果。

Returns the worker heartbeats.

返回Returns Map<String, Long>
返回映射。Returns map.
源码Source io/agentscope/builder/web/managed/EnvironmentWorkQueue.java:220–222

pendingCount

public int pendingCount()

返回待处理数量。

Returns the pending count.

返回Returns int
返回数值结果。Returns a numeric result.
源码Source io/agentscope/builder/web/managed/EnvironmentWorkQueue.java:224–226

嵌套类详情Nested Class Detail

Status

public enum Status

定义状态的枚举。位于 io.agentscope.builder.web.managed 包。核心成员包括 queued、starting、active、stopping、stopped。

A enum in io.agentscope.builder.web.managed that defines enum values used when components deploys, schedules and serves agents. Declared in io.agentscope.builder.web.managed.

WorkItem

public static final class WorkItem

Work 条目,承载智能体的部署、调度与服务化运行。位于 io.agentscope.builder.web.managed 包。核心成员包括 withMetadata、id、workId、leaseId、sessionId、environmentId。

A class in io.agentscope.builder.web.managed that deploys, schedules and serves agents. Declared in io.agentscope.builder.web.managed.

基于官方固定版本源码静态生成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.