AgentScopeAdapter
public final class AgentScopeAdapter implements FrameworkAdapter
io/agentscope/extensions/controlplane/adapter/AgentScopeAdapter.java:80–1021AgentScope 适配器,承载智能体的部署、调度与服务化运行。位于 io.agentscope.extensions.controlplane.adapter 包,实现 FrameworkAdapter。核心成员包括 middleware、setHistorySource、setRuntimeSource、setAgentTaskStarter、frameworkName、frameworkVersion。
Bypass-observation adapter for a self-deployed AgentScope Java agent.
This is the BYO path: the user writes and runs their own agent, and controlplane observes it from
the side. It is unrelated to managed-agents mode, where the data plane service implements the
/agentscope/* contract directly because it owns the runtime.
Observation rides on ControlPlaneObserverMiddleware, which passes every input and event
through untouched. Context and history are read from AgentState, which is the same buffer
the agent will hand to its next model call, so what the console shows is what the model sees.
Middlewares are fixed when a ReActAgent is built, so the event stream requires
registering #middleware() at build time:
`AgentScopeAdapter adapter = new AgentScopeAdapter();
ReActAgent agent = ReActAgent.builder()
.middleware(adapter.middleware())
.build();
SessionBridge bridge = ControlPlane.instrument(agent, config, adapter);
`
An already-built agent can still be instrumented — snapshots, context, history and commands all read live state — but it produces no Level-2 events.
字段摘要Field Summary
| 字段Field | 类型Type | 说明Description |
|---|---|---|
FRAMEWORKstaticfinal | String | FRAMEWORK字段。 The FRAMEWORK field. |
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
public AgentScopeAdapter() | 初始化 `AgentScopeAdapter` 实例。 Creates a new instance. |
public AgentScopeAdapter(SessionCompactor compactor) | 初始化 `AgentScopeAdapter` 实例。 Creates a new instance. |
方法摘要Method Summary
字段详情Field Detail
FRAMEWORK
public static final String FRAMEWORK
FRAMEWORK字段。声明为 public static final String FRAMEWORK。
The FRAMEWORK field.
io/agentscope/extensions/controlplane/adapter/AgentScopeAdapter.java:84构造器详情Constructor Detail
AgentScopeAdapter
public AgentScopeAdapter()
初始化 AgentScopeAdapter 实例。
Creates a new instance.
io/agentscope/extensions/controlplane/adapter/AgentScopeAdapter.java:107–109AgentScopeAdapter
public AgentScopeAdapter(SessionCompactor compactor)
初始化 AgentScopeAdapter 实例。
Creates a new instance.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
compactor | SessionCompactor | compactor(类型 `SessionCompactor`)。handles `compress`; `null` leaves that command unsupported |
io/agentscope/extensions/controlplane/adapter/AgentScopeAdapter.java:114–117方法详情Method Detail
middleware
public ControlPlaneObserverMiddleware middleware()
中间件到注册 on 智能体构建器到启用 Level-2 事件流。
The middleware to register on the agent builder to enable the Level-2 event stream.
ControlPlaneObserverMiddlewareio/agentscope/extensions/controlplane/adapter/AgentScopeAdapter.java:120–122setHistorySource
public void setHistorySource(SessionHistorySource historySource)
设置历史来源。
Optional full-history reader (e.g.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
historySource | SessionHistorySource | 历史来源(类型 `SessionHistorySource`)。The history source. |
io/agentscope/extensions/controlplane/adapter/AgentScopeAdapter.java:128–130setRuntimeSource
public void setRuntimeSource(AgentRuntimeSource runtimeSource)
设置运行时来源。
Optional harness-/app hooks for inventory, plan files, subagent tasks and Definition enrich.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
runtimeSource | AgentRuntimeSource | 运行时来源(类型 `AgentRuntimeSource`)。The runtime source. |
io/agentscope/extensions/controlplane/adapter/AgentScopeAdapter.java:135–137setAgentTaskStarter
public void setAgentTaskStarter(AgentTaskStarter agentTaskStarter)
设置智能体任务启动器。
Installs the host hook that materializes ASDP AgentTask deliveries.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
agentTaskStarter | AgentTaskStarter | 智能体任务启动器(类型 `AgentTaskStarter`)。The agent task starter. |
io/agentscope/extensions/controlplane/adapter/AgentScopeAdapter.java:140–142frameworkName
public String frameworkName()
返回 frameworkName 结果。
Returns the framework name.
Stringio/agentscope/extensions/controlplane/adapter/AgentScopeAdapter.java:146–149frameworkVersion
public String frameworkVersion()
返回 frameworkVersion 结果。
Returns the framework version.
Stringio/agentscope/extensions/controlplane/adapter/AgentScopeAdapter.java:151–155canHandle
public boolean canHandle(Object target)
判断是否可以 canHandle。
Returns whether the handle.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
target | Object | 目标(类型 `Object`)。The target. |
booleanio/agentscope/extensions/controlplane/adapter/AgentScopeAdapter.java:157–160capabilities
public Set<String> capabilities()
返回能力。
Returns the capabilities.
Set<String>io/agentscope/extensions/controlplane/adapter/AgentScopeAdapter.java:162–185attach
public void attach(Object target, Consumer<SessionEvent> emit)
执行 attach 方法。
Performs the attach operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
target | Object | 目标(类型 `Object`)。The target. |
emit | Consumer<SessionEvent> | 发出(类型 `Consumer`)。The emit. |
io/agentscope/extensions/controlplane/adapter/AgentScopeAdapter.java:189–193detach
public void detach()
执行 detach 方法。
Returns the detach.
io/agentscope/extensions/controlplane/adapter/AgentScopeAdapter.java:195–201onBridgeAttached
public void onBridgeAttached(SessionBridge bridge)
处理 onBridgeAttached 事件。
Performs the on bridge attached operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
bridge | SessionBridge | bridge(类型 `SessionBridge`)。The bridge. |
io/agentscope/extensions/controlplane/adapter/AgentScopeAdapter.java:203–206extractContext
public Mono<ContextSnapshot> extractContext(String sessionId)
设置该参数。
Performs the extract context operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sessionId | String | 会话标识(类型 `String`)。The session id. |
Mono<ContextSnapshot>io/agentscope/extensions/controlplane/adapter/AgentScopeAdapter.java:345–403listMessages
public Mono<MessagePage> listMessages(String sessionId, int offset, int limit)
列出消息。
Lists the messages.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sessionId | String | 会话标识(类型 `String`)。The session id. |
offset | int | 偏移量(类型 `int`)。The offset. |
limit | int | 数量上限(类型 `int`)。The limit. |
Mono<MessagePage>io/agentscope/extensions/controlplane/adapter/AgentScopeAdapter.java:464–499handleCommand
public Mono<Void> handleCommand(String sessionId, String command, byte[] params)
处理命令。
Performs the handle command operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sessionId | String | 会话标识(类型 `String`)。The session id. |
command | String | 命令(类型 `String`)。The command. |
params | byte[] | 参数(类型 `byte[]`)。The params. |
Mono<Void>io/agentscope/extensions/controlplane/adapter/AgentScopeAdapter.java:503–535handleAgentTask
public Mono<Void> handleAgentTask(io.agentscope.extensions.controlplane.model.AgentTaskAssignment assignment)
处理智能体任务。
Performs the handle agent task operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
assignment | io.agentscope.extensions.controlplane.model.AgentTaskAssignment | assignment(类型 `io.agentscope.extensions.controlplane.model.AgentTaskAssignment`)。The assignment. |
Mono<Void>io/agentscope/extensions/controlplane/adapter/AgentScopeAdapter.java:537–552injectUserMessage
public Mono<Void> injectUserMessage(String sessionId, String content)
执行 injectUserMessage 方法。
Performs the inject user message operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sessionId | String | 会话标识(类型 `String`)。The session id. |
content | String | 内容(类型 `String`)。The content. |
Mono<Void>io/agentscope/extensions/controlplane/adapter/AgentScopeAdapter.java:554–557runConversationTurn
public Mono<String> runConversationTurn(String sessionId, String content)
运行会话轮次。
Runs the conversation turn.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sessionId | String | 会话标识(类型 `String`)。The session id. |
content | String | 内容(类型 `String`)。The content. |
Mono<String>io/agentscope/extensions/controlplane/adapter/AgentScopeAdapter.java:559–562listTasks
public Mono<List<Map<String, Object>>> listTasks(String sessionId)
列出任务。
Lists the tasks.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sessionId | String | 会话标识(类型 `String`)。The session id. |
Mono<List<Map<String, Object>>>io/agentscope/extensions/controlplane/adapter/AgentScopeAdapter.java:580–595listSubagents
public Mono<List<Inventory.SubagentInfo>> listSubagents()
列出 listSubagents。
Lists the subagents.
Mono<List<Inventory.SubagentInfo>>io/agentscope/extensions/controlplane/adapter/AgentScopeAdapter.java:629–640listWorkspaces
public Mono<List<Inventory.WorkspaceInfo>> listWorkspaces()
列出 listWorkspaces。
Lists the workspaces.
Mono<List<Inventory.WorkspaceInfo>>io/agentscope/extensions/controlplane/adapter/AgentScopeAdapter.java:642–653listSubagentTasks
public Mono<List<Map<String, Object>>> listSubagentTasks(String sessionId)
列出子智能体任务。
Lists the subagent tasks.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sessionId | String | 会话标识(类型 `String`)。The session id. |
Mono<List<Map<String, Object>>>io/agentscope/extensions/controlplane/adapter/AgentScopeAdapter.java:655–667cancelSubagentTask
public Mono<Void> cancelSubagentTask(String sessionId, String taskId)
执行取消子智能体任务相关操作。
Performs the cancel subagent task operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sessionId | String | 会话标识(类型 `String`)。The session id. |
taskId | String | 任务标识(类型 `String`)。The task id. |
Mono<Void>io/agentscope/extensions/controlplane/adapter/AgentScopeAdapter.java:669–691setPlanMode
public Mono<Void> setPlanMode(String sessionId, byte[] params)
设置计划模式。
Sets the plan mode.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sessionId | String | 会话标识(类型 `String`)。The session id. |
params | byte[] | 参数(类型 `byte[]`)。The params. |
Mono<Void>io/agentscope/extensions/controlplane/adapter/AgentScopeAdapter.java:693–714buildAgentConfig
public Map<String, Object> buildAgentConfig()
构建智能体配置。
Builds the agent config.
Map<String, Object>io/agentscope/extensions/controlplane/adapter/AgentScopeAdapter.java:753–801继承成员Inherited Members
FrameworkAdapterhandleAgentTask, CAP_CONTEXT_QUERY, CAP_MESSAGE_QUERY, CAP_SUBAGENT_INVENTORY, CAP_WORKSPACE_INVENTORY, CAP_SESSION_COMMAND, CAP_SESSION_ABORT, CAP_TASK_QUERY, CAP_SUBAGENT_TASK_QUERY, CAP_SUBAGENT_TASK_COMMAND, CAP_PLAN_MODE, CAP_AGENT_TASK, CAP_EXPORT_TRANSCRIPT, CAP_CONVERSATION_INBOUND, COMMAND_COMPRESS, COMMAND_TERMINATE, COMMAND_ABORT