FilesystemSandbox
@RegisterSandbox( imageName = "agentscope-registry.ap-southeast-1.cr.aliyuncs.com/agentscope/runtime-sandbox-filesystem:latest", sandboxType = "filesystem", securityLevel = "medium", timeout = 60, description = "Filesystem sandbox" ) public class FilesystemSandbox extends Sandbox
io/agentscope/runtime/sandbox/box/FilesystemSandbox.java:27–165文件系统沙箱,承载智能体的部署、调度与服务化运行。位于 io.agentscope.runtime.sandbox.box 包,继承自 Sandbox。核心成员包括 getDesktopUrl、readFile、readMultipleFiles、writeFile、editFile、createDirectory。
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
方法摘要Method Summary
构造器详情Constructor Detail
FilesystemSandbox
public FilesystemSandbox(SandboxService managerApi, String userId, String sessionId)
初始化 FilesystemSandbox 实例。
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/FilesystemSandbox.java:38–40FilesystemSandbox
public FilesystemSandbox(SandboxService managerApi, String userId, String sessionId, String baseUrl)
初始化 FilesystemSandbox 实例。
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. |
baseUrl | String | 基类 URL(类型 `String`)。The base url. |
io/agentscope/runtime/sandbox/box/FilesystemSandbox.java:42–48FilesystemSandbox
public FilesystemSandbox(SandboxService managerApi, String userId, String sessionId, FileSystemConfig fileSystemConfig)
初始化 FilesystemSandbox 实例。
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. |
fileSystemConfig | FileSystemConfig | 文件系统配置(类型 `FileSystemConfig`)。The file system config. |
io/agentscope/runtime/sandbox/box/FilesystemSandbox.java:50–56FilesystemSandbox
public FilesystemSandbox(SandboxService managerApi, String userId, String sessionId, Map<String, String> environment)
初始化 FilesystemSandbox 实例。
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. |
environment | Map<String, String> | 环境(类型 `Map`)。The environment. |
io/agentscope/runtime/sandbox/box/FilesystemSandbox.java:58–64FilesystemSandbox
public FilesystemSandbox(SandboxService managerApi, String userId, String sessionId, String baseUrl, FileSystemConfig fileSystemConfig, Map<String, String> environment)
初始化 FilesystemSandbox 实例。
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. |
baseUrl | String | 基类 URL(类型 `String`)。The base url. |
fileSystemConfig | FileSystemConfig | 文件系统配置(类型 `FileSystemConfig`)。The file system config. |
environment | Map<String, String> | 环境(类型 `Map`)。The environment. |
io/agentscope/runtime/sandbox/box/FilesystemSandbox.java:66–75方法详情Method Detail
getDesktopUrl
public String getDesktopUrl()
获取 getDesktopUrl。
Get the desktop URL for VNC access.
StringRuntimeException可能抛出 `RuntimeException`。if sandbox is not healthy
io/agentscope/runtime/sandbox/box/FilesystemSandbox.java:84–86readFile
public String readFile(String path)
设置读取文件。
Performs the read file operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
path | String | 路径(类型 `String`)。The path. |
Stringio/agentscope/runtime/sandbox/box/FilesystemSandbox.java:88–92readMultipleFiles
public String readMultipleFiles(List<String> paths)
设置该参数。
Performs the read multiple files operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
paths | List<String> | paths(类型 `List`)。The paths. |
Stringio/agentscope/runtime/sandbox/box/FilesystemSandbox.java:94–98writeFile
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/FilesystemSandbox.java:100–105editFile
public String editFile(String path, Object[] edits)
执行 editFile 方法。
Performs the edit file operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
path | String | 路径(类型 `String`)。The path. |
edits | Object[] | edits(类型 `Object[]`)。The edits. |
Stringio/agentscope/runtime/sandbox/box/FilesystemSandbox.java:107–109editFile
public String editFile(String path, Object[] edits, boolean dryRun)
执行 editFile 方法。
Performs the edit file operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
path | String | 路径(类型 `String`)。The path. |
edits | Object[] | edits(类型 `Object[]`)。The edits. |
dryRun | boolean | dry 运行(类型 `boolean`)。The dry run. |
Stringio/agentscope/runtime/sandbox/box/FilesystemSandbox.java:111–117createDirectory
public String createDirectory(String path)
创建目录。
Creates the directory.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
path | String | 路径(类型 `String`)。The path. |
Stringio/agentscope/runtime/sandbox/box/FilesystemSandbox.java:119–123listDirectory
public String listDirectory(String path)
列出目录。
Lists the directory.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
path | String | 路径(类型 `String`)。The path. |
Stringio/agentscope/runtime/sandbox/box/FilesystemSandbox.java:125–129directoryTree
public String directoryTree(String path)
设置目录树。
Performs the directory tree operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
path | String | 路径(类型 `String`)。The path. |
Stringio/agentscope/runtime/sandbox/box/FilesystemSandbox.java:131–135moveFile
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/FilesystemSandbox.java:137–142searchFiles
public String searchFiles(String path, String pattern)
搜索文件。
Searches the files.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
path | String | 路径(类型 `String`)。The path. |
pattern | String | pattern(类型 `String`)。The pattern. |
Stringio/agentscope/runtime/sandbox/box/FilesystemSandbox.java:144–146searchFiles
public String searchFiles(String path, String pattern, String[] excludePatterns)
搜索文件。
Searches the files.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
path | String | 路径(类型 `String`)。The path. |
pattern | String | pattern(类型 `String`)。The pattern. |
excludePatterns | String[] | exclude Patterns(类型 `String[]`)。The exclude patterns. |
Stringio/agentscope/runtime/sandbox/box/FilesystemSandbox.java:148–154getFileInfo
public String getFileInfo(String path)
获取文件信息。
Returns the file info.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
path | String | 路径(类型 `String`)。The path. |
Stringio/agentscope/runtime/sandbox/box/FilesystemSandbox.java:156–160listAllowedDirectories
public String listAllowedDirectories()
列出 listAllowedDirectories。
Lists the allowed directories.
Stringio/agentscope/runtime/sandbox/box/FilesystemSandbox.java:162–164