AS AgentScopeAPI 手册 / API Reference

ControlPlaneObserverMiddleware

public final class ControlPlaneObserverMiddleware implements MiddlewareBase
源码Source 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.

返回Returns Set<ExtensionPoint>
返回设置。Returns set.
源码Source io/agentscope/extensions/controlplane/adapter/ControlPlaneObserverMiddleware.java:66–70

onAgent

public Flux<AgentEvent> onAgent(Agent agent, RuntimeContext ctx, AgentInput input, Function<AgentInput, Flux<AgentEvent>> next)

处理智能体事件。

Performs the on agent operation.

参数Parameters
名称Name类型Type说明Description
agentAgent智能体(类型 `Agent`)。The agent.
ctxRuntimeContext运行时上下文(类型 `RuntimeContext`)。The ctx.
inputAgentInput输入消息(类型 `AgentInput`)。The input.
nextFunction<AgentInput, Flux<AgentEvent>>下一个(类型 `Function >`)。The next.
返回Returns Flux<AgentEvent>
返回Flux。Returns flux.
源码Source io/agentscope/extensions/controlplane/adapter/ControlPlaneObserverMiddleware.java:72–131

onActing

public Flux<AgentEvent> onActing(Agent agent, RuntimeContext ctx, ActingInput input, Function<ActingInput, Flux<AgentEvent>> next)

处理执行事件。

Performs the on acting operation.

参数Parameters
名称Name类型Type说明Description
agentAgent智能体(类型 `Agent`)。The agent.
ctxRuntimeContext运行时上下文(类型 `RuntimeContext`)。The ctx.
inputActingInput输入消息(类型 `ActingInput`)。The input.
nextFunction<ActingInput, Flux<AgentEvent>>下一个(类型 `Function >`)。The next.
返回Returns Flux<AgentEvent>
返回Flux。Returns flux.
源码Source io/agentscope/extensions/controlplane/adapter/ControlPlaneObserverMiddleware.java:178–198

onSystemPrompt

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).

参数Parameters
名称Name类型Type说明Description
agentAgent智能体(类型 `Agent`)。The agent.
ctxRuntimeContext运行时上下文(类型 `RuntimeContext`)。The ctx.
currentPromptString当前提示词(类型 `String`)。The current prompt.
返回Returns Mono<String>
返回Mono。Returns mono.
源码Source io/agentscope/extensions/controlplane/adapter/ControlPlaneObserverMiddleware.java:204–209

继承成员Inherited Members

继承自Methods inherited from MiddlewareBase
基于官方固定版本源码静态生成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.