AS AgentScopeAPI 手册 / API Reference

ConnectionStrategy

public interface ConnectionStrategy
源码Source io/agentscope/extensions/sandbox/kubernetes/client/internal/strategy/ConnectionStrategy.java:22–45

定义连接 Strategy契约的接口。位于 io.agentscope.extensions.sandbox.kubernetes.client.internal.strategy 包。核心成员包括 connect、close、shouldInjectRouterHeaders。

Strategy for discovering the HTTP base URL used to reach a sandbox. Mirrors the Python SDK's ConnectionStrategy.

方法摘要Method Summary

方法Method说明Description
public String connect() throws Exception
建立连接并完成初始化。
Discover and return the base URL.
default public void close()
default
关闭连接并释放相关资源。
Release any resources held by this strategy (e.g.
default public boolean shouldInjectRouterHeaders()
default
返回 `shouldInjectRouterHeaders` 结果。
Whether `X-Sandbox-*` router headers should be injected into requests.

方法详情Method Detail

connect

public String connect() throws Exception

建立连接并完成初始化。

Discover and return the base URL.

返回Returns String
返回字符串结果。the base URL (e.g. `http://127.0.0.1:12345`)
抛出Throws
  • Exception 可能抛出 `Exception`。Thrown when the operation cannot be completed.
源码Source io/agentscope/extensions/sandbox/kubernetes/client/internal/strategy/ConnectionStrategy.java:30

close

default public void close()
default

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

Release any resources held by this strategy (e.g.

源码Source io/agentscope/extensions/sandbox/kubernetes/client/internal/strategy/ConnectionStrategy.java:33–35

shouldInjectRouterHeaders

default public boolean shouldInjectRouterHeaders()
default

返回 shouldInjectRouterHeaders 结果。

Whether X-Sandbox-* router headers should be injected into requests.

返回Returns boolean
返回布尔值,表示判断结果。true for router-based strategies; false for in-cluster direct
源码Source io/agentscope/extensions/sandbox/kubernetes/client/internal/strategy/ConnectionStrategy.java:42–44
基于官方固定版本源码静态生成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.