SandboxRegistry
public class SandboxRegistry
io/agentscope/runtime/sandbox/manager/registry/SandboxRegistry.java:31–354沙箱注册表,承载智能体的部署、调度与服务化运行。位于 io.agentscope.runtime.sandbox.manager.registry 包。核心成员包括 register、getConfig、getConfigByType、getImage、getImageByType、getClassesByType。
Sandbox registry for managing sandbox configurations
方法摘要Method Summary
方法详情Method Detail
register
public static void register(Class<?> targetClass, SandboxConfig config)
用于特定类和类型的注册沙箱配置。
Register a sandbox configuration for a specific class and type
| 名称Name | 类型Type | 说明Description |
|---|---|---|
targetClass | Class<?> | 类到注册。The class to register |
config | SandboxConfig | 沙箱配置。The sandbox configuration |
io/agentscope/runtime/sandbox/manager/registry/SandboxRegistry.java:55–72register
public static void register(SandboxType sandboxType, String imageName)
执行注册相关操作。
Register a sandbox configuration by type This is a simplified registration method that doesn't require a class
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sandboxType | SandboxType | 沙箱类型。The sandbox type |
imageName | String | 图像名称(类型 `String`)。The Docker image name |
io/agentscope/runtime/sandbox/manager/registry/SandboxRegistry.java:81–89register
public static void register(SandboxType sandboxType, String imageName, Map<String, Object> resourceLimits, String securityLevel, int timeout, String description, Map<String, String> environment, Map<String, Object> runtimeConfig)
执行注册相关操作。
Register a sandbox with full configuration
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sandboxType | SandboxType | 沙箱类型。The sandbox type |
imageName | String | 图像名称(类型 `String`)。The Docker image name |
resourceLimits | Map<String, Object> | 资源 Limits(类型 `Map`)。Resource limits |
securityLevel | String | security 级别(类型 `String`)。Security level |
timeout | int | 超时时间(类型 `int`)。Timeout in seconds |
description | String | 描述(类型 `String`)。Description |
environment | Map<String, String> | 环境(类型 `Map`)。Environment variables |
runtimeConfig | Map<String, Object> | 运行时配置(类型 `Map`)。Runtime configuration |
io/agentscope/runtime/sandbox/manager/registry/SandboxRegistry.java:103–129getConfig
public static Optional<SandboxConfig> getConfig(Class<?> targetClass)
获取沙箱配置通过。
Get sandbox configuration by class
| 名称Name | 类型Type | 说明Description |
|---|---|---|
targetClass | Class<?> | 目标类。The target class |
Optional<SandboxConfig>io/agentscope/runtime/sandbox/manager/registry/SandboxRegistry.java:137–139getConfigByType
public static Optional<SandboxConfig> getConfigByType(SandboxType sandboxType)
获取沙箱配置通过类型。
Get sandbox configuration by type
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sandboxType | SandboxType | 沙箱类型。The sandbox type |
Optional<SandboxConfig>io/agentscope/runtime/sandbox/manager/registry/SandboxRegistry.java:147–149getImage
public static Optional<String> getImage(Class<?> targetClass)
获取图像。
Get Docker image name by class
| 名称Name | 类型Type | 说明Description |
|---|---|---|
targetClass | Class<?> | 目标类。The target class |
Optional<String>io/agentscope/runtime/sandbox/manager/registry/SandboxRegistry.java:157–159getImageByType
public static Optional<String> getImageByType(SandboxType sandboxType)
获取图像通过类型。
Get Docker image name by sandbox type
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sandboxType | SandboxType | 沙箱类型。The sandbox type |
Optional<String>io/agentscope/runtime/sandbox/manager/registry/SandboxRegistry.java:167–169getClassesByType
public static Optional<Class<?>> getClassesByType(SandboxType sandboxType)
获取类通过沙箱类型。
Get class by sandbox type
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sandboxType | SandboxType | 沙箱类型。The sandbox type |
Optional<Class<?>>io/agentscope/runtime/sandbox/manager/registry/SandboxRegistry.java:177–179listAllSandboxes
public static Map<Class<?>, SandboxConfig> listAllSandboxes()
列出 listAllSandboxes。
List all registered sandboxes (class-based registrations)
Map<Class<?>, SandboxConfig>io/agentscope/runtime/sandbox/manager/registry/SandboxRegistry.java:186–188listAllSandboxesByType
public static Map<SandboxType, SandboxConfig> listAllSandboxesByType()
列出 listAllSandboxesByType。
List all registered sandbox configurations by type
Map<SandboxType, SandboxConfig>io/agentscope/runtime/sandbox/manager/registry/SandboxRegistry.java:195–197isRegistered
public static boolean isRegistered(SandboxType sandboxType)
检查if 沙箱类型是已注册。
Check if a sandbox type is registered
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sandboxType | SandboxType | 沙箱类型到检查。The sandbox type to check |
booleanio/agentscope/runtime/sandbox/manager/registry/SandboxRegistry.java:205–207unregister
public static boolean unregister(SandboxType sandboxType)
设置注销。
Unregister a sandbox type
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sandboxType | SandboxType | 沙箱类型到注销。The sandbox type to unregister |
booleanio/agentscope/runtime/sandbox/manager/registry/SandboxRegistry.java:215–227clear
public static void clear()
清空或重置内部状态。
Clear all registrations
io/agentscope/runtime/sandbox/manager/registry/SandboxRegistry.java:232–238getRegisteredCount
public static int getRegisteredCount()
获取已注册数量。
Get the count of registered sandboxes
intio/agentscope/runtime/sandbox/manager/registry/SandboxRegistry.java:245–247registerCustomType
public static void registerCustomType(String typeName, String imageName)
注册自定义类型。
Register a custom sandbox type by string name This supports dynamic type registration.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
typeName | String | 自定义类型名称。The custom type name |
imageName | String | 图像名称(类型 `String`)。The Docker image name |
io/agentscope/runtime/sandbox/manager/registry/SandboxRegistry.java:256–266registerCustomType
public static void registerCustomType(String typeName, String imageName, Map<String, Object> resourceLimits, String securityLevel, int timeout, String description, Map<String, String> environment, Map<String, Object> runtimeConfig)
注册自定义类型。
Register a custom sandbox type with full configuration
| 名称Name | 类型Type | 说明Description |
|---|---|---|
typeName | String | 自定义类型名称。The custom type name |
imageName | String | 图像名称(类型 `String`)。The Docker image name |
resourceLimits | Map<String, Object> | 资源 Limits(类型 `Map`)。Resource limits |
securityLevel | String | security 级别(类型 `String`)。Security level |
timeout | int | 超时时间(类型 `int`)。Timeout in seconds |
description | String | 描述(类型 `String`)。Description |
environment | Map<String, String> | 环境(类型 `Map`)。Environment variables |
runtimeConfig | Map<String, Object> | 运行时配置(类型 `Map`)。Runtime configuration |
io/agentscope/runtime/sandbox/manager/registry/SandboxRegistry.java:280–308getCustomTypeConfig
public static Optional<SandboxConfig> getCustomTypeConfig(String typeName)
获取配置用于自定义沙箱类型通过名称。
Get configuration for a custom sandbox type by name
| 名称Name | 类型Type | 说明Description |
|---|---|---|
typeName | String | 自定义类型名称。The custom type name |
Optional<SandboxConfig>io/agentscope/runtime/sandbox/manager/registry/SandboxRegistry.java:316–321getCustomTypeImage
public static Optional<String> getCustomTypeImage(String typeName)
获取图像名称用于自定义沙箱类型。
Get image name for a custom sandbox type
| 名称Name | 类型Type | 说明Description |
|---|---|---|
typeName | String | 自定义类型名称。The custom type name |
Optional<String>io/agentscope/runtime/sandbox/manager/registry/SandboxRegistry.java:329–331isCustomTypeRegistered
public static boolean isCustomTypeRegistered(String typeName)
检查if 自定义类型是已注册。
Check if a custom type is registered
| 名称Name | 类型Type | 说明Description |
|---|---|---|
typeName | String | 自定义类型名称。The custom type name |
booleanio/agentscope/runtime/sandbox/manager/registry/SandboxRegistry.java:339–344listAllCustomTypes
public static Map<String, SandboxConfig> listAllCustomTypes()
列出所有自定义类型。
List all registered custom sandbox types
Map<String, SandboxConfig>io/agentscope/runtime/sandbox/manager/registry/SandboxRegistry.java:351–353