ControlPlaneClient
@Service public class ControlPlaneClient
io/agentscope/builder/control/ControlPlaneClient.java:48–604控制面客户端,封装与远端服务的连接和调用。位于 io.agentscope.builder.control 包。核心成员包括 collaborationMcpUrl、appendSessionEvent、heartbeatManagedExecution、resolveSession、beginManagedExecution、endManagedExecution。
Data-plane HTTP client for control-plane (aistiod) internal APIs. Session and environment metadata live in the CP schema; the data plane must not SELECT those tables directly.
Authenticates with X-Builder-Internal-Token; optional X-Builder-Internal-User attributes the call to an acting owner. Methods currently block() for simplicity — callers on WebFlux handlers must schedule onto Schedulers.boundedElastic() (see DataSessionApiController).
嵌套类摘要Nested Class Summary
| 类Class | 类型Kind | 说明Description |
|---|---|---|
ManagedExecutionScope | 记录record | 承载托管执行范围数据的记录类型。 Immutable fence attached to all events emitted by one admitted Managed AgentTask turn. |
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
public ControlPlaneClient(String controlPlaneUrl, String internalToken, ObjectMapper objectMapper) | 初始化 `ControlPlaneClient` 实例。 Creates a new instance. |
方法摘要Method Summary
构造器详情Constructor Detail
ControlPlaneClient
public ControlPlaneClient(String controlPlaneUrl, String internalToken, ObjectMapper objectMapper)
初始化 ControlPlaneClient 实例。
Creates a new instance.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
controlPlaneUrl | String | 控制面 URL(类型 `String`)。The control plane url. |
internalToken | String | 内部令牌(类型 `String`)。The internal token. |
objectMapper | ObjectMapper | 对象 Mapper(类型 `ObjectMapper`)。The object mapper. |
io/agentscope/builder/control/ControlPlaneClient.java:60–71方法详情Method Detail
collaborationMcpUrl
public String collaborationMcpUrl()
返回 collaborationMcpUrl 结果。
Absolute URL of the task-scoped collaboration MCP endpoint.
Stringio/agentscope/builder/control/ControlPlaneClient.java:74–76appendSessionEvent
public void appendSessionEvent(SessionEventDto event)
追加会话事件。
Mirrors one durable managed event into the control-plane session read model.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
event | SessionEventDto | 事件(类型 `SessionEventDto`)。The event. |
io/agentscope/builder/control/ControlPlaneClient.java:79–81appendSessionEvent
public void appendSessionEvent(SessionEventDto event, ManagedExecutionScope scope)
追加会话事件。
Mirrors one event with an explicit immutable fence, including from a different replica.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
event | SessionEventDto | 事件(类型 `SessionEventDto`)。The event. |
scope | ManagedExecutionScope | 范围(类型 `ManagedExecutionScope`)。The scope. |
io/agentscope/builder/control/ControlPlaneClient.java:84–104heartbeatManagedExecution
public void heartbeatManagedExecution(String sessionId)
设置心跳托管执行。
Renews the current managed AgentTask attempt while its model turn is active.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sessionId | String | 会话标识(类型 `String`)。The session id. |
io/agentscope/builder/control/ControlPlaneClient.java:107–113heartbeatManagedExecution
public void heartbeatManagedExecution(String sessionId, ManagedExecutionScope scope)
执行心跳托管执行相关操作。
Heartbeats one captured turn without accidentally adopting a newer session scope.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sessionId | String | 会话标识(类型 `String`)。The session id. |
scope | ManagedExecutionScope | 范围(类型 `ManagedExecutionScope`)。The scope. |
io/agentscope/builder/control/ControlPlaneClient.java:116–136resolveSession
public SessionResolveResult resolveSession(String sessionId)
解析会话。
Resolves a session plus agent snapshot, environment, vault credentials and memory mounts in one round-trip.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sessionId | String | 会话标识(类型 `String`)。The session id. |
SessionResolveResultio/agentscope/builder/control/ControlPlaneClient.java:142–144resolveSession
public SessionResolveResult resolveSession(String sessionId, String actingUserId)
解析会话。
Resolves a session, optionally attributing the call to actingUserId.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sessionId | String | 会话标识(类型 `String`)。The session id. |
actingUserId | String | 执行用户标识(类型 `String`)。The acting user id. |
SessionResolveResultio/agentscope/builder/control/ControlPlaneClient.java:147–180beginManagedExecution
public ManagedExecutionScope beginManagedExecution(String sessionId)
设置该参数。
Captures the Attempt fence for one admitted physical turn.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sessionId | String | 会话标识(类型 `String`)。The session id. |
ManagedExecutionScopeio/agentscope/builder/control/ControlPlaneClient.java:187–196endManagedExecution
public void endManagedExecution(String sessionId)
设置结束托管执行。
Releases the immutable Attempt fence captured for a completed physical turn.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sessionId | String | 会话标识(类型 `String`)。The session id. |
io/agentscope/builder/control/ControlPlaneClient.java:199–201endManagedExecution
public void endManagedExecution(String sessionId, ManagedExecutionScope expectedScope)
执行结束托管执行相关操作。
Releases this turn's scope without deleting a newer turn that reused the same session.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sessionId | String | 会话标识(类型 `String`)。The session id. |
expectedScope | ManagedExecutionScope | expected 范围(类型 `ManagedExecutionScope`)。The expected scope. |
io/agentscope/builder/control/ControlPlaneClient.java:204–208managedExecutionScope
public ManagedExecutionScope managedExecutionScope(String sessionId)
设置托管执行范围。
Returns the immutable AgentTask execution fence captured for the active physical turn.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sessionId | String | 会话标识(类型 `String`)。The session id. |
ManagedExecutionScopeio/agentscope/builder/control/ControlPlaneClient.java:211–213listSessions
public List<SessionListItem> listSessions()
列出会话。
Lists recent product sessions for data-plane contract probing (GET /agentscope/sessions).
List<SessionListItem>io/agentscope/builder/control/ControlPlaneClient.java:259–261listSessions
public List<SessionListItem> listSessions(int limit)
列出会话。
Lists recent product sessions, capped at limit (server may clamp further).
| 名称Name | 类型Type | 说明Description |
|---|---|---|
limit | int | 数量上限(类型 `int`)。preferred upper bound |
List<SessionListItem>io/agentscope/builder/control/ControlPlaneClient.java:269–310registerDataPlane
public long registerDataPlane(Map<String, Object> body)
注册数据面。
Registers this data-plane instance with aistiod (POST /api/v1/dataplanes/register).
| 名称Name | 类型Type | 说明Description |
|---|---|---|
body | Map<String, Object> | 正文(类型 `Map`)。The body. |
longio/agentscope/builder/control/ControlPlaneClient.java:317–342heartbeatDataPlane
public void heartbeatDataPlane(String instanceId)
设置心跳数据面。
Heartbeats a registered instance (POST /api/v1/dataplanes/{id}/heartbeat).
| 名称Name | 类型Type | 说明Description |
|---|---|---|
instanceId | String | 实例标识(类型 `String`)。The instance id. |
io/agentscope/builder/control/ControlPlaneClient.java:345–363deleteDataPlane
public void deleteDataPlane(String instanceId)
删除数据面。
Unregisters a data-plane instance (DELETE /api/v1/dataplanes/{id}).
| 名称Name | 类型Type | 说明Description |
|---|---|---|
instanceId | String | 实例标识(类型 `String`)。The instance id. |
io/agentscope/builder/control/ControlPlaneClient.java:366–383patchSessionRuntime
public void patchSessionRuntime(String sessionId, String status, Map<String, Object> stopReason)
执行 patchSessionRuntime 方法。
Patches runtime fields (status, stopReason) on a session.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sessionId | String | 会话标识(类型 `String`)。The session id. |
status | String | 状态(类型 `String`)。The status. |
stopReason | Map<String, Object> | 停止推理(类型 `Map`)。The stop reason. |
io/agentscope/builder/control/ControlPlaneClient.java:389–392patchSessionRuntime
public void patchSessionRuntime(String sessionId, String status, Map<String, Object> stopReason, String actingUserId)
执行 patchSessionRuntime 方法。
Patches session runtime status, optionally attributing the call to actingUserId.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sessionId | String | 会话标识(类型 `String`)。The session id. |
status | String | 状态(类型 `String`)。The status. |
stopReason | Map<String, Object> | 停止推理(类型 `Map`)。The stop reason. |
actingUserId | String | 执行用户标识(类型 `String`)。The acting user id. |
io/agentscope/builder/control/ControlPlaneClient.java:395–398patchSessionRuntime
public void patchSessionRuntime(String sessionId, String status, Map<String, Object> stopReason, String actingUserId, ManagedExecutionScope scope)
执行 patchSessionRuntime 方法。
Patches runtime status with the immutable fence captured when this physical turn was admitted.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sessionId | String | 会话标识(类型 `String`)。The session id. |
status | String | 状态(类型 `String`)。The status. |
stopReason | Map<String, Object> | 停止推理(类型 `Map`)。The stop reason. |
actingUserId | String | 执行用户标识(类型 `String`)。The acting user id. |
scope | ManagedExecutionScope | 范围(类型 `ManagedExecutionScope`)。The scope. |
io/agentscope/builder/control/ControlPlaneClient.java:404–449getEnvironment
public EnvironmentDto getEnvironment(String environmentId)
获取环境。
Loads an environment template by id from the control plane.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
environmentId | String | 环境标识(类型 `String`)。The environment id. |
EnvironmentDtoio/agentscope/builder/control/ControlPlaneClient.java:452–454getEnvironment
public EnvironmentDto getEnvironment(String environmentId, String actingUserId)
获取环境。
Loads an environment template, optionally attributing the call to actingUserId.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
environmentId | String | 环境标识(类型 `String`)。The environment id. |
actingUserId | String | 执行用户标识(类型 `String`)。The acting user id. |
EnvironmentDtoio/agentscope/builder/control/ControlPlaneClient.java:457–490verifyEnvironmentKey
public boolean verifyEnvironmentKey(String environmentId, String plaintextKey)
执行 verifyEnvironmentKey 方法。
Verifies an Environment Worker API key via the control plane.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
environmentId | String | 环境标识(类型 `String`)。The environment id. |
plaintextKey | String | plaintext 键(类型 `String`)。The plaintext key. |
booleanio/agentscope/builder/control/ControlPlaneClient.java:496–514memoryDocuments
public io.agentscope.builder.web.managed.MemoryDocumentStore memoryDocuments(String sessionId, String storeId)
执行记忆文档相关操作。
Memory calls remain session-scoped; CP rechecks mount ownership and access on each request.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sessionId | String | 会话标识(类型 `String`)。The session id. |
storeId | String | 存储标识(类型 `String`)。The store id. |
io.agentscope.builder.web.managed.MemoryDocumentStoreio/agentscope/builder/control/ControlPlaneClient.java:517–583嵌套类详情Nested Class Detail
ManagedExecutionScope
public record ManagedExecutionScope( String tenant, String agentTaskId, String attemptId, long dispatchGeneration, String turnId)承载托管执行范围数据的记录类型。位于 io.agentscope.builder.control 包。核心成员包括 tenant、agentTaskId、attemptId、dispatchGeneration、turnId。
Immutable fence attached to all events emitted by one admitted Managed AgentTask turn.