AS AgentScopeAPI 手册 / API Reference

TrainingSandbox

public class TrainingSandbox extends Sandbox
源码Source io/agentscope/runtime/sandbox/box/TrainingSandbox.java:25–218

Training 沙箱,承载智能体的部署、调度与服务化运行。位于 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

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

方法摘要Method Summary

方法Method说明Description
public String createInstance(String envType, String taskId)
创建实例。
Create a new instance of a training environment
public String createInstance(String envType, String taskId, String instanceId, Map<String, Object> params)
创建实例。
Create a new instance of a training environment
public String getTaskIds(String envType)
获取 `getTaskIds`。
Retrieve task identifiers for a specific environment
public String getTaskIds(String envType, String split, Map<String, Object> params)
获取 `getTaskIds`。
Retrieve task identifiers for a specific environment
public String getEnvProfile(String envType)
获取 `getEnvProfile`。
Retrieve the environment profile
public String getEnvProfile(String envType, String split, Map<String, Object> params)
获取 `getEnvProfile`。
Retrieve the environment profile
public String step(String instanceId)
设置步骤。
Execute a step in the training environment
public String step(String instanceId, Map<String, Object> action, Map<String, Object> params)
执行步骤相关操作。
Execute a step in the training environment
public String evaluate(String instanceId)
设置该参数。
Evaluate the performance of a training environment instance
public String evaluate(String instanceId, Map<String, Object> messages, Map<String, Object> params)
执行 `evaluate` 方法。
Evaluate the performance of a training environment instance
public String releaseInstance(String instanceId)
设置该参数。
Release a training environment instance

构造器详情Constructor Detail

TrainingSandbox

public TrainingSandbox(SandboxService managerApi, String userId, String sessionId, String sandboxType)

初始化 TrainingSandbox 实例。

Creates a new instance.

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

TrainingSandbox

public TrainingSandbox(SandboxService managerApi, String userId, String sessionId, String sandboxType, FileSystemConfig fileSystemConfig)

初始化 TrainingSandbox 实例。

Creates a new instance.

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

TrainingSandbox

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

初始化 TrainingSandbox 实例。

Creates a new instance.

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

TrainingSandbox

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

初始化 TrainingSandbox 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
managerApiSandboxService管理器 API(类型 `SandboxService`)。The manager api.
userIdString用户标识(类型 `String`)。The user id.
sessionIdString会话标识(类型 `String`)。The session id.
sandboxTypeString沙箱类型(类型 `String`)。The sandbox type.
fileSystemConfigFileSystemConfig文件系统配置(类型 `FileSystemConfig`)。The file system config.
environmentMap<String, String>环境(类型 `Map`)。The environment.
源码Source 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

参数Parameters
名称Name类型Type说明Description
envTypeString环境到创建的类型。Type of environment to create
taskIdString任务标识(类型 `String`)。Identifier for the specific task
返回Returns String
已创建实例详情。The created instance details
源码Source io/agentscope/runtime/sandbox/box/TrainingSandbox.java:66–68

createInstance

public String createInstance(String envType, String taskId, String instanceId, Map<String, Object> params)

创建实例。

Create a new instance of a training environment

参数Parameters
名称Name类型Type说明Description
envTypeString环境到创建的类型。Type of environment to create
taskIdString任务标识(类型 `String`)。Identifier for the specific task
instanceIdString实例标识(类型 `String`)。Custom instance identifier (optional)
paramsMap<String, Object>参数(类型 `Map`)。Additional parameters for instance creation (optional)
返回Returns String
已创建实例详情。The created instance details
源码Source io/agentscope/runtime/sandbox/box/TrainingSandbox.java:79–94

getTaskIds

public String getTaskIds(String envType)

获取 getTaskIds。

Retrieve task identifiers for a specific environment

参数Parameters
名称Name类型Type说明Description
envTypeString环境的类型。Type of environment
返回Returns String
返回字符串结果。List of task identifiers
源码Source io/agentscope/runtime/sandbox/box/TrainingSandbox.java:102–104

getTaskIds

public String getTaskIds(String envType, String split, Map<String, Object> params)

获取 getTaskIds。

Retrieve task identifiers for a specific environment

参数Parameters
名称Name类型Type说明Description
envTypeString环境的类型。Type of environment
splitString已拆分(类型 `String`)。Data split to retrieve tasks from (default: "train")
paramsMap<String, Object>参数(类型 `Map`)。Additional filtering parameters (optional)
返回Returns String
返回字符串结果。List of task identifiers
源码Source io/agentscope/runtime/sandbox/box/TrainingSandbox.java:114–122

getEnvProfile

public String getEnvProfile(String envType)

获取 getEnvProfile。

Retrieve the environment profile

参数Parameters
名称Name类型Type说明Description
envTypeString环境的类型。Type of environment
返回Returns String
返回字符串结果。Environment profile details
源码Source io/agentscope/runtime/sandbox/box/TrainingSandbox.java:130–132

getEnvProfile

public String getEnvProfile(String envType, String split, Map<String, Object> params)

获取 getEnvProfile。

Retrieve the environment profile

参数Parameters
名称Name类型Type说明Description
envTypeString环境的类型。Type of environment
splitString已拆分(类型 `String`)。Data split to retrieve profile from (default: "train")
paramsMap<String, Object>参数(类型 `Map`)。Additional profile retrieval parameters (optional)
返回Returns String
返回字符串结果。Environment profile details
源码Source io/agentscope/runtime/sandbox/box/TrainingSandbox.java:142–150

step

public String step(String instanceId)

设置步骤。

Execute a step in the training environment

参数Parameters
名称Name类型Type说明Description
instanceIdString实例标识(类型 `String`)。Identifier of the environment instance
返回Returns String
步骤执行的结果。Result of the step execution
源码Source io/agentscope/runtime/sandbox/box/TrainingSandbox.java:158–160

step

public String step(String instanceId, Map<String, Object> action, Map<String, Object> params)

执行步骤相关操作。

Execute a step in the training environment

参数Parameters
名称Name类型Type说明Description
instanceIdString实例标识(类型 `String`)。Identifier of the environment instance
actionMap<String, Object>动作(类型 `Map`)。Action to be performed in the environment (optional)
paramsMap<String, Object>参数(类型 `Map`)。Additional step parameters (optional)
返回Returns String
步骤执行的结果。Result of the step execution
源码Source io/agentscope/runtime/sandbox/box/TrainingSandbox.java:170–176

evaluate

public String evaluate(String instanceId)

设置该参数。

Evaluate the performance of a training environment instance

参数Parameters
名称Name类型Type说明Description
instanceIdString实例标识(类型 `String`)。Identifier of the environment instance
返回Returns String
返回字符串结果。Evaluation results
源码Source io/agentscope/runtime/sandbox/box/TrainingSandbox.java:184–186

evaluate

public String evaluate(String instanceId, Map<String, Object> messages, Map<String, Object> params)

执行 evaluate 方法。

Evaluate the performance of a training environment instance

参数Parameters
名称Name类型Type说明Description
instanceIdString实例标识(类型 `String`)。Identifier of the environment instance
messagesMap<String, Object>消息列表(类型 `Map`)。Evaluation-related messages (optional)
paramsMap<String, Object>参数(类型 `Map`)。Additional evaluation parameters (optional)
返回Returns String
返回字符串结果。Evaluation results
源码Source io/agentscope/runtime/sandbox/box/TrainingSandbox.java:196–205

releaseInstance

public String releaseInstance(String instanceId)

设置该参数。

Release a training environment instance

参数Parameters
名称Name类型Type说明Description
instanceIdString实例标识(类型 `String`)。Identifier of the instance to be released
返回Returns String
返回字符串结果。Result of the instance release operation
源码Source io/agentscope/runtime/sandbox/box/TrainingSandbox.java:213–217

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