AgentBaySandbox
@RegisterSandbox( imageName = "agentbay-cloud", sandboxType = "agentbay", securityLevel = "high", timeout = 300, description = "AgentBay Cloud Sandbox Environment" ) public class AgentBaySandbox extends CloudSandbox
io/agentscope/runtime/sandbox/box/AgentBaySandbox.java:35–398智能体 Bay 沙箱,承载智能体的部署、调度与服务化运行。位于 io.agentscope.runtime.sandbox.box 包,继承自 CloudSandbox。核心成员包括 getLabels、getImageId、getSessionInfo、listTools、callCloudTool、getSession。
A class in io.agentscope.runtime.sandbox.box that deploys, schedules and serves agents. Declared in io.agentscope.runtime.sandbox.box. Extends CloudSandbox.
构造器摘要Constructor Summary
方法摘要Method Summary
构造器详情Constructor Detail
AgentBaySandbox
public AgentBaySandbox(SandboxService managerApi, String userId, String sessionId)
初始化 AgentBaySandbox 实例。
Creates a new instance.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
managerApi | SandboxService | 管理器 API(类型 `SandboxService`)。The manager api. |
userId | String | 用户标识(类型 `String`)。The user id. |
sessionId | String | 会话标识(类型 `String`)。The session id. |
io/agentscope/runtime/sandbox/box/AgentBaySandbox.java:56–58AgentBaySandbox
public AgentBaySandbox(SandboxService managerApi, String userId, String sessionId, String imageId)
初始化 AgentBaySandbox 实例。
Creates a new instance.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
managerApi | SandboxService | 管理器 API(类型 `SandboxService`)。The manager api. |
userId | String | 用户标识(类型 `String`)。The user id. |
sessionId | String | 会话标识(类型 `String`)。The session id. |
imageId | String | 图像标识(类型 `String`)。The image id. |
io/agentscope/runtime/sandbox/box/AgentBaySandbox.java:60–62AgentBaySandbox
public AgentBaySandbox(SandboxService managerApi, String userId, String sessionId, String imageId, Map<String, String> labels)
初始化 AgentBaySandbox 实例。
Creates a new instance.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
managerApi | SandboxService | 管理器 API(类型 `SandboxService`)。The manager api. |
userId | String | 用户标识(类型 `String`)。The user id. |
sessionId | String | 会话标识(类型 `String`)。The session id. |
imageId | String | 图像标识(类型 `String`)。The image id. |
labels | Map<String, String> | labels(类型 `Map`)。The labels. |
io/agentscope/runtime/sandbox/box/AgentBaySandbox.java:64–81方法详情Method Detail
getLabels
public Map<String, String> getLabels()
获取 getLabels。
Returns the labels.
Map<String, String>io/agentscope/runtime/sandbox/box/AgentBaySandbox.java:48–50getImageId
public String getImageId()
获取图像标识。
Returns the image id.
Stringio/agentscope/runtime/sandbox/box/AgentBaySandbox.java:52–54getSessionInfo
public Map<String, Object> getSessionInfo()
获取会话信息。
Returns the session info.
Map<String, Object>io/agentscope/runtime/sandbox/box/AgentBaySandbox.java:83–89listTools
public Map<String, Object> listTools()
列出工具。
Lists the tools.
Map<String, Object>io/agentscope/runtime/sandbox/box/AgentBaySandbox.java:91–93listTools
public Map<String, Object> listTools(String toolType)
列出工具。
Lists the tools.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
toolType | String | 工具类型(类型 `String`)。The tool type. |
Map<String, Object>io/agentscope/runtime/sandbox/box/AgentBaySandbox.java:95–121callCloudTool
public String callCloudTool(String toolName, Map<String, Object> parameters)
调用 callCloudTool。
Calls the cloud tool.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
toolName | String | 工具名称(类型 `String`)。The tool name. |
parameters | Map<String, Object> | 参数(类型 `Map`)。The parameters. |
Stringio/agentscope/runtime/sandbox/box/AgentBaySandbox.java:123–166getSession
public Session getSession()
获取会话。
Returns the session.
Sessionio/agentscope/runtime/sandbox/box/AgentBaySandbox.java:168–174runIpythonCell
public String runIpythonCell(String code)
运行 runIpythonCell。
Execute IPython code
| 名称Name | 类型Type | 说明Description |
|---|---|---|
code | String | code(类型 `String`)。The code. |
Stringio/agentscope/runtime/sandbox/box/AgentBaySandbox.java:179–193runShellCommand
public String runShellCommand(String command)
运行 runShellCommand。
Execute shell command
| 名称Name | 类型Type | 说明Description |
|---|---|---|
command | String | 命令(类型 `String`)。The command. |
Stringio/agentscope/runtime/sandbox/box/AgentBaySandbox.java:198–213readFile
public String readFile(String path)
设置读取文件。
Performs the read file operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
path | String | 路径(类型 `String`)。The path. |
Stringio/agentscope/runtime/sandbox/box/AgentBaySandbox.java:215–229writeFile
public String writeFile(String path, String content)
执行写入文件相关操作。
Performs the write file operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
path | String | 路径(类型 `String`)。The path. |
content | String | 内容(类型 `String`)。The content. |
Stringio/agentscope/runtime/sandbox/box/AgentBaySandbox.java:231–245listDirectory
public String listDirectory(String path)
列出目录。
Lists the directory.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
path | String | 路径(类型 `String`)。The path. |
Stringio/agentscope/runtime/sandbox/box/AgentBaySandbox.java:247–261moveFile
public String moveFile(String source, String destination)
执行 moveFile 方法。
Performs the move file operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
source | String | 来源(类型 `String`)。The source. |
destination | String | 目标地址(类型 `String`)。The destination. |
Stringio/agentscope/runtime/sandbox/box/AgentBaySandbox.java:263–277deleteFile
public String deleteFile(String path)
删除文件。
Deletes the file.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
path | String | 路径(类型 `String`)。The path. |
Stringio/agentscope/runtime/sandbox/box/AgentBaySandbox.java:279–292createDirectory
public String createDirectory(String path)
创建目录。
Creates the directory.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
path | String | 路径(类型 `String`)。The path. |
Stringio/agentscope/runtime/sandbox/box/AgentBaySandbox.java:294–307takeScreenShot
public String takeScreenShot()
返回 takeScreenShot 结果。
Returns the take screen shot.
Stringio/agentscope/runtime/sandbox/box/AgentBaySandbox.java:309–322browserClick
public String browserClick(String selector)
设置该参数。
Performs the browser click operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
selector | String | selector(类型 `String`)。The selector. |
Stringio/agentscope/runtime/sandbox/box/AgentBaySandbox.java:363–387genericToolCall
public String genericToolCall(String toolName, Map<String, Object> arguments)
执行泛型工具调用相关操作。
Performs the generic tool call operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
toolName | String | 工具名称(类型 `String`)。The tool name. |
arguments | Map<String, Object> | 参数(类型 `Map`)。The arguments. |
Stringio/agentscope/runtime/sandbox/box/AgentBaySandbox.java:389–392browserInput
public String browserInput(String selector, String inputText)
执行 browserInput 方法。
Performs the browser input operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
selector | String | selector(类型 `String`)。The selector. |
inputText | String | 输入文本(类型 `String`)。The input text. |
Stringio/agentscope/runtime/sandbox/box/AgentBaySandbox.java:394–397