BedrockAgentCoreDataPlaneFrontingLayer / Client / start_code_interpreter_session

start_code_interpreter_session

BedrockAgentCoreDataPlaneFrontingLayer.Client.start_code_interpreter_session(**kwargs)

Creates and initializes a code interpreter session in Amazon Bedrock. 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:

See also: AWS API Documentation

Request Syntax

response = client.start_code_interpreter_session(
    codeInterpreterIdentifier='string',
    name='string',
    sessionTimeoutSeconds=123,
    clientToken='string'
)
Parameters:
  • codeInterpreterIdentifier (string) –

    [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.

  • name (string) – The name of the code interpreter session. This name helps you identify and manage the session. The name does not need to be unique.

  • sessionTimeoutSeconds (integer) – The time in seconds after which the session automatically terminates if there is no activity. The default value is 3600 seconds (1 hour). The minimum allowed value is 60 seconds, and the maximum allowed value is 28800 seconds (8 hours).

  • clientToken (string) –

    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 ignores the request, but does not return an error. This parameter helps prevent the creation of duplicate sessions if there are temporary network issues.

    This field is autopopulated if not provided.

Return type:

dict

Returns:

Response Syntax

{
    'codeInterpreterIdentifier': 'string',
    'sessionId': 'string',
    'createdAt': datetime(2015, 1, 1)
}

Response Structure

  • (dict) –

    • codeInterpreterIdentifier (string) –

      The identifier of the code interpreter.

    • sessionId (string) –

      The unique identifier of the created code interpreter session.

    • createdAt (datetime) –

      The time at which the code interpreter session was created.

Exceptions

  • BedrockAgentCoreDataPlaneFrontingLayer.Client.exceptions.ServiceQuotaExceededException

  • BedrockAgentCoreDataPlaneFrontingLayer.Client.exceptions.AccessDeniedException

  • BedrockAgentCoreDataPlaneFrontingLayer.Client.exceptions.ConflictException

  • BedrockAgentCoreDataPlaneFrontingLayer.Client.exceptions.ValidationException

  • BedrockAgentCoreDataPlaneFrontingLayer.Client.exceptions.ResourceNotFoundException

  • BedrockAgentCoreDataPlaneFrontingLayer.Client.exceptions.ThrottlingException

  • BedrockAgentCoreDataPlaneFrontingLayer.Client.exceptions.InternalServerException