ControlPlaneObserverMiddleware
public final class ControlPlaneObserverMiddleware implements MiddlewareBase
io/agentscope/extensions/controlplane/adapter/ControlPlaneObserverMiddleware.java:54–287控制面观察者中间件,在智能体执行流程中提供横切扩展。位于 io.agentscope.extensions.controlplane.adapter 包,实现 MiddlewareBase。核心成员包括 activePoints、onAgent、onActing、onSystemPrompt。
Middleware that copies conversation activity out to controlplane without touching it.
Purely additive: inputs are forwarded to next unchanged and the resulting event stream
is only tapped, never rewritten or filtered. Removing this middleware changes nothing about how
the agent behaves.
Tool call arguments are read in #onActing, because ToolCallEndEvent carries
only the call's name and id. Tool output text is reassembled from the delta events, which is the
only place the framework exposes it incrementally.
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public Set<ExtensionPoint> activePoints() | 返回 `activePoints` 结果。 Narrow declaration: subclasses overriding more hooks must extend this set. |
public Flux<AgentEvent> onAgent(Agent agent, RuntimeContext ctx, AgentInput input, Function<AgentInput, Flux<AgentEvent>> next) | 处理智能体事件。 Performs the on agent operation. |
public Flux<AgentEvent> onActing(Agent agent, RuntimeContext ctx, ActingInput input, Function<ActingInput, Flux<AgentEvent>> next) | 处理执行事件。 Performs the on acting operation. |
public Mono<String> onSystemPrompt(Agent agent, RuntimeContext ctx, String currentPrompt) | 处理系统提示词事件。 Captures the fully composed system prompt when this middleware is registered last in the
`onSystemPrompt` chain (paw wires controlplane after other middlewares). |
方法详情Method Detail
activePoints
public Set<ExtensionPoint> activePoints()
返回 activePoints 结果。
Narrow declaration: subclasses overriding more hooks must extend this set.
Set<ExtensionPoint>io/agentscope/extensions/controlplane/adapter/ControlPlaneObserverMiddleware.java:66–70onAgent
public Flux<AgentEvent> onAgent(Agent agent, RuntimeContext ctx, AgentInput input, Function<AgentInput, Flux<AgentEvent>> next)
处理智能体事件。
Performs the on agent operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
agent | Agent | 智能体(类型 `Agent`)。The agent. |
ctx | RuntimeContext | 运行时上下文(类型 `RuntimeContext`)。The ctx. |
input | AgentInput | 输入消息(类型 `AgentInput`)。The input. |
next | Function<AgentInput, Flux<AgentEvent>> | 下一个(类型 `Function >`)。The next. |
Flux<AgentEvent>io/agentscope/extensions/controlplane/adapter/ControlPlaneObserverMiddleware.java:72–131onActing
public Flux<AgentEvent> onActing(Agent agent, RuntimeContext ctx, ActingInput input, Function<ActingInput, Flux<AgentEvent>> next)
处理执行事件。
Performs the on acting operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
agent | Agent | 智能体(类型 `Agent`)。The agent. |
ctx | RuntimeContext | 运行时上下文(类型 `RuntimeContext`)。The ctx. |
input | ActingInput | 输入消息(类型 `ActingInput`)。The input. |
next | Function<ActingInput, Flux<AgentEvent>> | 下一个(类型 `Function >`)。The next. |
Flux<AgentEvent>io/agentscope/extensions/controlplane/adapter/ControlPlaneObserverMiddleware.java:178–198onSystemPrompt
public Mono<String> onSystemPrompt(Agent agent, RuntimeContext ctx, String currentPrompt)
处理系统提示词事件。
Captures the fully composed system prompt when this middleware is registered last in the onSystemPrompt chain (paw wires controlplane after other middlewares).
| 名称Name | 类型Type | 说明Description |
|---|---|---|
agent | Agent | 智能体(类型 `Agent`)。The agent. |
ctx | RuntimeContext | 运行时上下文(类型 `RuntimeContext`)。The ctx. |
currentPrompt | String | 当前提示词(类型 `String`)。The current prompt. |
Mono<String>io/agentscope/extensions/controlplane/adapter/ControlPlaneObserverMiddleware.java:204–209