EnvironmentSpecFactory
@Component public class EnvironmentSpecFactory
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— hostLocalFilesystemSpec(dev; not production hands) -
sandbox— E2B cloud sandbox viaE2bFilesystemSpec(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
方法摘要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.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
baseStore | Optional<BaseStore> | 基类存储(类型 `Optional`)。The base store. |
stateStore | Optional<io.agentscope.core.state.AgentStateStore> | 状态存储(类型 `Optional`)。The state store. |
e2bProperties | BuilderE2bProperties | e 2 b 属性(类型 `BuilderE2bProperties`)。The e 2 b properties. |
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.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
builder | HarnessAgent.Builder | 构建器(类型 `HarnessAgent.Builder`)。The builder. |
environment | EnvironmentDto | 环境(类型 `EnvironmentDto`)。The environment. |
io/agentscope/builder/web/managed/EnvironmentSpecFactory.java:81–97applyAgentSandboxFields
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).
| 名称Name | 类型Type | 说明Description |
|---|---|---|
builder | HarnessAgent.Builder | 构建器(类型 `HarnessAgent.Builder`)。The builder. |
sandboxMode | String | 沙箱模式(类型 `String`)。The sandbox mode. |
sandboxScope | String | 沙箱范围(类型 `String`)。The sandbox scope. |
io/agentscope/builder/web/managed/EnvironmentSpecFactory.java:103–119applyMemoryStoreRoutes
public void applyMemoryStoreRoutes(HarnessAgent.Builder builder, String ownerId, List<MemoryStoreFilesystem> stores)
应用记忆存储路由。
Mounts MemoryStore backends under memory-stores/{name}/ via harness route API.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
builder | HarnessAgent.Builder | 构建器(类型 `HarnessAgent.Builder`)。The builder. |
ownerId | String | 所有者标识(类型 `String`)。The owner id. |
stores | List<MemoryStoreFilesystem> | stores(类型 `List`)。The stores. |
io/agentscope/builder/web/managed/EnvironmentSpecFactory.java:126–136resolveE2bApiKey
public Optional<String> resolveE2bApiKey(Map<String, Object> config)
解析E 2 b API 键。
Resolves the E2B API key for a sandbox environment config.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
config | Map<String, Object> | 配置对象(类型 `Map`)。The config. |
Optional<String>io/agentscope/builder/web/managed/EnvironmentSpecFactory.java:142–159hasE2bApiKey
public boolean hasE2bApiKey(Map<String, Object> config)
判断是否具有E 2 b API 键。
Whether an E2B API key is available for the given (optional) environment config.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
config | Map<String, Object> | 配置对象(类型 `Map`)。The config. |
booleanio/agentscope/builder/web/managed/EnvironmentSpecFactory.java:162–164