AS AgentScopeAPI 手册 / API Reference

AgentRunClient

public class AgentRunClient extends BaseClient
源码Source io/agentscope/runtime/sandbox/manager/client/AgentRunClient.java:37–697

智能体运行客户端,封装与远端服务的连接和调用。位于 io.agentscope.runtime.sandbox.manager.client 包,继承自 BaseClient。核心成员包括 connect、isConnected、createContainer、startContainer、stopContainer、removeContainer。

Client for managing AgentRun containers in the sandbox environment.

This client provides methods to create, start, stop, remove, and inspect AgentRun sessions. It also handles the underlying AgentRun API calls and status polling.

构造器摘要Constructor Summary

构造器Constructor说明Description
public AgentRunClient(AgentRunClientConfig config) throws Exception
初始化 `AgentRunClient` 实例。
Creates a new instance.

方法摘要Method Summary

方法Method说明Description
public boolean connect()
建立连接并完成初始化。
Returns the connect.
public boolean isConnected()
判断是否已连接。
Returns whether the connected.
public ContainerCreateResult createContainer(String containerName, String imageName, List<String> ports, List<VolumeBinding> volumeBindings, Map<String, String> environment, Map<String, Object> runtimeConfig)
创建容器。
Creates the container.
public void startContainer(String containerId)
启动容器。
Starts the container.
public void stopContainer(String containerId)
停止容器。
Stops the container.
public void removeContainer(String containerId)
移除容器。
Removes the container.
public String getContainerStatus(String containerId)
获取容器状态。
Returns the container status.
public boolean imageExists(String imageName)
设置该参数。
Performs the image exists operation.
public boolean inspectContainer(String containerIdOrName)
设置该参数。
Performs the inspect container operation.
public boolean pullImage(String imageName)
设置该参数。
Performs the pull image operation.
public Map<String, Object> inspect(String sessionId)
设置该参数。
Inspect an AgentRun session and return detailed information.

构造器详情Constructor Detail

AgentRunClient

public AgentRunClient(AgentRunClientConfig config) throws Exception

初始化 AgentRunClient 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
configAgentRunClientConfig配置对象(类型 `AgentRunClientConfig`)。The config.
抛出Throws
  • Exception 可能抛出 `Exception`。Thrown when the operation cannot be completed.
源码Source io/agentscope/runtime/sandbox/manager/client/AgentRunClient.java:58–69

方法详情Method Detail

connect

public boolean connect()

建立连接并完成初始化。

Returns the connect.

返回Returns boolean
返回布尔值,表示判断结果。Returns a boolean result.
源码Source io/agentscope/runtime/sandbox/manager/client/AgentRunClient.java:71–81

isConnected

public boolean isConnected()

判断是否已连接。

Returns whether the connected.

返回Returns boolean
返回布尔值,表示判断结果。Returns a boolean result.
源码Source io/agentscope/runtime/sandbox/manager/client/AgentRunClient.java:83–86

createContainer

public ContainerCreateResult createContainer(String containerName, String imageName, List<String> ports, List<VolumeBinding> volumeBindings, Map<String, String> environment, Map<String, Object> runtimeConfig)

创建容器。

Creates the container.

参数Parameters
名称Name类型Type说明Description
containerNameString容器名称(类型 `String`)。The container name.
imageNameString图像名称(类型 `String`)。The image name.
portsList<String>ports(类型 `List`)。The ports.
volumeBindingsList<VolumeBinding>volume Bindings(类型 `List`)。The volume bindings.
environmentMap<String, String>环境(类型 `Map`)。The environment.
runtimeConfigMap<String, Object>运行时配置(类型 `Map`)。The runtime config.
返回Returns ContainerCreateResult
返回ContainerCreateResult。Returns container create result.
源码Source io/agentscope/runtime/sandbox/manager/client/AgentRunClient.java:88–219

startContainer

public void startContainer(String containerId)

启动容器。

Starts the container.

参数Parameters
名称Name类型Type说明Description
containerIdString容器标识(类型 `String`)。The container id.
源码Source io/agentscope/runtime/sandbox/manager/client/AgentRunClient.java:221–241

stopContainer

public void stopContainer(String containerId)

停止容器。

Stops the container.

参数Parameters
名称Name类型Type说明Description
containerIdString容器标识(类型 `String`)。The container id.
源码Source io/agentscope/runtime/sandbox/manager/client/AgentRunClient.java:243–257

removeContainer

public void removeContainer(String containerId)

移除容器。

Removes the container.

参数Parameters
名称Name类型Type说明Description
containerIdString容器标识(类型 `String`)。The container id.
源码Source io/agentscope/runtime/sandbox/manager/client/AgentRunClient.java:259–287

getContainerStatus

public String getContainerStatus(String containerId)

获取容器状态。

Returns the container status.

参数Parameters
名称Name类型Type说明Description
containerIdString容器标识(类型 `String`)。The container id.
返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/runtime/sandbox/manager/client/AgentRunClient.java:289–311

imageExists

public boolean imageExists(String imageName)

设置该参数。

Performs the image exists operation.

参数Parameters
名称Name类型Type说明Description
imageNameString图像名称(类型 `String`)。The image name.
返回Returns boolean
返回布尔值,表示判断结果。Returns a boolean result.
源码Source io/agentscope/runtime/sandbox/manager/client/AgentRunClient.java:313–316

inspectContainer

public boolean inspectContainer(String containerIdOrName)

设置该参数。

Performs the inspect container operation.

参数Parameters
名称Name类型Type说明Description
containerIdOrNameString容器标识或名称(类型 `String`)。The container id or name.
返回Returns boolean
返回布尔值,表示判断结果。Returns a boolean result.
源码Source io/agentscope/runtime/sandbox/manager/client/AgentRunClient.java:318–322

pullImage

public boolean pullImage(String imageName)

设置该参数。

Performs the pull image operation.

参数Parameters
名称Name类型Type说明Description
imageNameString图像名称(类型 `String`)。The image name.
返回Returns boolean
返回布尔值,表示判断结果。Returns a boolean result.
源码Source io/agentscope/runtime/sandbox/manager/client/AgentRunClient.java:324–328

inspect

public Map<String, Object> inspect(String sessionId)

设置该参数。

Inspect an AgentRun session and return detailed information.

参数Parameters
名称Name类型Type说明Description
sessionIdString会话标识(类型 `String`)。The ID of the session to inspect.
返回Returns Map<String, Object>
返回映射。A map containing session information, agent runtime info, and status.
源码Source io/agentscope/runtime/sandbox/manager/client/AgentRunClient.java:336–393

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