AS AgentScopeAPI 手册 / API Reference

AgentBaySandbox

@RegisterSandbox( imageName = "agentbay-cloud", sandboxType = "agentbay", securityLevel = "high", timeout = 300, description = "AgentBay Cloud Sandbox Environment" ) public class AgentBaySandbox extends CloudSandbox
源码Source 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

构造器Constructor说明Description
public AgentBaySandbox(SandboxService managerApi, String userId, String sessionId)
初始化 `AgentBaySandbox` 实例。
Creates a new instance.
public AgentBaySandbox(SandboxService managerApi, String userId, String sessionId, String imageId)
初始化 `AgentBaySandbox` 实例。
Creates a new instance.
public AgentBaySandbox(SandboxService managerApi, String userId, String sessionId, String imageId, Map<String, String> labels)
初始化 `AgentBaySandbox` 实例。
Creates a new instance.

方法摘要Method Summary

方法Method说明Description
public Map<String, String> getLabels()
获取 `getLabels`。
Returns the labels.
public String getImageId()
获取图像标识。
Returns the image id.
public Map<String, Object> getSessionInfo()
获取会话信息。
Returns the session info.
public Map<String, Object> listTools()
列出工具。
Lists the tools.
public Map<String, Object> listTools(String toolType)
列出工具。
Lists the tools.
public String callCloudTool(String toolName, Map<String, Object> parameters)
调用 `callCloudTool`。
Calls the cloud tool.
public Session getSession()
获取会话。
Returns the session.
public String runIpythonCell(String code)
运行 `runIpythonCell`。
Execute IPython code
public String runShellCommand(String command)
运行 `runShellCommand`。
Execute shell command
public String readFile(String path)
设置读取文件。
Performs the read file operation.
public String writeFile(String path, String content)
执行写入文件相关操作。
Performs the write file operation.
public String listDirectory(String path)
列出目录。
Lists the directory.
public String moveFile(String source, String destination)
执行 `moveFile` 方法。
Performs the move file operation.
public String deleteFile(String path)
删除文件。
Deletes the file.
public String createDirectory(String path)
创建目录。
Creates the directory.
public String takeScreenShot()
返回 `takeScreenShot` 结果。
Returns the take screen shot.
public String browserNavigate(String url)
设置该参数。
Performs the browser navigate operation.
public String browserClick(String selector)
设置该参数。
Performs the browser click operation.
public String genericToolCall(String toolName, Map<String, Object> arguments)
执行泛型工具调用相关操作。
Performs the generic tool call operation.
public String browserInput(String selector, String inputText)
执行 `browserInput` 方法。
Performs the browser input operation.

构造器详情Constructor Detail

AgentBaySandbox

public AgentBaySandbox(SandboxService managerApi, String userId, String sessionId)

初始化 AgentBaySandbox 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
managerApiSandboxService管理器 API(类型 `SandboxService`)。The manager api.
userIdString用户标识(类型 `String`)。The user id.
sessionIdString会话标识(类型 `String`)。The session id.
源码Source io/agentscope/runtime/sandbox/box/AgentBaySandbox.java:56–58

AgentBaySandbox

public AgentBaySandbox(SandboxService managerApi, String userId, String sessionId, String imageId)

初始化 AgentBaySandbox 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
managerApiSandboxService管理器 API(类型 `SandboxService`)。The manager api.
userIdString用户标识(类型 `String`)。The user id.
sessionIdString会话标识(类型 `String`)。The session id.
imageIdString图像标识(类型 `String`)。The image id.
源码Source io/agentscope/runtime/sandbox/box/AgentBaySandbox.java:60–62

AgentBaySandbox

public AgentBaySandbox(SandboxService managerApi, String userId, String sessionId, String imageId, Map<String, String> labels)

初始化 AgentBaySandbox 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
managerApiSandboxService管理器 API(类型 `SandboxService`)。The manager api.
userIdString用户标识(类型 `String`)。The user id.
sessionIdString会话标识(类型 `String`)。The session id.
imageIdString图像标识(类型 `String`)。The image id.
labelsMap<String, String>labels(类型 `Map`)。The labels.
源码Source io/agentscope/runtime/sandbox/box/AgentBaySandbox.java:64–81

方法详情Method Detail

getLabels

public Map<String, String> getLabels()

获取 getLabels。

Returns the labels.

返回Returns Map<String, String>
返回映射。Returns map.
源码Source io/agentscope/runtime/sandbox/box/AgentBaySandbox.java:48–50

getImageId

public String getImageId()

获取图像标识。

Returns the image id.

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/runtime/sandbox/box/AgentBaySandbox.java:52–54

getSessionInfo

public Map<String, Object> getSessionInfo()

获取会话信息。

Returns the session info.

返回Returns Map<String, Object>
返回映射。Returns map.
源码Source io/agentscope/runtime/sandbox/box/AgentBaySandbox.java:83–89

listTools

public Map<String, Object> listTools()

列出工具。

Lists the tools.

返回Returns Map<String, Object>
返回映射。Returns map.
源码Source io/agentscope/runtime/sandbox/box/AgentBaySandbox.java:91–93

listTools

public Map<String, Object> listTools(String toolType)

列出工具。

Lists the tools.

参数Parameters
名称Name类型Type说明Description
toolTypeString工具类型(类型 `String`)。The tool type.
返回Returns Map<String, Object>
返回映射。Returns map.
源码Source io/agentscope/runtime/sandbox/box/AgentBaySandbox.java:95–121

callCloudTool

public String callCloudTool(String toolName, Map<String, Object> parameters)

调用 callCloudTool。

Calls the cloud tool.

参数Parameters
名称Name类型Type说明Description
toolNameString工具名称(类型 `String`)。The tool name.
parametersMap<String, Object>参数(类型 `Map`)。The parameters.
返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/runtime/sandbox/box/AgentBaySandbox.java:123–166

getSession

public Session getSession()

获取会话。

Returns the session.

返回Returns Session
返回会话。Returns session.
源码Source io/agentscope/runtime/sandbox/box/AgentBaySandbox.java:168–174

runIpythonCell

public String runIpythonCell(String code)

运行 runIpythonCell。

Execute IPython code

参数Parameters
名称Name类型Type说明Description
codeStringcode(类型 `String`)。The code.
返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/runtime/sandbox/box/AgentBaySandbox.java:179–193

runShellCommand

public String runShellCommand(String command)

运行 runShellCommand。

Execute shell command

参数Parameters
名称Name类型Type说明Description
commandString命令(类型 `String`)。The command.
返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/runtime/sandbox/box/AgentBaySandbox.java:198–213

readFile

public String readFile(String path)

设置读取文件。

Performs the read file operation.

参数Parameters
名称Name类型Type说明Description
pathString路径(类型 `String`)。The path.
返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/runtime/sandbox/box/AgentBaySandbox.java:215–229

writeFile

public String writeFile(String path, String content)

执行写入文件相关操作。

Performs the write file operation.

参数Parameters
名称Name类型Type说明Description
pathString路径(类型 `String`)。The path.
contentString内容(类型 `String`)。The content.
返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/runtime/sandbox/box/AgentBaySandbox.java:231–245

listDirectory

public String listDirectory(String path)

列出目录。

Lists the directory.

参数Parameters
名称Name类型Type说明Description
pathString路径(类型 `String`)。The path.
返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/runtime/sandbox/box/AgentBaySandbox.java:247–261

moveFile

public String moveFile(String source, String destination)

执行 moveFile 方法。

Performs the move file operation.

参数Parameters
名称Name类型Type说明Description
sourceString来源(类型 `String`)。The source.
destinationString目标地址(类型 `String`)。The destination.
返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/runtime/sandbox/box/AgentBaySandbox.java:263–277

deleteFile

public String deleteFile(String path)

删除文件。

Deletes the file.

参数Parameters
名称Name类型Type说明Description
pathString路径(类型 `String`)。The path.
返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/runtime/sandbox/box/AgentBaySandbox.java:279–292

createDirectory

public String createDirectory(String path)

创建目录。

Creates the directory.

参数Parameters
名称Name类型Type说明Description
pathString路径(类型 `String`)。The path.
返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/runtime/sandbox/box/AgentBaySandbox.java:294–307

takeScreenShot

public String takeScreenShot()

返回 takeScreenShot 结果。

Returns the take screen shot.

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/runtime/sandbox/box/AgentBaySandbox.java:309–322

browserNavigate

public String browserNavigate(String url)

设置该参数。

Performs the browser navigate operation.

参数Parameters
名称Name类型Type说明Description
urlString服务地址(类型 `String`)。The url.
返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/runtime/sandbox/box/AgentBaySandbox.java:324–361

browserClick

public String browserClick(String selector)

设置该参数。

Performs the browser click operation.

参数Parameters
名称Name类型Type说明Description
selectorStringselector(类型 `String`)。The selector.
返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/runtime/sandbox/box/AgentBaySandbox.java:363–387

genericToolCall

public String genericToolCall(String toolName, Map<String, Object> arguments)

执行泛型工具调用相关操作。

Performs the generic tool call operation.

参数Parameters
名称Name类型Type说明Description
toolNameString工具名称(类型 `String`)。The tool name.
argumentsMap<String, Object>参数(类型 `Map`)。The arguments.
返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/runtime/sandbox/box/AgentBaySandbox.java:389–392

browserInput

public String browserInput(String selector, String inputText)

执行 browserInput 方法。

Performs the browser input operation.

参数Parameters
名称Name类型Type说明Description
selectorStringselector(类型 `String`)。The selector.
inputTextString输入文本(类型 `String`)。The input text.
返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/runtime/sandbox/box/AgentBaySandbox.java:394–397

继承成员Inherited Members

基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.