AS AgentScopeAPI 手册 / API Reference

RunDispatcher

public class RunDispatcher
源码Source io/agentscope/harness/coding/control/RunDispatcher.java:44–203

运行调度器,承载智能体的部署、调度与服务化运行。位于 io.agentscope.harness.coding.control 包。核心成员包括 dispatch、enqueue、dispatchReviewer、RunDispatcher。

Dispatches agent runs, handling busy-thread queueing.

  • If the thread is idle, dispatch immediately via Gateway#run

  • If the thread is busy, enqueue the message in SqliteBaseStore for injection at the next reasoning step by MessageQueueMiddleware

构造器摘要Constructor Summary

构造器Constructor说明Description
public RunDispatcher(Gateway gateway, BaseStore store)
初始化 `RunDispatcher` 实例。
Creates a new instance.
public RunDispatcher(Gateway gateway, BaseStore store, CodingAgentMetrics metrics)
初始化 `RunDispatcher` 实例。
Creates a new instance.

方法摘要Method Summary

方法Method说明Description
public Mono<Void> dispatch(String threadId, String agentId, String prompt, String githubToken)
执行 `dispatch` 方法。
Backwards-compatible overload without `userId`.
public Mono<Void> dispatch(String threadId, String agentId, String prompt, String githubToken, String userId)
执行 `dispatch` 方法。
Dispatches an agent run or enqueues the message if the thread is busy.
public void enqueue(String threadId, String payload)
执行 `enqueue` 方法。
Enqueues a message for injection into the next reasoning step.
public Mono<Void> dispatchReviewer(String prUrl)
设置该参数。
Dispatches the reviewer agent on a PR URL.

构造器详情Constructor Detail

RunDispatcher

public RunDispatcher(Gateway gateway, BaseStore store)

初始化 RunDispatcher 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
gatewayGateway网关(类型 `Gateway`)。The gateway.
storeBaseStore存储实例(类型 `BaseStore`)。The store.
源码Source io/agentscope/harness/coding/control/RunDispatcher.java:52–54

RunDispatcher

public RunDispatcher(Gateway gateway, BaseStore store, CodingAgentMetrics metrics)

初始化 RunDispatcher 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
gatewayGateway网关(类型 `Gateway`)。The gateway.
storeBaseStore存储实例(类型 `BaseStore`)。The store.
metricsCodingAgentMetrics指标(类型 `CodingAgentMetrics`)。The metrics.
源码Source io/agentscope/harness/coding/control/RunDispatcher.java:56–60

方法详情Method Detail

dispatch

public Mono<Void> dispatch(String threadId, String agentId, String prompt, String githubToken)

执行 dispatch 方法。

Backwards-compatible overload without userId.

参数Parameters
名称Name类型Type说明Description
threadIdString会话线程标识(类型 `String`)。The thread id.
agentIdString智能体标识(类型 `String`)。The agent id.
promptString提示词(类型 `String`)。The prompt.
githubTokenStringgithub 令牌(类型 `String`)。The github token.
返回Returns Mono<Void>
返回Mono。Returns mono.
源码Source io/agentscope/harness/coding/control/RunDispatcher.java:63–65

dispatch

public Mono<Void> dispatch(String threadId, String agentId, String prompt, String githubToken, String userId)

执行 dispatch 方法。

Dispatches an agent run or enqueues the message if the thread is busy.

参数Parameters
名称Name类型Type说明Description
threadIdString会话线程标识(类型 `String`)。canonical thread ID (used as sessionId in context)
agentIdString智能体标识(类型 `String`)。agent to dispatch to (e.g. "coding" or "reviewer")
promptString提示词(类型 `String`)。user prompt / webhook event description
githubTokenString用于此会话的可选已解密 GitHub 令牌。optional decrypted GitHub token for this session
userIdString用户标识(类型 `String`)。optional authenticated user identity, propagated to `MsgContext` for HarnessAgent namespace isolation
返回Returns Mono<Void>
返回Mono。Returns mono.
源码Source io/agentscope/harness/coding/control/RunDispatcher.java:77–145

enqueue

public void enqueue(String threadId, String payload)

执行 enqueue 方法。

Enqueues a message for injection into the next reasoning step.

参数Parameters
名称Name类型Type说明Description
threadIdString会话线程标识(类型 `String`)。thread to enqueue for
payloadString负载(类型 `String`)。message payload text
源码Source io/agentscope/harness/coding/control/RunDispatcher.java:153–157

dispatchReviewer

public Mono<Void> dispatchReviewer(String prUrl)

设置该参数。

Dispatches the reviewer agent on a PR URL.

参数Parameters
名称Name类型Type说明Description
prUrlStringpr URL(类型 `String`)。full GitHub PR URL
返回Returns Mono<Void>
返回Mono。Returns mono.
源码Source io/agentscope/harness/coding/control/RunDispatcher.java:165–172
基于官方固定版本源码静态生成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.