AS AgentScopeAPI 手册 / API Reference

ControlPlane

public final class ControlPlane
源码Source io/agentscope/extensions/controlplane/ControlPlane.java:52–75

控制面,承载智能体的部署、调度与服务化运行。位于 io.agentscope.extensions.controlplane 包。核心成员包括 instrument、newBridge。

Entry point for reporting a self-deployed agent to the controlplane control plane.

Full instrumentation, including the Level-2 event stream, needs the observer middleware registered while the agent is being built, because a ReActAgent's middleware list is fixed at construction:

`AgentScopeAdapter adapter = new AgentScopeAdapter();
ReActAgent agent = ReActAgent.builder()
.name("Friday")
.model(model)
.middleware(adapter.middleware())
.build();

SessionBridge bridge = ControlPlane.instrument(agent,
ControlPlaneConfig.builder("my-agentscope-agent")
.controlPlaneHttp("http://localhost:8081")
.internalToken(System.getenv("BUILDER_INTERNAL_TOKEN"))
.namespace("default")
.enableEvents(true)
.contractHttpPort(18090)
.build(),
adapter);
`

#instrument(Object, ControlPlaneConfig) also works on an agent that is already built. It reports session snapshots, effective context, history and commands — everything that reads live state — but emits no events, since there is no way to add a middleware after construction.

The returned bridge is AutoCloseable; close it to detach and release both channels.

方法摘要Method Summary

方法Method说明Description
public static SessionBridge instrument(Object target, ControlPlaneConfig config)
static
执行 `instrument` 方法。
Instruments an already-built agent.
public static SessionBridge instrument(Object target, ControlPlaneConfig config, FrameworkAdapter adapter)
static
执行 `instrument` 方法。
Instruments `target` with a pre-built adapter, typically one already wired as a middleware on the agent.
public static SessionBridge newBridge(ControlPlaneConfig config)
static
创建 `newBridge`。
Creates a bridge without attaching or starting it, for callers that need to hold the adapter before the agent exists.

方法详情Method Detail

instrument

public static SessionBridge instrument(Object target, ControlPlaneConfig config)
static

执行 instrument 方法。

Instruments an already-built agent.

参数Parameters
名称Name类型Type说明Description
targetObject目标(类型 `Object`)。The target.
configControlPlaneConfig配置对象(类型 `ControlPlaneConfig`)。The config.
返回Returns SessionBridge
返回SessionBridge。Returns session bridge.
源码Source io/agentscope/extensions/controlplane/ControlPlane.java:57–59

instrument

public static SessionBridge instrument(Object target, ControlPlaneConfig config, FrameworkAdapter adapter)
static

执行 instrument 方法。

Instruments target with a pre-built adapter, typically one already wired as a middleware on the agent.

参数Parameters
名称Name类型Type说明Description
targetObject目标(类型 `Object`)。The target.
configControlPlaneConfig配置对象(类型 `ControlPlaneConfig`)。The config.
adapterFrameworkAdapter适配器(类型 `FrameworkAdapter`)。The adapter.
返回Returns SessionBridge
返回SessionBridge。Returns session bridge.
源码Source io/agentscope/extensions/controlplane/ControlPlane.java:63–66

newBridge

public static SessionBridge newBridge(ControlPlaneConfig config)
static

创建 newBridge。

Creates a bridge without attaching or starting it, for callers that need to hold the adapter before the agent exists.

参数Parameters
名称Name类型Type说明Description
configControlPlaneConfig配置对象(类型 `ControlPlaneConfig`)。The config.
返回Returns SessionBridge
返回SessionBridge。Returns session bridge.
源码Source io/agentscope/extensions/controlplane/ControlPlane.java:72–74
基于官方固定版本源码静态生成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.