start_code_interpreter_session¶
Operation¶
start_code_interpreter_session
async
¶
start_code_interpreter_session(input: StartCodeInterpreterSessionInput, plugins: list[Plugin] | None = None) -> StartCodeInterpreterSessionOutput
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 StopCodeInterpreterSession operation.
The following operations are related to StartCodeInterpreterSession:
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input
|
StartCodeInterpreterSessionInput
|
An instance of |
required |
plugins
|
list[Plugin] | None
|
A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations. |
None
|
Returns:
| Type | Description |
|---|---|
StartCodeInterpreterSessionOutput
|
An instance of |
Input¶
StartCodeInterpreterSessionInput
dataclass
¶
Dataclass for StartCodeInterpreterSessionInput structure.
Attributes¶
certificates
class-attribute
instance-attribute
¶
certificates: list[Certificate] | None = None
A list of certificates to install in the code interpreter session.
client_token
class-attribute
instance-attribute
¶
client_token: str | None = None
A 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.
code_interpreter_identifier
class-attribute
instance-attribute
¶
code_interpreter_identifier: str | None = None
The unique identifier of the code interpreter to use for this session. This identifier specifies which code interpreter environment to initialize for the session.
filesystem_configurations
class-attribute
instance-attribute
¶
filesystem_configurations: list[ToolsFileSystemConfiguration] | None = None
The 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.
name
class-attribute
instance-attribute
¶
name: str | None = None
The name of the code interpreter session. This name helps you identify and manage the session. The name does not need to be unique.
session_timeout_seconds
class-attribute
instance-attribute
¶
session_timeout_seconds: int = 900
The 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).
trace_id
class-attribute
instance-attribute
¶
trace_id: str | None = None
The trace identifier for request tracking.
trace_parent
class-attribute
instance-attribute
¶
trace_parent: str | None = None
The parent trace information for distributed tracing.
Output¶
StartCodeInterpreterSessionOutput
dataclass
¶
Dataclass for StartCodeInterpreterSessionOutput structure.
Attributes¶
code_interpreter_identifier
instance-attribute
¶
code_interpreter_identifier: str
The identifier of the code interpreter.
created_at
instance-attribute
¶
created_at: datetime
The time at which the code interpreter session was created.
session_id
instance-attribute
¶
session_id: str
The unique identifier of the created code interpreter session.