TrainingSandbox
public class TrainingSandbox extends Sandbox
io/agentscope/runtime/sandbox/box/TrainingSandbox.java:25–218Training 沙箱,承载智能体的部署、调度与服务化运行。位于 io.agentscope.runtime.sandbox.box 包,继承自 Sandbox。核心成员包括 createInstance、getTaskIds、getEnvProfile、step、evaluate、releaseInstance。
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
TrainingSandbox
public TrainingSandbox(SandboxService managerApi, String userId, String sessionId, String sandboxType)
初始化 TrainingSandbox 实例。
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. |
sandboxType | String | 沙箱类型(类型 `String`)。The sandbox type. |
io/agentscope/runtime/sandbox/box/TrainingSandbox.java:26–28TrainingSandbox
public TrainingSandbox(SandboxService managerApi, String userId, String sessionId, String sandboxType, FileSystemConfig fileSystemConfig)
初始化 TrainingSandbox 实例。
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. |
sandboxType | String | 沙箱类型(类型 `String`)。The sandbox type. |
fileSystemConfig | FileSystemConfig | 文件系统配置(类型 `FileSystemConfig`)。The file system config. |
io/agentscope/runtime/sandbox/box/TrainingSandbox.java:30–37TrainingSandbox
public TrainingSandbox(SandboxService managerApi, String userId, String sessionId, String sandboxType, Map<String, String> environment)
初始化 TrainingSandbox 实例。
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. |
sandboxType | String | 沙箱类型(类型 `String`)。The sandbox type. |
environment | Map<String, String> | 环境(类型 `Map`)。The environment. |
io/agentscope/runtime/sandbox/box/TrainingSandbox.java:39–46TrainingSandbox
public TrainingSandbox(SandboxService managerApi, String userId, String sessionId, String sandboxType, FileSystemConfig fileSystemConfig, Map<String, String> environment)
初始化 TrainingSandbox 实例。
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. |
sandboxType | String | 沙箱类型(类型 `String`)。The sandbox type. |
fileSystemConfig | FileSystemConfig | 文件系统配置(类型 `FileSystemConfig`)。The file system config. |
environment | Map<String, String> | 环境(类型 `Map`)。The environment. |
io/agentscope/runtime/sandbox/box/TrainingSandbox.java:48–57方法详情Method Detail
createInstance
public String createInstance(String envType, String taskId)
创建实例。
Create a new instance of a training environment
| 名称Name | 类型Type | 说明Description |
|---|---|---|
envType | String | 环境到创建的类型。Type of environment to create |
taskId | String | 任务标识(类型 `String`)。Identifier for the specific task |
Stringio/agentscope/runtime/sandbox/box/TrainingSandbox.java:66–68createInstance
public String createInstance(String envType, String taskId, String instanceId, Map<String, Object> params)
创建实例。
Create a new instance of a training environment
| 名称Name | 类型Type | 说明Description |
|---|---|---|
envType | String | 环境到创建的类型。Type of environment to create |
taskId | String | 任务标识(类型 `String`)。Identifier for the specific task |
instanceId | String | 实例标识(类型 `String`)。Custom instance identifier (optional) |
params | Map<String, Object> | 参数(类型 `Map`)。Additional parameters for instance creation (optional) |
Stringio/agentscope/runtime/sandbox/box/TrainingSandbox.java:79–94getTaskIds
public String getTaskIds(String envType)
获取 getTaskIds。
Retrieve task identifiers for a specific environment
| 名称Name | 类型Type | 说明Description |
|---|---|---|
envType | String | 环境的类型。Type of environment |
Stringio/agentscope/runtime/sandbox/box/TrainingSandbox.java:102–104getTaskIds
public String getTaskIds(String envType, String split, Map<String, Object> params)
获取 getTaskIds。
Retrieve task identifiers for a specific environment
| 名称Name | 类型Type | 说明Description |
|---|---|---|
envType | String | 环境的类型。Type of environment |
split | String | 已拆分(类型 `String`)。Data split to retrieve tasks from (default: "train") |
params | Map<String, Object> | 参数(类型 `Map`)。Additional filtering parameters (optional) |
Stringio/agentscope/runtime/sandbox/box/TrainingSandbox.java:114–122getEnvProfile
public String getEnvProfile(String envType)
获取 getEnvProfile。
Retrieve the environment profile
| 名称Name | 类型Type | 说明Description |
|---|---|---|
envType | String | 环境的类型。Type of environment |
Stringio/agentscope/runtime/sandbox/box/TrainingSandbox.java:130–132getEnvProfile
public String getEnvProfile(String envType, String split, Map<String, Object> params)
获取 getEnvProfile。
Retrieve the environment profile
| 名称Name | 类型Type | 说明Description |
|---|---|---|
envType | String | 环境的类型。Type of environment |
split | String | 已拆分(类型 `String`)。Data split to retrieve profile from (default: "train") |
params | Map<String, Object> | 参数(类型 `Map`)。Additional profile retrieval parameters (optional) |
Stringio/agentscope/runtime/sandbox/box/TrainingSandbox.java:142–150step
public String step(String instanceId)
设置步骤。
Execute a step in the training environment
| 名称Name | 类型Type | 说明Description |
|---|---|---|
instanceId | String | 实例标识(类型 `String`)。Identifier of the environment instance |
Stringio/agentscope/runtime/sandbox/box/TrainingSandbox.java:158–160step
public String step(String instanceId, Map<String, Object> action, Map<String, Object> params)
执行步骤相关操作。
Execute a step in the training environment
| 名称Name | 类型Type | 说明Description |
|---|---|---|
instanceId | String | 实例标识(类型 `String`)。Identifier of the environment instance |
action | Map<String, Object> | 动作(类型 `Map`)。Action to be performed in the environment (optional) |
params | Map<String, Object> | 参数(类型 `Map`)。Additional step parameters (optional) |
Stringio/agentscope/runtime/sandbox/box/TrainingSandbox.java:170–176evaluate
public String evaluate(String instanceId)
设置该参数。
Evaluate the performance of a training environment instance
| 名称Name | 类型Type | 说明Description |
|---|---|---|
instanceId | String | 实例标识(类型 `String`)。Identifier of the environment instance |
Stringio/agentscope/runtime/sandbox/box/TrainingSandbox.java:184–186evaluate
public String evaluate(String instanceId, Map<String, Object> messages, Map<String, Object> params)
执行 evaluate 方法。
Evaluate the performance of a training environment instance
| 名称Name | 类型Type | 说明Description |
|---|---|---|
instanceId | String | 实例标识(类型 `String`)。Identifier of the environment instance |
messages | Map<String, Object> | 消息列表(类型 `Map`)。Evaluation-related messages (optional) |
params | Map<String, Object> | 参数(类型 `Map`)。Additional evaluation parameters (optional) |
Stringio/agentscope/runtime/sandbox/box/TrainingSandbox.java:196–205releaseInstance
public String releaseInstance(String instanceId)
设置该参数。
Release a training environment instance
| 名称Name | 类型Type | 说明Description |
|---|---|---|
instanceId | String | 实例标识(类型 `String`)。Identifier of the instance to be released |
Stringio/agentscope/runtime/sandbox/box/TrainingSandbox.java:213–217