Skip to content
v2.278.0

AgentRuntimeArtifact Class ​

Abstract base class for agent runtime artifacts.

Provides methods to reference container images from ECR repositories or local assets.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as bedrock_agentcore_alpha from '@aws-cdk/aws-bedrock-agentcore-alpha';
import * as cdk from 'aws-cdk-lib';
import { aws_ecr_assets as ecr_assets } from 'aws-cdk-lib';

declare const networkMode: ecr_assets.NetworkMode;
declare const platform: ecr_assets.Platform;
const agentRuntimeArtifact = bedrock_agentcore_alpha.AgentRuntimeArtifact.fromAsset('directory', /* all optional props */ {
  assetName: 'assetName',
  buildArgs: {
    buildArgsKey: 'buildArgs',
  },
  buildContexts: {
    buildContextsKey: 'buildContexts',
  },
  buildSecrets: {
    buildSecretsKey: 'buildSecrets',
  },
  buildSsh: 'buildSsh',
  cacheDisabled: false,
  cacheFrom: [{
    type: 'type',

    // the properties below are optional
    params: {
      paramsKey: 'params',
    },
  }],
  cacheTo: {
    type: 'type',

    // the properties below are optional
    params: {
      paramsKey: 'params',
    },
  },
  displayName: 'displayName',
  exclude: ['exclude'],
  extraHash: 'extraHash',
  file: 'file',
  followSymlinks: cdk.SymlinkFollowMode.NEVER,
  ignoreMode: cdk.IgnoreMode.GLOB,
  invalidation: {
    buildArgs: false,
    buildContexts: false,
    buildSecrets: false,
    buildSsh: false,
    extraHash: false,
    file: false,
    networkMode: false,
    outputs: false,
    platform: false,
    repositoryName: false,
    target: false,
  },
  networkMode: networkMode,
  outputs: ['outputs'],
  platform: platform,
  target: 'target',
});
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_bedrock_agentcore_alpha as bedrock_agentcore_alpha
import aws_cdk as cdk
from aws_cdk import aws_ecr_assets as ecr_assets

# network_mode: ecr_assets.NetworkMode
# platform: ecr_assets.Platform

agent_runtime_artifact = bedrock_agentcore_alpha.AgentRuntimeArtifact.from_asset("directory",
    asset_name="assetName",
    build_args={
        "build_args_key": "buildArgs"
    },
    build_contexts={
        "build_contexts_key": "buildContexts"
    },
    build_secrets={
        "build_secrets_key": "buildSecrets"
    },
    build_ssh="buildSsh",
    cache_disabled=False,
    cache_from=[ecr_assets.DockerCacheOption(
        type="type",

        # the properties below are optional
        params={
            "params_key": "params"
        }
    )],
    cache_to=ecr_assets.DockerCacheOption(
        type="type",

        # the properties below are optional
        params={
            "params_key": "params"
        }
    ),
    display_name="displayName",
    exclude=["exclude"],
    extra_hash="extraHash",
    file="file",
    follow_symlinks=cdk.SymlinkFollowMode.NEVER,
    ignore_mode=cdk.IgnoreMode.GLOB,
    invalidation=ecr_assets.DockerImageAssetInvalidationOptions(
        build_args=False,
        build_contexts=False,
        build_secrets=False,
        build_ssh=False,
        extra_hash=False,
        file=False,
        network_mode=False,
        outputs=False,
        platform=False,
        repository_name=False,
        target=False
    ),
    network_mode=network_mode,
    outputs=["outputs"],
    platform=platform,
    target="target"
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.bedrock.agentcore.alpha.*;
import software.amazon.awscdk.*;
import software.amazon.awscdk.services.ecr.assets.*;

NetworkMode networkMode;
Platform platform;

AgentRuntimeArtifact agentRuntimeArtifact = AgentRuntimeArtifact.fromAsset("directory", DockerImageAssetOptions.builder()
        .assetName("assetName")
        .buildArgs(Map.of(
                "buildArgsKey", "buildArgs"))
        .buildContexts(Map.of(
                "buildContextsKey", "buildContexts"))
        .buildSecrets(Map.of(
                "buildSecretsKey", "buildSecrets"))
        .buildSsh("buildSsh")
        .cacheDisabled(false)
        .cacheFrom(List.of(DockerCacheOption.builder()
                .type("type")

                // the properties below are optional
                .params(Map.of(
                        "paramsKey", "params"))
                .build()))
        .cacheTo(DockerCacheOption.builder()
                .type("type")

                // the properties below are optional
                .params(Map.of(
                        "paramsKey", "params"))
                .build())
        .displayName("displayName")
        .exclude(List.of("exclude"))
        .extraHash("extraHash")
        .file("file")
        .followSymlinks(SymlinkFollowMode.NEVER)
        .ignoreMode(IgnoreMode.GLOB)
        .invalidation(DockerImageAssetInvalidationOptions.builder()
                .buildArgs(false)
                .buildContexts(false)
                .buildSecrets(false)
                .buildSsh(false)
                .extraHash(false)
                .file(false)
                .networkMode(false)
                .outputs(false)
                .platform(false)
                .repositoryName(false)
                .target(false)
                .build())
        .networkMode(networkMode)
        .outputs(List.of("outputs"))
        .platform(platform)
        .target("target")
        .build());
csharp
// Install: dotnet add package Amazon.CDK.AWS.Bedrock.Agentcore.Alpha
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.Bedrock.Agentcore.Alpha;
using Amazon.CDK;
using Amazon.CDK.AWS.Ecr.Assets;

NetworkMode networkMode;
Platform platform;

var agentRuntimeArtifact = AgentRuntimeArtifact.FromAsset("directory", new DockerImageAssetOptions {
    AssetName = "assetName",
    BuildArgs = new Dictionary<string, string> {
        { "buildArgsKey", "buildArgs" }
    },
    BuildContexts = new Dictionary<string, string> {
        { "buildContextsKey", "buildContexts" }
    },
    BuildSecrets = new Dictionary<string, string> {
        { "buildSecretsKey", "buildSecrets" }
    },
    BuildSsh = "buildSsh",
    CacheDisabled = false,
    CacheFrom = new [] { new DockerCacheOption {
        Type = "type",

        // the properties below are optional
        Params = new Dictionary<string, string> {
            { "paramsKey", "params" }
        }
    } },
    CacheTo = new DockerCacheOption {
        Type = "type",

        // the properties below are optional
        Params = new Dictionary<string, string> {
            { "paramsKey", "params" }
        }
    },
    DisplayName = "displayName",
    Exclude = new [] { "exclude" },
    ExtraHash = "extraHash",
    File = "file",
    FollowSymlinks = SymlinkFollowMode.NEVER,
    IgnoreMode = IgnoreMode.GLOB,
    Invalidation = new DockerImageAssetInvalidationOptions {
        BuildArgs = false,
        BuildContexts = false,
        BuildSecrets = false,
        BuildSsh = false,
        ExtraHash = false,
        File = false,
        NetworkMode = false,
        Outputs = false,
        Platform = false,
        RepositoryName = false,
        Target = false
    },
    NetworkMode = networkMode,
    Outputs = new [] { "outputs" },
    Platform = platform,
    Target = "target"
});
go
// Install: go get github.com/aws/aws-cdk-go/awsbedrockagentcorealpha/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import bedrock_agentcore_alpha "github.com/aws/aws-cdk-go/awsbedrockagentcorealpha"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

var networkMode NetworkMode
var platform Platform

agentRuntimeArtifact := bedrock_agentcore_alpha.AgentRuntimeArtifact_FromAsset(jsii.String("directory"), &DockerImageAssetOptions{
	AssetName: jsii.String("assetName"),
	BuildArgs: map[string]*string{
		"buildArgsKey": jsii.String("buildArgs"),
	},
	BuildContexts: map[string]*string{
		"buildContextsKey": jsii.String("buildContexts"),
	},
	BuildSecrets: map[string]*string{
		"buildSecretsKey": jsii.String("buildSecrets"),
	},
	BuildSsh: jsii.String("buildSsh"),
	CacheDisabled: jsii.Boolean(false),
	CacheFrom: []DockerCacheOption{
		&DockerCacheOption{
			Type: jsii.String("type"),

			// the properties below are optional
			Params: map[string]*string{
				"paramsKey": jsii.String("params"),
			},
		},
	},
	CacheTo: &DockerCacheOption{
		Type: jsii.String("type"),

		// the properties below are optional
		Params: map[string]*string{
			"paramsKey": jsii.String("params"),
		},
	},
	DisplayName: jsii.String("displayName"),
	Exclude: []*string{
		jsii.String("exclude"),
	},
	ExtraHash: jsii.String("extraHash"),
	File: jsii.String("file"),
	FollowSymlinks: cdk.SymlinkFollowMode_NEVER,
	IgnoreMode: cdk.IgnoreMode_GLOB,
	Invalidation: &DockerImageAssetInvalidationOptions{
		BuildArgs: jsii.Boolean(false),
		BuildContexts: jsii.Boolean(false),
		BuildSecrets: jsii.Boolean(false),
		BuildSsh: jsii.Boolean(false),
		ExtraHash: jsii.Boolean(false),
		File: jsii.Boolean(false),
		NetworkMode: jsii.Boolean(false),
		Outputs: jsii.Boolean(false),
		Platform: jsii.Boolean(false),
		RepositoryName: jsii.Boolean(false),
		Target: jsii.Boolean(false),
	},
	NetworkMode: networkMode,
	Outputs: []*string{
		jsii.String("outputs"),
	},
	Platform: platform,
	Target: jsii.String("target"),
})

Initializer ​

ts
new AgentRuntimeArtifact()
python
AgentRuntimeArtifact()
java
new AgentRuntimeArtifact()
csharp
new AgentRuntimeArtifact()
go
NewAgentRuntimeArtifact()

Methods ​

bind(scope: Construct, runtime: Runtime): voiddef bind(self, scope: Construct, runtime: Runtime) -> Nonepublic void bind(Construct scope, Runtime runtime)public void Bind(Construct scope, Runtime runtime)func Bind(Scope Construct, Runtime Runtime) #
Called when the image is used by a Runtime to handle side effects like permissions.
fromAsset(directory: string, options?: DockerImageAssetOptions): AgentRuntimeArtifact // chainable@staticmethod def from_asset(directory: str, options: typing.Optional[DockerImageAssetOptions] = None) -> AgentRuntimeArtifactpublic static AgentRuntimeArtifact fromAsset(String directory, DockerImageAssetOptions options)public static AgentRuntimeArtifact FromAsset(string directory, DockerImageAssetOptions? options = null)func FromAsset(Directory *string, Options DockerImageAssetOptions) AgentRuntimeArtifact static #
Reference an agent runtime artifact that's constructed directly from sources on disk.
2 parameters

Parameters

  • directorydirectorydirectorydirectoryDirectory — The directory where the Dockerfile is stored.
  • optionsoptionsoptionsoptionsOptions — The options to further configure the selected image.
fromCodeAsset(options: CodeAssetOptions): AgentRuntimeArtifact // chainable@staticmethod def from_code_asset(options: CodeAssetOptions) -> AgentRuntimeArtifactpublic static AgentRuntimeArtifact fromCodeAsset(CodeAssetOptions options)public static AgentRuntimeArtifact FromCodeAsset(CodeAssetOptions options)func FromCodeAsset(Options CodeAssetOptions) AgentRuntimeArtifact static #
Reference an agent runtime artifact that's constructed from local code assets uploaded to a CDK-managed S3 bucket.
1 parameter

Parameters

  • optionsoptionsoptionsoptionsOptions — The options for configuring the code asset.
fromEcrRepository(repository: IRepository, tag?: string): AgentRuntimeArtifact // chainable@staticmethod def from_ecr_repository(repository: IRepository, tag: typing.Optional[str] = None) -> AgentRuntimeArtifactpublic static AgentRuntimeArtifact fromEcrRepository(IRepository repository, String tag)public static AgentRuntimeArtifact FromEcrRepository(IRepository repository, string? tag = null)func FromEcrRepository(Repository IRepository, Tag *string) AgentRuntimeArtifact static #
Reference an image in an ECR repository.
fromImageUri(containerUri: string): AgentRuntimeArtifact // chainable@staticmethod def from_image_uri(container_uri: str) -> AgentRuntimeArtifactpublic static AgentRuntimeArtifact fromImageUri(String containerUri)public static AgentRuntimeArtifact FromImageUri(string containerUri)func FromImageUri(ContainerUri *string) AgentRuntimeArtifact static #
Reference an image using an ECR container URI.

Use this when referencing ECR images from CloudFormation parameters or cross-stack references.

Note: No IAM permissions are automatically granted. You must ensure the runtime has ECR pull permissions for the repository.

1 parameter

Parameters

  • containerUricontainer_uricontainerUricontainerUriContainerUri — The ECR container image URI (format: {account}.dkr.ecr.{region}.amazonaws.com/{repository}:{tag}).
fromS3(s3Location: Location, runtime: AgentCoreRuntime, entrypoint: string[]): AgentRuntimeArtifact // chainable@staticmethod def from_s3(s3_location: Location, runtime: AgentCoreRuntime, entrypoint: typing.List[str]) -> AgentRuntimeArtifactpublic static AgentRuntimeArtifact fromS3(Location s3Location, AgentCoreRuntime runtime, List<String> entrypoint)public static AgentRuntimeArtifact FromS3(Location s3Location, AgentCoreRuntime runtime, string[] entrypoint)func FromS3(S3Location Location, Runtime AgentCoreRuntime, Entrypoint *[]*string) AgentRuntimeArtifact static #
Reference an agent runtime artifact that's constructed directly from an S3 object.
3 parameters

Parameters

  • s3Locations3_locations3Locations3LocationS3Location — The source code location and configuration details.
  • runtimeruntimeruntimeruntimeRuntime — The runtime environment for executing the code.
  • entrypointentrypointentrypointentrypointEntrypoint — The entry point for the code execution, specifying the function or method that should be invoked when the code runs.