AgentRuntimeArtifact

class aws_cdk.aws_bedrock_agentcore_alpha.AgentRuntimeArtifact

Bases: object

(experimental) Abstract base class for agent runtime artifacts.

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

Stability:

experimental

ExampleMetadata:

fixture=default infused

Example:

repository = ecr.Repository(self, "TestRepository",
    repository_name="test-agent-runtime"
)
agent_runtime_artifact = agentcore.AgentRuntimeArtifact.from_ecr_repository(repository, "v1.0.0")

runtime = agentcore.Runtime(self, "MyAgentRuntime",
    runtime_name="myAgent",
    agent_runtime_artifact=agent_runtime_artifact,
    authorizer_configuration=agentcore.RuntimeAuthorizerConfiguration.using_oAuth("https://github.com/.well-known/openid-configuration", "oauth_client_123")
)
Stability:

experimental

Methods

abstractmethod bind(scope, runtime)

(experimental) Called when the image is used by a Runtime to handle side effects like permissions.

Parameters:
Stability:

experimental

Return type:

None

Static Methods

classmethod from_asset(directory, *, asset_name=None, build_args=None, build_secrets=None, build_ssh=None, cache_disabled=None, cache_from=None, cache_to=None, display_name=None, file=None, invalidation=None, network_mode=None, outputs=None, platform=None, target=None, extra_hash=None, exclude=None, follow_symlinks=None, ignore_mode=None)

(experimental) Reference an agent runtime artifact that’s constructed directly from sources on disk.

Parameters:
  • directory (str) – The directory where the Dockerfile is stored.

  • asset_name (Optional[str]) – Unique identifier of the docker image asset and its potential revisions. Required if using AppScopedStagingSynthesizer. Default: - no asset name

  • build_args (Optional[Mapping[str, str]]) – Build args to pass to the docker build command. Since Docker build arguments are resolved before deployment, keys and values cannot refer to unresolved tokens (such as lambda.functionArn or queue.queueUrl). Default: - no build args are passed

  • build_secrets (Optional[Mapping[str, str]]) – Build secrets. Docker BuildKit must be enabled to use build secrets. Default: - no build secrets

  • build_ssh (Optional[str]) – SSH agent socket or keys to pass to the docker build command. Docker BuildKit must be enabled to use the ssh flag Default: - no –ssh flag

  • cache_disabled (Optional[bool]) – Disable the cache and pass --no-cache to the docker build command. Default: - cache is used

  • cache_from (Optional[Sequence[Union[DockerCacheOption, Dict[str, Any]]]]) – Cache from options to pass to the docker build command. Default: - no cache from options are passed to the build command

  • cache_to (Union[DockerCacheOption, Dict[str, Any], None]) – Cache to options to pass to the docker build command. Default: - no cache to options are passed to the build command

  • display_name (Optional[str]) – A display name for this asset. If supplied, the display name will be used in locations where the asset identifier is printed, like in the CLI progress information. If the same asset is added multiple times, the display name of the first occurrence is used. If assetName is given, it will also be used as the default displayName. Otherwise, the default is the construct path of the ImageAsset construct, with respect to the enclosing stack. If the asset is produced by a construct helper function (such as lambda.Code.fromAssetImage()), this will look like MyFunction/AssetImage. We use the stack-relative construct path so that in the common case where you have multiple stacks with the same asset, we won’t show something like /MyBetaStack/MyFunction/Code when you are actually deploying to production. Default: - Stack-relative construct path

  • file (Optional[str]) – Path to the Dockerfile (relative to the directory). Default: ‘Dockerfile’

  • invalidation (Union[DockerImageAssetInvalidationOptions, Dict[str, Any], None]) – Options to control which parameters are used to invalidate the asset hash. Default: - hash all parameters

  • network_mode (Optional[NetworkMode]) – Networking mode for the RUN commands during build. Support docker API 1.25+. Default: - no networking mode specified (the default networking mode NetworkMode.DEFAULT will be used)

  • outputs (Optional[Sequence[str]]) – Outputs to pass to the docker build command. Default: - no outputs are passed to the build command (default outputs are used)

  • platform (Optional[Platform]) – Platform to build for. Requires Docker Buildx. Default: - no platform specified (the current machine architecture will be used)

  • target (Optional[str]) – Docker target to build to. Default: - no target

  • extra_hash (Optional[str]) – Extra information to encode into the fingerprint (e.g. build instructions and other inputs). Default: - hash is only based on source content

  • exclude (Optional[Sequence[str]]) – File paths matching the patterns will be excluded. See ignoreMode to set the matching behavior. Has no effect on Assets bundled using the bundling property. Default: - nothing is excluded

  • follow_symlinks (Optional[SymlinkFollowMode]) – A strategy for how to handle symlinks. Default: SymlinkFollowMode.NEVER

  • ignore_mode (Optional[IgnoreMode]) – The ignore behavior to use for exclude patterns. Default: IgnoreMode.GLOB

Stability:

experimental

Return type:

AgentRuntimeArtifact

classmethod from_ecr_repository(repository, tag=None)

(experimental) Reference an image in an ECR repository.

Parameters:
Stability:

experimental

Return type:

AgentRuntimeArtifact

classmethod from_image_uri(container_uri)

(experimental) 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.

Parameters:

container_uri (str) – The ECR container image URI (format: {account}.dkr.ecr.{region}.amazonaws.com/{repository}:{tag}).

Stability:

experimental

Return type:

AgentRuntimeArtifact

classmethod from_s3(s3_location, runtime, entrypoint)

(experimental) Reference an agent runtime artifact that’s constructed directly from an S3 object.

Parameters:
  • s3_location (Union[Location, Dict[str, Any]]) – The source code location and configuration details.

  • runtime (AgentCoreRuntime) – The runtime environment for executing the code. Allowed values: PYTHON_3_10 | PYTHON_3_11 | PYTHON_3_12 | PYTHON_3_13

  • entrypoint (Sequence[str]) – The entry point for the code execution, specifying the function or method that should be invoked when the code runs.

Stability:

experimental

Return type:

AgentRuntimeArtifact