AS AgentScopeAPI 手册 / API Reference

BaseSandbox

@RegisterSandbox( imageName = "agentscope-registry.ap-southeast-1.cr.aliyuncs.com/agentscope/runtime-sandbox-base:latest", sandboxType = "base", securityLevel = "medium", timeout = 30, description = "Base Sandbox" ) public class BaseSandbox extends Sandbox
源码Source io/agentscope/runtime/sandbox/box/BaseSandbox.java:28–90

基类沙箱,承载智能体的部署、调度与服务化运行。位于 io.agentscope.runtime.sandbox.box 包,继承自 Sandbox。核心成员包括 runIpythonCell、runShellCommand、BaseSandbox。

A class in io.agentscope.runtime.sandbox.box that deploys, schedules and serves agents. Declared in io.agentscope.runtime.sandbox.box. Extends Sandbox.

构造器摘要Constructor Summary

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

方法摘要Method Summary

方法Method说明Description
public String runIpythonCell(String code)
运行 `runIpythonCell`。
Execute IPython code
public String runShellCommand(String command)
运行 `runShellCommand`。
Execute shell command

构造器详情Constructor Detail

BaseSandbox

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

初始化 BaseSandbox 实例。

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/BaseSandbox.java:37–43

BaseSandbox

public BaseSandbox(SandboxService managerApi, String userId, String sessionId, FileSystemConfig fileSystemConfig)

初始化 BaseSandbox 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
managerApiSandboxService管理器 API(类型 `SandboxService`)。The manager api.
userIdString用户标识(类型 `String`)。The user id.
sessionIdString会话标识(类型 `String`)。The session id.
fileSystemConfigFileSystemConfig文件系统配置(类型 `FileSystemConfig`)。The file system config.
源码Source io/agentscope/runtime/sandbox/box/BaseSandbox.java:45–52

BaseSandbox

public BaseSandbox(SandboxService managerApi, String userId, String sessionId, Map<String, String> environment)

初始化 BaseSandbox 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
managerApiSandboxService管理器 API(类型 `SandboxService`)。The manager api.
userIdString用户标识(类型 `String`)。The user id.
sessionIdString会话标识(类型 `String`)。The session id.
environmentMap<String, String>环境(类型 `Map`)。The environment.
源码Source io/agentscope/runtime/sandbox/box/BaseSandbox.java:54–61

BaseSandbox

public BaseSandbox(SandboxService managerApi, String userId, String sessionId, FileSystemConfig fileSystemConfig, Map<String, String> environment)

初始化 BaseSandbox 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
managerApiSandboxService管理器 API(类型 `SandboxService`)。The manager api.
userIdString用户标识(类型 `String`)。The user id.
sessionIdString会话标识(类型 `String`)。The session id.
fileSystemConfigFileSystemConfig文件系统配置(类型 `FileSystemConfig`)。The file system config.
environmentMap<String, String>环境(类型 `Map`)。The environment.
源码Source io/agentscope/runtime/sandbox/box/BaseSandbox.java:63–71

方法详情Method Detail

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/BaseSandbox.java:76–80

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/BaseSandbox.java:85–89

继承成员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.