Skip to content
v2.278.0

AgentCoreRuntime Class ​

Bedrock AgentCore runtime environment for code execution Allowed values: PYTHON_3_10 | PYTHON_3_11 | PYTHON_3_12 | PYTHON_3_13 | PYTHON_3_14 | NODE_22.

Example ​

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
# 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
// 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();
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
// 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,
})

Properties ​

Node.js 22 runtime.
PYTHON_3_10AgentCoreRuntimePYTHON_3_10AgentCoreRuntimePYTHON_3_10AgentCoreRuntimePYTHON_3_10AgentCoreRuntimePYTHON_3_10AgentCoreRuntime static #
Python 3.10 runtime.
PYTHON_3_11AgentCoreRuntimePYTHON_3_11AgentCoreRuntimePYTHON_3_11AgentCoreRuntimePYTHON_3_11AgentCoreRuntimePYTHON_3_11AgentCoreRuntime static #
Python 3.11 runtime.
PYTHON_3_12AgentCoreRuntimePYTHON_3_12AgentCoreRuntimePYTHON_3_12AgentCoreRuntimePYTHON_3_12AgentCoreRuntimePYTHON_3_12AgentCoreRuntime static #
Python 3.12 runtime.
PYTHON_3_13AgentCoreRuntimePYTHON_3_13AgentCoreRuntimePYTHON_3_13AgentCoreRuntimePYTHON_3_13AgentCoreRuntimePYTHON_3_13AgentCoreRuntime static #
Python 3.13 runtime.
PYTHON_3_14AgentCoreRuntimePYTHON_3_14AgentCoreRuntimePYTHON_3_14AgentCoreRuntimePYTHON_3_14AgentCoreRuntimePYTHON_3_14AgentCoreRuntime static #
Python 3.14 runtime.
valuestringvaluestrvalueStringValuestringValue*string #
The runtime string value.

Methods ​

of(value: string): AgentCoreRuntime // chainable@staticmethod def of(value: str) -> AgentCoreRuntimepublic static AgentCoreRuntime of(String value)public static AgentCoreRuntime Of(string value)func Of(Value *string) AgentCoreRuntime static #
Create a custom runtime value for runtimes not yet defined in this enum.
1 parameter

Parameters

  • valuevaluevaluevalueValue — The runtime string value.
toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string #
Returns the runtime string value.