ControlPlane
public final class ControlPlane
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)
执行 instrument 方法。
Instruments an already-built agent.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
target | Object | 目标(类型 `Object`)。The target. |
config | ControlPlaneConfig | 配置对象(类型 `ControlPlaneConfig`)。The config. |
SessionBridgeio/agentscope/extensions/controlplane/ControlPlane.java:57–59instrument
public static SessionBridge instrument(Object target, ControlPlaneConfig config, FrameworkAdapter adapter)
执行 instrument 方法。
Instruments target with a pre-built adapter, typically one already wired as a middleware on the agent.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
target | Object | 目标(类型 `Object`)。The target. |
config | ControlPlaneConfig | 配置对象(类型 `ControlPlaneConfig`)。The config. |
adapter | FrameworkAdapter | 适配器(类型 `FrameworkAdapter`)。The adapter. |
SessionBridgeio/agentscope/extensions/controlplane/ControlPlane.java:63–66newBridge
public static SessionBridge newBridge(ControlPlaneConfig config)
创建 newBridge。
Creates a bridge without attaching or starting it, for callers that need to hold the adapter before the agent exists.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
config | ControlPlaneConfig | 配置对象(类型 `ControlPlaneConfig`)。The config. |
SessionBridgeio/agentscope/extensions/controlplane/ControlPlane.java:72–74