AS AgentScopeAPI 手册 / API Reference

SandboxHttpClient

public class SandboxHttpClient extends SandboxClient
源码Source io/agentscope/runtime/sandbox/manager/util/SandboxHttpClient.java:35–311

沙箱 HTTP 客户端,封装与远端服务的连接和调用。位于 io.agentscope.runtime.sandbox.manager.util 包,继承自 SandboxClient。核心成员包括 checkHealth、waitUntilHealthy、listTools、callTool、addMcpServers、close。

Sandbox HTTP Client Used for HTTP communication with sandbox containers and calling tools within the sandbox

构造器摘要Constructor Summary

构造器Constructor说明Description
public SandboxHttpClient(ContainerModel containerModel, int timeout)
初始化 `SandboxHttpClient` 实例。
Creates a new instance.

方法摘要Method Summary

方法Method说明Description
public boolean checkHealth()
检查健康状态。
Returns the check health.
public void waitUntilHealthy()
等待 `waitUntilHealthy`。
Returns the wait until healthy.
public Map<String, Object> listTools(String toolType, Map<String, Object> arguments)
列出工具。
Lists the tools.
public String callTool(String toolName, Map<String, Object> arguments)
调用工具。
Calls the tool.
public Map<String, Object> addMcpServers(Map<String, Object> serverConfigs, boolean overwrite)
添加 `addMcpServers`。
Adds the mcp servers.
public void close() throws IOException
关闭连接并释放相关资源。
Releases resources and connections.

构造器详情Constructor Detail

SandboxHttpClient

public SandboxHttpClient(ContainerModel containerModel, int timeout)

初始化 SandboxHttpClient 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
containerModelContainerModel容器模型(类型 `ContainerModel`)。The container model.
timeoutint超时时间(类型 `int`)。The timeout.
源码Source io/agentscope/runtime/sandbox/manager/util/SandboxHttpClient.java:47–65

方法详情Method Detail

checkHealth

public boolean checkHealth()

检查健康状态。

Returns the check health.

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

waitUntilHealthy

public void waitUntilHealthy()

等待 waitUntilHealthy。

Returns the wait until healthy.

源码Source io/agentscope/runtime/sandbox/manager/util/SandboxHttpClient.java:85–104

listTools

public Map<String, Object> listTools(String toolType, Map<String, Object> arguments)

列出工具。

Lists the tools.

参数Parameters
名称Name类型Type说明Description
toolTypeString工具类型(类型 `String`)。The tool type.
argumentsMap<String, Object>参数(类型 `Map`)。The arguments.
返回Returns Map<String, Object>
返回映射。Returns map.
源码Source io/agentscope/runtime/sandbox/manager/util/SandboxHttpClient.java:106–140

callTool

public String callTool(String toolName, Map<String, Object> arguments)

调用工具。

Calls the tool.

参数Parameters
名称Name类型Type说明Description
toolNameString工具名称(类型 `String`)。The tool name.
argumentsMap<String, Object>参数(类型 `Map`)。The arguments.
返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/runtime/sandbox/manager/util/SandboxHttpClient.java:142–178

addMcpServers

public Map<String, Object> addMcpServers(Map<String, Object> serverConfigs, boolean overwrite)

添加 addMcpServers。

Adds the mcp servers.

参数Parameters
名称Name类型Type说明Description
serverConfigsMap<String, Object>服务端 Configs(类型 `Map`)。The server configs.
overwritebooleanoverwrite(类型 `boolean`)。The overwrite.
返回Returns Map<String, Object>
返回映射。Returns map.
源码Source io/agentscope/runtime/sandbox/manager/util/SandboxHttpClient.java:180–210

close

public void close() throws IOException

关闭连接并释放相关资源。

Releases resources and connections.

抛出Throws
  • IOException 可能抛出 `IOException`。Thrown when the operation cannot be completed.
源码Source io/agentscope/runtime/sandbox/manager/util/SandboxHttpClient.java:308–310
基于官方固定版本源码静态生成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.