@Preview(value="3.8.1")
public class SupervisorTask
extends java.lang.Object
implements org.noear.solon.flow.NamedTaskComponent
核心职责:作为协调中枢,基于 LLM 推理结果进行任务分发、成员调度及协作终止判定。
| 限定符和类型 | 字段和说明 |
|---|---|
protected TeamAgentConfig |
config |
protected static org.slf4j.Logger |
LOG |
| 构造器和说明 |
|---|
SupervisorTask(TeamAgentConfig config) |
| 限定符和类型 | 方法和说明 |
|---|---|
protected ChatResponse |
callWithRetry(org.noear.solon.flow.Node node,
TeamTrace trace,
java.util.List<ChatMessage> messages)
带重试机制的模型调用
|
protected void |
commitRoute(TeamTrace trace,
java.lang.String decision,
org.noear.solon.flow.FlowContext context)
将决策文本解析为物理路由目标
|
protected void |
dispatch(org.noear.solon.flow.Node node,
org.noear.solon.flow.FlowContext context,
TeamTrace trace)
构建 Prompt 并调用模型进行调度决策
|
protected void |
handleError(org.noear.solon.flow.FlowContext context,
java.lang.Exception e) |
protected boolean |
matchAgentRoute(org.noear.solon.flow.FlowContext context,
TeamTrace trace,
java.lang.String text)
模糊匹配文本中的 Agent 名称
|
java.lang.String |
name() |
protected void |
routeTo(org.noear.solon.flow.FlowContext context,
TeamTrace trace,
java.lang.String targetName) |
void |
run(org.noear.solon.flow.FlowContext context,
org.noear.solon.flow.Node node) |
protected static final org.slf4j.Logger LOG
protected final TeamAgentConfig config
public SupervisorTask(TeamAgentConfig config)
public java.lang.String name()
name 在接口中 org.noear.solon.flow.NamedTaskComponentpublic void run(org.noear.solon.flow.FlowContext context,
org.noear.solon.flow.Node node)
throws java.lang.Throwable
run 在接口中 org.noear.solon.flow.TaskComponentjava.lang.Throwableprotected void dispatch(org.noear.solon.flow.Node node,
org.noear.solon.flow.FlowContext context,
TeamTrace trace)
throws java.lang.Exception
java.lang.Exceptionprotected void commitRoute(TeamTrace trace, java.lang.String decision, org.noear.solon.flow.FlowContext context)
protected boolean matchAgentRoute(org.noear.solon.flow.FlowContext context,
TeamTrace trace,
java.lang.String text)
protected ChatResponse callWithRetry(org.noear.solon.flow.Node node, TeamTrace trace, java.util.List<ChatMessage> messages)
protected void routeTo(org.noear.solon.flow.FlowContext context,
TeamTrace trace,
java.lang.String targetName)
protected void handleError(org.noear.solon.flow.FlowContext context,
java.lang.Exception e)