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
SqliteBaseStorefor injection at the next reasoning step byMessageQueueMiddleware
构造器摘要Constructor Summary
方法摘要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 |
|---|---|---|
gateway | Gateway | 网关(类型 `Gateway`)。The gateway. |
store | BaseStore | 存储实例(类型 `BaseStore`)。The store. |
源码Source
io/agentscope/harness/coding/control/RunDispatcher.java:52–54RunDispatcher
public RunDispatcher(Gateway gateway, BaseStore store, CodingAgentMetrics metrics)
初始化 RunDispatcher 实例。
Creates a new instance.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
gateway | Gateway | 网关(类型 `Gateway`)。The gateway. |
store | BaseStore | 存储实例(类型 `BaseStore`)。The store. |
metrics | CodingAgentMetrics | 指标(类型 `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 |
|---|---|---|
threadId | String | 会话线程标识(类型 `String`)。The thread id. |
agentId | String | 智能体标识(类型 `String`)。The agent id. |
prompt | String | 提示词(类型 `String`)。The prompt. |
githubToken | String | github 令牌(类型 `String`)。The github token. |
Mono<Void>返回Mono。Returns mono.
源码Source
io/agentscope/harness/coding/control/RunDispatcher.java:63–65dispatch
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 |
|---|---|---|
threadId | String | 会话线程标识(类型 `String`)。canonical thread ID (used as sessionId in context) |
agentId | String | 智能体标识(类型 `String`)。agent to dispatch to (e.g. "coding" or "reviewer") |
prompt | String | 提示词(类型 `String`)。user prompt / webhook event description |
githubToken | String | 用于此会话的可选已解密 GitHub 令牌。optional decrypted GitHub token for this session |
userId | String | 用户标识(类型 `String`)。optional authenticated user identity, propagated to `MsgContext` for HarnessAgent namespace isolation |
Mono<Void>返回Mono。Returns mono.
源码Source
io/agentscope/harness/coding/control/RunDispatcher.java:77–145enqueue
public void enqueue(String threadId, String payload)
执行 enqueue 方法。
Enqueues a message for injection into the next reasoning step.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
threadId | String | 会话线程标识(类型 `String`)。thread to enqueue for |
payload | String | 负载(类型 `String`)。message payload text |
源码Source
io/agentscope/harness/coding/control/RunDispatcher.java:153–157dispatchReviewer
public Mono<Void> dispatchReviewer(String prUrl)
设置该参数。
Dispatches the reviewer agent on a PR URL.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
prUrl | String | pr URL(类型 `String`)。full GitHub PR URL |
Mono<Void>返回Mono。Returns mono.
源码Source
io/agentscope/harness/coding/control/RunDispatcher.java:165–172