# AgentRuntimeArtifact

Class · Stable

Abstract base class for agent runtime artifacts.

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

Obtainable from: AgentRuntimeArtifact.fromAsset, AgentRuntimeArtifact.fromCodeAsset, AgentRuntimeArtifact.fromEcrRepository, AgentRuntimeArtifact.fromImageUri, AgentRuntimeArtifact.fromS3

- Source: [`aws-bedrockagentcore/lib/runtime/runtime-artifact.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-bedrockagentcore/lib/runtime/runtime-artifact.ts#L105)
- Type last changed: v2.255.0 · 19 May 2026

## Example

TypeScript:

```ts
// S3 bucket containing the agent core
const codeBucket = new s3.Bucket(this, "AgentCode", {
  bucketName: "my-code-bucket",
  removalPolicy: RemovalPolicy.DESTROY, // For demo purposes
});

// the bucket above needs to contain the agent code

const agentRuntimeArtifact = agentcore.AgentRuntimeArtifact.fromS3(
  {
    bucketName: codeBucket.bucketName,
    objectKey: 'deployment_package.zip',
  },
  agentcore.AgentCoreRuntime.PYTHON_3_12,
  ['opentelemetry-instrument', 'main.py']
);

const runtimeInstance = new agentcore.Runtime(this, "MyAgentRuntime", {
  runtimeName: "myAgent",
  agentRuntimeArtifact: agentRuntimeArtifact,
});
```

Python:

```python
# S3 bucket containing the agent core
code_bucket = s3.Bucket(self, "AgentCode",
    bucket_name="my-code-bucket",
    removal_policy=RemovalPolicy.DESTROY
)

# the bucket above needs to contain the agent code

agent_runtime_artifact = agentcore.AgentRuntimeArtifact.from_s3(s3.Location(
    bucket_name=code_bucket.bucket_name,
    object_key="deployment_package.zip"
), agentcore.AgentCoreRuntime.PYTHON_3_12, ["opentelemetry-instrument", "main.py"])

runtime_instance = agentcore.Runtime(self, "MyAgentRuntime",
    runtime_name="myAgent",
    agent_runtime_artifact=agent_runtime_artifact
)
```

Java:

```java
// S3 bucket containing the agent core
Bucket codeBucket = Bucket.Builder.create(this, "AgentCode")
        .bucketName("my-code-bucket")
        .removalPolicy(RemovalPolicy.DESTROY)
        .build();

// the bucket above needs to contain the agent code

AgentRuntimeArtifact agentRuntimeArtifact = AgentRuntimeArtifact.fromS3(Location.builder()
        .bucketName(codeBucket.getBucketName())
        .objectKey("deployment_package.zip")
        .build(), AgentCoreRuntime.PYTHON_3_12, List.of("opentelemetry-instrument", "main.py"));

Runtime runtimeInstance = Runtime.Builder.create(this, "MyAgentRuntime")
        .runtimeName("myAgent")
        .agentRuntimeArtifact(agentRuntimeArtifact)
        .build();
```

C#:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
// S3 bucket containing the agent core
var codeBucket = new Bucket(this, "AgentCode", new BucketProps {
    BucketName = "my-code-bucket",
    RemovalPolicy = RemovalPolicy.DESTROY
});

// the bucket above needs to contain the agent code

var agentRuntimeArtifact = AgentRuntimeArtifact.FromS3(new Location {
    BucketName = codeBucket.BucketName,
    ObjectKey = "deployment_package.zip"
}, AgentCoreRuntime.PYTHON_3_12, new [] { "opentelemetry-instrument", "main.py" });

var runtimeInstance = new Runtime(this, "MyAgentRuntime", new RuntimeProps {
    RuntimeName = "myAgent",
    AgentRuntimeArtifact = agentRuntimeArtifact
});
```

Go:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// S3 bucket containing the agent core
codeBucket := s3.NewBucket(this, jsii.String("AgentCode"), &BucketProps{
	BucketName: jsii.String("my-code-bucket"),
	RemovalPolicy: awscdk.RemovalPolicy_DESTROY,
})

// the bucket above needs to contain the agent code

agentRuntimeArtifact := agentcore.AgentRuntimeArtifact_FromS3(&Location{
	BucketName: codeBucket.bucketName,
	ObjectKey: jsii.String("deployment_package.zip"),
}, agentcore.AgentCoreRuntime_PYTHON_3_12(), []*string{
	jsii.String("opentelemetry-instrument"),
	jsii.String("main.py"),
})

runtimeInstance := agentcore.NewRuntime(this, jsii.String("MyAgentRuntime"), &RuntimeProps{
	RuntimeName: jsii.String("myAgent"),
	AgentRuntimeArtifact: agentRuntimeArtifact,
})
```

## Initializer

TypeScript:

```ts
new AgentRuntimeArtifact()
```

Python:

```python
AgentRuntimeArtifact()
```

Java:

```java
new AgentRuntimeArtifact()
```

C#:

```csharp
new AgentRuntimeArtifact()
```

Go:

```go
NewAgentRuntimeArtifact()
```

## Methods

- `bind(scope: Construct, runtime: Runtime): void` — Called when the image is used by a Runtime to handle side effects like permissions.

- `fromAsset(directory: string, options?: DockerImageAssetOptions): AgentRuntimeArtifact // chainable` (static) — Reference an agent runtime artifact that's constructed directly from sources on disk.

  **Parameters**

  - `directory` — The directory where the Dockerfile is stored.
  - `options` — The options to further configure the selected image.

- `fromCodeAsset(options: CodeAssetOptions): AgentRuntimeArtifact // chainable` (static) — Reference an agent runtime artifact that's constructed from local code assets uploaded to a CDK-managed S3 bucket.

  The folder is zipped as is. Include all dependencies, built for Linux arm64, in the folder.

  **Parameters**

  - `options` — The options for configuring the code asset.

- `fromEcrRepository(repository: IRepository, tag?: string): AgentRuntimeArtifact // chainable` (static) — Reference an image in an ECR repository.

- `fromImageUri(containerUri: string): AgentRuntimeArtifact // chainable` (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.

  **Parameters**

  - `containerUri` — The ECR container image URI (format: {account}.dkr.ecr.{region}.amazonaws.com/{repository}:{tag}, or {account}.dkr.ecr.{region}.amazonaws.com.cn/{repository}:{tag} in the aws-cn partition).

- `fromS3(s3Location: Location, runtime: AgentCoreRuntime, entrypoint: string[]): AgentRuntimeArtifact // chainable` (static) — Reference an agent runtime artifact that's constructed directly from an S3 object.

  **Parameters**

  - `s3Location` — The source code location and configuration details.
  - `runtime` — The runtime environment for executing the code.
  - `entrypoint` — The entry point for the code execution, specifying the function or method that should be invoked when the code runs.
