ExternalSandboxRegistry
@Component public class ExternalSandboxRegistry
io/agentscope/builder/web/managed/ExternalSandboxRegistry.java:32–56外部沙箱注册表,承载智能体的部署、调度与服务化运行。位于 io.agentscope.builder.web.managed 包。核心成员包括 register、get、remove、size。
Live sessionId -> Sandbox handles registered by an Environment Worker (a remote
worker calling the worker REST API).
HandsLeaseService polls this registry after enqueueing a work item on EnvironmentWorkQueue; once a worker registers a sandbox for the session, the harness attaches
it to the turn's io.agentscope.harness.agent.sandbox.SandboxContext as the Priority-1
externalSandbox, so the harness never starts, stops, or shuts it down — the worker owns
the full lifecycle.
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public void register(String sessionId, Sandbox sandbox) | 执行注册相关操作。 Registers (or replaces) the live sandbox for a session. |
public Sandbox get(String sessionId) | 按条件读取数据。 Returns the live sandbox for a session, or `null` if none is registered. |
public Sandbox remove(String sessionId) | 设置移除。 Removes and returns the live sandbox for a session, or `null` if none was registered. |
public int size() | 返回大小。 Returns the number of currently registered sandboxes. |
方法详情Method Detail
register
public void register(String sessionId, Sandbox sandbox)
执行注册相关操作。
Registers (or replaces) the live sandbox for a session.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sessionId | String | 会话标识(类型 `String`)。The session id. |
sandbox | Sandbox | 沙箱(类型 `Sandbox`)。The sandbox. |
io/agentscope/builder/web/managed/ExternalSandboxRegistry.java:38–40get
public Sandbox get(String sessionId)
按条件读取数据。
Returns the live sandbox for a session, or null if none is registered.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sessionId | String | 会话标识(类型 `String`)。The session id. |
Sandboxio/agentscope/builder/web/managed/ExternalSandboxRegistry.java:43–45remove
public Sandbox remove(String sessionId)
设置移除。
Removes and returns the live sandbox for a session, or null if none was registered.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sessionId | String | 会话标识(类型 `String`)。The session id. |
Sandboxio/agentscope/builder/web/managed/ExternalSandboxRegistry.java:48–50size
public int size()
返回大小。
Returns the number of currently registered sandboxes.
intio/agentscope/builder/web/managed/ExternalSandboxRegistry.java:53–55