Summary
With #1284, Container agents now have three flat, Container-only fields on AgentEnvSpec: dockerfile, buildContextPath, and customDockerBuildArgs — plus cross-cutting "only allowed for Container builds" validators for each.
Both AgentEnvSpecSchema copies (CLI and @aws/agentcore-cdk) already carry a standing comment near the validators:
If adding more Container-specific fields, consider consolidating into a containerConfig object (see networkConfig pattern)
We've now hit that threshold. This tracks grouping them under a single optional object:
containerConfig?: {
dockerfile?: string;
buildContextPath?: string;
customDockerBuildArgs?: Record<string, string>;
}
Benefits
- One
build !== 'Container' && data.containerConfig check instead of three per-field validators.
- Future container-only options land inside
containerConfig with no new cross-cutting validators.
- Clearer grouping in the schema and docs (mirrors the existing
networkConfig pattern).
Why it's deferred
This is a breaking schema change: it moves the already-shipped dockerfile field, touches every consumer, existing user agentcore.json files, and asset snapshots — and would have ballooned a contributor PR. Better as its own scoped change (with a migration note / back-compat shim if we want to keep accepting the flat form for a release).
Scope
- CLI:
src/schema/schemas/agent-env.ts (+ compacted mirror), consumers (packaging/container.ts, dev/config.ts, dev/container-dev-server.ts, deploy/preflight.ts), docs, snapshots.
@aws/agentcore-cdk: src/schema/schemas/agent-env.ts (+ compacted mirror), AgentEnvironment, ContainerSourceAsset.
Ref: review comment on #1284.
Summary
With #1284, Container agents now have three flat, Container-only fields on
AgentEnvSpec:dockerfile,buildContextPath, andcustomDockerBuildArgs— plus cross-cutting "only allowed for Container builds" validators for each.Both
AgentEnvSpecSchemacopies (CLI and@aws/agentcore-cdk) already carry a standing comment near the validators:We've now hit that threshold. This tracks grouping them under a single optional object:
Benefits
build !== 'Container' && data.containerConfigcheck instead of three per-field validators.containerConfigwith no new cross-cutting validators.networkConfigpattern).Why it's deferred
This is a breaking schema change: it moves the already-shipped
dockerfilefield, touches every consumer, existing useragentcore.jsonfiles, and asset snapshots — and would have ballooned a contributor PR. Better as its own scoped change (with a migration note / back-compat shim if we want to keep accepting the flat form for a release).Scope
src/schema/schemas/agent-env.ts(+ compacted mirror), consumers (packaging/container.ts,dev/config.ts,dev/container-dev-server.ts,deploy/preflight.ts), docs, snapshots.@aws/agentcore-cdk:src/schema/schemas/agent-env.ts(+ compacted mirror),AgentEnvironment,ContainerSourceAsset.Ref: review comment on #1284.