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 |
|---|---|---|
containerModel | ContainerModel | 容器模型(类型 `ContainerModel`)。The container model. |
timeout | int | 超时时间(类型 `int`)。The timeout. |
源码Source
io/agentscope/runtime/sandbox/manager/util/SandboxHttpClient.java:47–65方法详情Method Detail
checkHealth
public boolean checkHealth()
检查健康状态。
Returns the check health.
boolean返回布尔值,表示判断结果。Returns a boolean result.
源码Source
io/agentscope/runtime/sandbox/manager/util/SandboxHttpClient.java:67–83waitUntilHealthy
public void waitUntilHealthy()
等待 waitUntilHealthy。
Returns the wait until healthy.
源码Source
io/agentscope/runtime/sandbox/manager/util/SandboxHttpClient.java:85–104listTools
public Map<String, Object> listTools(String toolType, Map<String, Object> arguments)
列出工具。
Lists the tools.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
toolType | String | 工具类型(类型 `String`)。The tool type. |
arguments | Map<String, Object> | 参数(类型 `Map`)。The arguments. |
Map<String, Object>返回映射。Returns map.
源码Source
io/agentscope/runtime/sandbox/manager/util/SandboxHttpClient.java:106–140callTool
public String callTool(String toolName, Map<String, Object> arguments)
调用工具。
Calls the tool.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
toolName | String | 工具名称(类型 `String`)。The tool name. |
arguments | Map<String, Object> | 参数(类型 `Map`)。The arguments. |
String返回字符串结果。Returns a string.
源码Source
io/agentscope/runtime/sandbox/manager/util/SandboxHttpClient.java:142–178addMcpServers
public Map<String, Object> addMcpServers(Map<String, Object> serverConfigs, boolean overwrite)
添加 addMcpServers。
Adds the mcp servers.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
serverConfigs | Map<String, Object> | 服务端 Configs(类型 `Map`)。The server configs. |
overwrite | boolean | overwrite(类型 `boolean`)。The overwrite. |
Map<String, Object>返回映射。Returns map.
源码Source
io/agentscope/runtime/sandbox/manager/util/SandboxHttpClient.java:180–210close
public void close() throws IOException
关闭连接并释放相关资源。
Releases resources and connections.
IOException可能抛出 `IOException`。Thrown when the operation cannot be completed.
源码Source
io/agentscope/runtime/sandbox/manager/util/SandboxHttpClient.java:308–310