SandboxService
public class SandboxService implements AutoCloseable
io/agentscope/runtime/sandbox/manager/SandboxService.java:50–569沙箱服务,承载智能体的部署、调度与服务化运行。位于 io.agentscope.runtime.sandbox.manager 包,实现 AutoCloseable。核心成员包括 start、createAgentBayContainer、createContainer、getSandbox、startSandbox、stopSandbox。
A class in io.agentscope.runtime.sandbox.manager that deploys, schedules and serves agents. Declared in io.agentscope.runtime.sandbox.manager. Implements AutoCloseable.
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
public SandboxService(ManagerConfig managerConfig) | 初始化 `SandboxService` 实例。 Creates a new instance. |
方法摘要Method Summary
构造器详情Constructor Detail
SandboxService
public SandboxService(ManagerConfig managerConfig)
初始化 SandboxService 实例。
Creates a new instance.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
managerConfig | ManagerConfig | 管理器配置(类型 `ManagerConfig`)。The manager config. |
io/agentscope/runtime/sandbox/manager/SandboxService.java:59–69方法详情Method Detail
start
public void start()
执行启动相关操作。
Returns the start.
io/agentscope/runtime/sandbox/manager/SandboxService.java:71–78createAgentBayContainer
public String createAgentBayContainer(AgentBaySandbox sandbox)
创建 createAgentBayContainer。
Creates the agent bay container.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sandbox | AgentBaySandbox | 沙箱(类型 `AgentBaySandbox`)。The sandbox. |
Stringio/agentscope/runtime/sandbox/manager/SandboxService.java:80–89createContainer
public ContainerModel createContainer(Sandbox sandbox) throws JsonProcessingException
创建容器。
Creates the container.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sandbox | Sandbox | 沙箱(类型 `Sandbox`)。The sandbox. |
ContainerModelJsonProcessingException可能抛出 `JsonProcessingException`。Thrown when the operation cannot be completed.
io/agentscope/runtime/sandbox/manager/SandboxService.java:91–284getSandbox
public ContainerModel getSandbox(String containerId)
获取沙箱。
Returns the sandbox.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
containerId | String | 容器标识(类型 `String`)。The container id. |
ContainerModelio/agentscope/runtime/sandbox/manager/SandboxService.java:286–288getSandbox
public ContainerModel getSandbox(String userId, String sessionId, String sandboxType)
获取沙箱。
Returns the sandbox.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
userId | String | 用户标识(类型 `String`)。The user id. |
sessionId | String | 会话标识(类型 `String`)。The session id. |
sandboxType | String | 沙箱类型(类型 `String`)。The sandbox type. |
ContainerModelio/agentscope/runtime/sandbox/manager/SandboxService.java:290–292startSandbox
public boolean startSandbox(String userId, String sessionId, String sandboxType)
启动沙箱。
Starts the sandbox.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
userId | String | 用户标识(类型 `String`)。The user id. |
sessionId | String | 会话标识(类型 `String`)。The session id. |
sandboxType | String | 沙箱类型(类型 `String`)。The sandbox type. |
booleanio/agentscope/runtime/sandbox/manager/SandboxService.java:294–296startSandbox
public boolean startSandbox(String containerId)
启动沙箱。
Starts the sandbox.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
containerId | String | 容器标识(类型 `String`)。The container id. |
booleanio/agentscope/runtime/sandbox/manager/SandboxService.java:298–300startSandbox
public boolean startSandbox(ContainerModel containerModel)
启动沙箱。
Starts the sandbox.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
containerModel | ContainerModel | 容器模型(类型 `ContainerModel`)。The container model. |
booleanio/agentscope/runtime/sandbox/manager/SandboxService.java:302–321stopSandbox
public void stopSandbox(String userId, String sessionId, String sandboxType)
停止沙箱。
Stops the sandbox.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
userId | String | 用户标识(类型 `String`)。The user id. |
sessionId | String | 会话标识(类型 `String`)。The session id. |
sandboxType | String | 沙箱类型(类型 `String`)。The sandbox type. |
io/agentscope/runtime/sandbox/manager/SandboxService.java:323–325stopSandbox
public void stopSandbox(String containerId)
停止沙箱。
Stops the sandbox.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
containerId | String | 容器标识(类型 `String`)。The container id. |
io/agentscope/runtime/sandbox/manager/SandboxService.java:327–329stopSandbox
public void stopSandbox(ContainerModel containerModel)
停止沙箱。
Stops the sandbox.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
containerModel | ContainerModel | 容器模型(类型 `ContainerModel`)。The container model. |
io/agentscope/runtime/sandbox/manager/SandboxService.java:331–351removeSandbox
public boolean removeSandbox(String userId, String sessionId, String sandboxType)
移除沙箱。
Removes the sandbox.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
userId | String | 用户标识(类型 `String`)。The user id. |
sessionId | String | 会话标识(类型 `String`)。The session id. |
sandboxType | String | 沙箱类型(类型 `String`)。The sandbox type. |
booleanio/agentscope/runtime/sandbox/manager/SandboxService.java:353–355removeSandbox
public boolean removeSandbox(String containerId)
移除沙箱。
Removes the sandbox.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
containerId | String | 容器标识(类型 `String`)。The container id. |
booleanio/agentscope/runtime/sandbox/manager/SandboxService.java:357–359removeSandbox
public boolean removeSandbox(ContainerModel containerModel)
移除沙箱。
Removes the sandbox.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
containerModel | ContainerModel | 容器模型(类型 `ContainerModel`)。The container model. |
booleanio/agentscope/runtime/sandbox/manager/SandboxService.java:361–382stopAndRemoveSandbox
public boolean stopAndRemoveSandbox(String userId, String sessionId, String sandboxType)
停止和移除沙箱。
Stops the and remove sandbox.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
userId | String | 用户标识(类型 `String`)。The user id. |
sessionId | String | 会话标识(类型 `String`)。The session id. |
sandboxType | String | 沙箱类型(类型 `String`)。The sandbox type. |
booleanio/agentscope/runtime/sandbox/manager/SandboxService.java:384–387stopAndRemoveSandbox
public boolean stopAndRemoveSandbox(String containerId)
停止和移除沙箱。
Stops the and remove sandbox.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
containerId | String | 容器标识(类型 `String`)。The container id. |
booleanio/agentscope/runtime/sandbox/manager/SandboxService.java:389–392release
public boolean release(String containerId)
关闭资源并释放连接。
Releases resources and connections.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
containerId | String | 容器标识(类型 `String`)。The container id. |
booleanio/agentscope/runtime/sandbox/manager/SandboxService.java:394–396getSandboxStatus
public String getSandboxStatus(String userId, String sessionId, String sandboxType)
获取沙箱状态。
Returns the sandbox status.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
userId | String | 用户标识(类型 `String`)。The user id. |
sessionId | String | 会话标识(类型 `String`)。The session id. |
sandboxType | String | 沙箱类型(类型 `String`)。The sandbox type. |
Stringio/agentscope/runtime/sandbox/manager/SandboxService.java:398–400getSandboxStatus
public String getSandboxStatus(String containerId)
获取沙箱状态。
Returns the sandbox status.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
containerId | String | 容器标识(类型 `String`)。The container id. |
Stringio/agentscope/runtime/sandbox/manager/SandboxService.java:402–404getSandboxStatus
public String getSandboxStatus(ContainerModel containerModel)
获取沙箱状态。
Returns the sandbox status.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
containerModel | ContainerModel | 容器模型(类型 `ContainerModel`)。The container model. |
Stringio/agentscope/runtime/sandbox/manager/SandboxService.java:406–426getAllSandboxes
public Map<String, ContainerModel> getAllSandboxes()
获取 getAllSandboxes。
Returns the all sandboxes.
Map<String, ContainerModel>io/agentscope/runtime/sandbox/manager/SandboxService.java:428–430getInfo
public ContainerModel getInfo(String containerId)
获取信息。
Returns the info.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
containerId | String | 容器标识(类型 `String`)。The container id. |
ContainerModelio/agentscope/runtime/sandbox/manager/SandboxService.java:432–451cleanupAllSandboxes
public void cleanupAllSandboxes()
执行 cleanupAllSandboxes 方法。
Returns the cleanup all sandboxes.
io/agentscope/runtime/sandbox/manager/SandboxService.java:453–459close
public void close()
关闭连接并释放相关资源。
Releases resources and connections.
io/agentscope/runtime/sandbox/manager/SandboxService.java:461–464listTools
public Map<String, Object> listTools(String sandboxId, String toolType)
列出工具。
Lists the tools.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sandboxId | String | 沙箱标识(类型 `String`)。The sandbox id. |
toolType | String | 工具类型(类型 `String`)。The tool type. |
Map<String, Object>io/agentscope/runtime/sandbox/manager/SandboxService.java:479–506callTool
public String callTool(String sandboxId, String toolName, Map<String, Object> arguments)
调用工具。
Calls the tool.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sandboxId | String | 沙箱标识(类型 `String`)。The sandbox id. |
toolName | String | 工具名称(类型 `String`)。The tool name. |
arguments | Map<String, Object> | 参数(类型 `Map`)。The arguments. |
Stringio/agentscope/runtime/sandbox/manager/SandboxService.java:508–534addMcpServers
public Map<String, Object> addMcpServers(String sandboxId, Map<String, Object> serverConfigs, boolean overwrite)
添加 addMcpServers。
Adds the mcp servers.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sandboxId | String | 沙箱标识(类型 `String`)。The sandbox id. |
serverConfigs | Map<String, Object> | 服务端 Configs(类型 `Map`)。The server configs. |
overwrite | boolean | overwrite(类型 `boolean`)。The overwrite. |
Map<String, Object>io/agentscope/runtime/sandbox/manager/SandboxService.java:536–564getAgentBayClient
public AgentBayClient getAgentBayClient()
获取 getAgentBayClient。
Returns the agent bay client.
AgentBayClientio/agentscope/runtime/sandbox/manager/SandboxService.java:566–568