Creates and initializes a code interpreter session in Amazon Bedrock AgentCore¶
Description¶
Creates and initializes a code interpreter session in Amazon Bedrock AgentCore. The session enables agents to execute code as part of their response generation, supporting programming languages such as Python for data analysis, visualization, and computation tasks.
To create a session, you must specify a code interpreter identifier and a name. The session remains active until it times out or you explicitly stop it using the stop_code_interpreter_session operation.
The following operations are related to start_code_interpreter_session:
Usage¶
bedrockagentcore_start_code_interpreter_session(traceId, traceParent,
codeInterpreterIdentifier, name, sessionTimeoutSeconds, certificates,
filesystemConfigurations, clientToken)
Arguments¶
-
traceIdThe trace identifier for request tracking.
-
traceParentThe parent trace information for distributed tracing.
-
codeInterpreterIdentifier[required] The unique identifier of the code interpreter to use for this session. This identifier specifies which code interpreter environment to initialize for the session.
-
nameThe name of the code interpreter session. This name helps you identify and manage the session. The name does not need to be unique.
-
sessionTimeoutSecondsThe duration in seconds (time-to-live) after which the session automatically terminates, regardless of ongoing activity. Defaults to 900 seconds (15 minutes). Recommended minimum: 60 seconds. Maximum allowed: 28,800 seconds (8 hours).
-
certificatesA list of certificates to install in the code interpreter session.
-
filesystemConfigurationsThe file system configurations to mount into the code interpreter session. Use these configurations to mount your own Amazon Simple Storage Service (Amazon S3) Files or Amazon Elastic File System (Amazon EFS) access points. Your session can then read and write your data. If you don't specify this field, no additional file systems are mounted.
-
clientTokenA unique, case-sensitive identifier to ensure that the API request completes no more than one time. If this token matches a previous request, Amazon Bedrock AgentCore ignores the request, but does not return an error. This parameter helps prevent the creation of duplicate sessions if there are temporary network issues.
Value¶
A list with the following syntax:
list(
codeInterpreterIdentifier = "string",
sessionId = "string",
createdAt = as.POSIXct(
"2015-01-01"
)
)
Request syntax¶
svc$start_code_interpreter_session(
traceId = "string",
traceParent = "string",
codeInterpreterIdentifier = "string",
name = "string",
sessionTimeoutSeconds = 123,
certificates = list(
list(
location = list(
secretsManager = list(
secretArn = "string"
)
)
)
),
filesystemConfigurations = list(
list(
s3FilesConfiguration = list(
accessPointArn = "string",
mountPath = "string",
fileSystemArn = "string"
),
efsConfiguration = list(
accessPointArn = "string",
mountPath = "string",
fileSystemArn = "string"
)
)
),
clientToken = "string"
)