Skip to content

Commit 4bb17f2

Browse files
committed
fix(import): omit runtimeVersion for Container builds
Container runtimes have no runtimeVersion from the API, but toAgentEnvSpec was hardcoding PYTHON_3_12 as a fallback. Now runtimeVersion is optional in the schema and only set for non-Container builds.
1 parent d7fb70a commit 4bb17f2

5 files changed

Lines changed: 5 additions & 5 deletions

File tree

src/lib/packaging/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export function getContainerPackager(): RuntimePackager {
6767
* Automatically selects the appropriate packager based on build type and runtime version.
6868
*/
6969
export async function packRuntime(spec: AgentEnvSpec, options?: PackageOptions): Promise<ArtifactResult> {
70-
const packager = spec.build === 'Container' ? getContainerPackager() : getRuntimePackager(spec.runtimeVersion);
70+
const packager = spec.build === 'Container' ? getContainerPackager() : getRuntimePackager(spec.runtimeVersion!);
7171
return packager.pack(spec, options);
7272
}
7373

src/lib/packaging/node.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export class NodeCodeZipPackager implements RuntimePackager {
5454
throw new PackagingError('Node packager only supports CodeZip build type.');
5555
}
5656

57-
if (!isNodeRuntimeVersion(spec.runtimeVersion)) {
57+
if (!isNodeRuntimeVersion(spec.runtimeVersion!)) {
5858
throw new PackagingError(`Node packager only supports Node runtimes. Received: ${spec.runtimeVersion}`);
5959
}
6060

src/lib/packaging/python.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export class PythonCodeZipPackager implements RuntimePackager {
6060
throw new PackagingError('Python packager only supports CodeZip build type.');
6161
}
6262

63-
if (!isPythonRuntimeVersion(spec.runtimeVersion)) {
63+
if (!isPythonRuntimeVersion(spec.runtimeVersion!)) {
6464
throw new PackagingError(`Python packager only supports Python runtimes. Received: ${spec.runtimeVersion}`);
6565
}
6666

src/schema/llm-compacted/agentcore.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ interface AgentEnvSpec {
4646
build: BuildType;
4747
entrypoint: string; // @regex ^[a-zA-Z0-9_][a-zA-Z0-9_/.-]*\.(py|ts|js)(:[a-zA-Z_][a-zA-Z0-9_]*)?$ e.g. "main.py:handler" or "index.ts"
4848
codeLocation: string; // Directory path
49-
runtimeVersion: RuntimeVersion;
49+
runtimeVersion?: RuntimeVersion;
5050
envVars?: EnvVar[];
5151
networkMode?: NetworkMode; // default 'PUBLIC'
5252
networkConfig?: NetworkConfig; // Required when networkMode is 'VPC'

src/schema/schemas/agent-env.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ export const AgentEnvSpecSchema = z
181181
build: BuildTypeSchema,
182182
entrypoint: EntrypointSchema,
183183
codeLocation: DirectoryPathSchema,
184-
runtimeVersion: RuntimeVersionSchemaFromConstants,
184+
runtimeVersion: RuntimeVersionSchemaFromConstants.optional(),
185185
/** Environment variables to set on the runtime */
186186
envVars: z.array(EnvVarSchema).optional(),
187187
/** Network mode for the runtime. Defaults to PUBLIC. */

0 commit comments

Comments
 (0)