AS AgentScopeAPI 手册 / API Reference

EnvironmentSpecFactory

@Component public class EnvironmentSpecFactory
源码Source io/agentscope/builder/web/managed/EnvironmentSpecFactory.java:50–346

环境规格工厂,承载智能体的部署、调度与服务化运行。位于 io.agentscope.builder.web.managed 包。核心成员包括 applyEnvironment、applyAgentSandboxFields、applyMemoryStoreRoutes、resolveE2bApiKey、hasE2bApiKey、EnvironmentSpecFactory。

Maps Managed Agents EnvironmentDto onto harness filesystem / sandbox specs.

Type semantics:

  • local — host LocalFilesystemSpec (dev; not production hands)

  • sandbox — E2B cloud sandbox via E2bFilesystemSpec (platform-managed hands)

  • remote — distributed KV filesystem (no shell); for shared artifacts / LTM routing

  • self_hosted — Brain-local filesystem/shell tools disabled; schema-only external hands tools suspend for an Environment Worker (Claude-style outbound execution)

Managed session default IsolationScope is IsolationScope#SESSION.

构造器摘要Constructor Summary

构造器Constructor说明Description
public EnvironmentSpecFactory(Optional<BaseStore> baseStore, Optional<io.agentscope.core.state.AgentStateStore> stateStore, BuilderE2bProperties e2bProperties)
初始化 `EnvironmentSpecFactory` 实例。
Creates a new instance.

方法摘要Method Summary

方法Method说明Description
public void applyEnvironment(HarnessAgent.Builder builder, EnvironmentDto environment)
应用环境。
Applies filesystem configuration from an environment resource onto a builder.
public void applyAgentSandboxFields(HarnessAgent.Builder builder, String sandboxMode, String sandboxScope)
应用 `applyAgentSandboxFields`。
Applies filesystem configuration from agent-level sandboxMode / sandboxScope fields (used when no session environment is available at build time).
public void applyMemoryStoreRoutes(HarnessAgent.Builder builder, String ownerId, List<MemoryStoreFilesystem> stores)
应用记忆存储路由。
Mounts MemoryStore backends under `memory-stores/{name}/` via harness route API.
public Optional<String> resolveE2bApiKey(Map<String, Object> config)
解析E 2 b API 键。
Resolves the E2B API key for a sandbox environment config.
public boolean hasE2bApiKey(Map<String, Object> config)
判断是否具有E 2 b API 键。
Whether an E2B API key is available for the given (optional) environment config.

构造器详情Constructor Detail

EnvironmentSpecFactory

public EnvironmentSpecFactory(Optional<BaseStore> baseStore, Optional<io.agentscope.core.state.AgentStateStore> stateStore, BuilderE2bProperties e2bProperties)

初始化 EnvironmentSpecFactory 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
baseStoreOptional<BaseStore>基类存储(类型 `Optional`)。The base store.
stateStoreOptional<io.agentscope.core.state.AgentStateStore>状态存储(类型 `Optional`)。The state store.
e2bPropertiesBuilderE2bPropertiese 2 b 属性(类型 `BuilderE2bProperties`)。The e 2 b properties.
源码Source io/agentscope/builder/web/managed/EnvironmentSpecFactory.java:71–78

方法详情Method Detail

applyEnvironment

public void applyEnvironment(HarnessAgent.Builder builder, EnvironmentDto environment)

应用环境。

Applies filesystem configuration from an environment resource onto a builder.

参数Parameters
名称Name类型Type说明Description
builderHarnessAgent.Builder构建器(类型 `HarnessAgent.Builder`)。The builder.
environmentEnvironmentDto环境(类型 `EnvironmentDto`)。The environment.
源码Source io/agentscope/builder/web/managed/EnvironmentSpecFactory.java:81–97

applyAgentSandboxFields

public void applyAgentSandboxFields(HarnessAgent.Builder builder, String sandboxMode, String sandboxScope)

应用 applyAgentSandboxFields。

Applies filesystem configuration from agent-level sandboxMode / sandboxScope fields (used when no session environment is available at build time).

参数Parameters
名称Name类型Type说明Description
builderHarnessAgent.Builder构建器(类型 `HarnessAgent.Builder`)。The builder.
sandboxModeString沙箱模式(类型 `String`)。The sandbox mode.
sandboxScopeString沙箱范围(类型 `String`)。The sandbox scope.
源码Source io/agentscope/builder/web/managed/EnvironmentSpecFactory.java:103–119

applyMemoryStoreRoutes

public void applyMemoryStoreRoutes(HarnessAgent.Builder builder, String ownerId, List<MemoryStoreFilesystem> stores)

应用记忆存储路由。

Mounts MemoryStore backends under memory-stores/{name}/ via harness route API.

参数Parameters
名称Name类型Type说明Description
builderHarnessAgent.Builder构建器(类型 `HarnessAgent.Builder`)。The builder.
ownerIdString所有者标识(类型 `String`)。The owner id.
storesList<MemoryStoreFilesystem>stores(类型 `List`)。The stores.
源码Source io/agentscope/builder/web/managed/EnvironmentSpecFactory.java:126–136

resolveE2bApiKey

public Optional<String> resolveE2bApiKey(Map<String, Object> config)

解析E 2 b API 键。

Resolves the E2B API key for a sandbox environment config.

参数Parameters
名称Name类型Type说明Description
configMap<String, Object>配置对象(类型 `Map`)。The config.
返回Returns Optional<String>
返回可选。Returns optional.
源码Source io/agentscope/builder/web/managed/EnvironmentSpecFactory.java:142–159

hasE2bApiKey

public boolean hasE2bApiKey(Map<String, Object> config)

判断是否具有E 2 b API 键。

Whether an E2B API key is available for the given (optional) environment config.

参数Parameters
名称Name类型Type说明Description
configMap<String, Object>配置对象(类型 `Map`)。The config.
返回Returns boolean
返回布尔值,表示判断结果。Returns a boolean result.
源码Source io/agentscope/builder/web/managed/EnvironmentSpecFactory.java:162–164
基于官方固定版本源码静态生成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.