:doc:`BedrockAgentCore <../../bedrock-agentcore>` / Client / start_code_interpreter_session

******************************
start_code_interpreter_session
******************************



.. py:method:: BedrockAgentCore.Client.start_code_interpreter_session(**kwargs)

  

  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``:

   

  
  * `InvokeCodeInterpreter <https://docs.aws.amazon.com/bedrock-agentcore/latest/APIReference/API_InvokeCodeInterpreter.html>`__
   
  * `GetCodeInterpreterSession <https://docs.aws.amazon.com/bedrock-agentcore/latest/APIReference/API_GetCodeInterpreterSession.html>`__
   
  * `StopCodeInterpreterSession <https://docs.aws.amazon.com/bedrock-agentcore/latest/APIReference/API_StopCodeInterpreterSession.html>`__
  

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/bedrock-agentcore-2024-02-28/StartCodeInterpreterSession>`_  


  **Request Syntax**
  ::

    response = client.start_code_interpreter_session(
        traceId='string',
        traceParent='string',
        codeInterpreterIdentifier='string',
        name='string',
        sessionTimeoutSeconds=123,
        clientToken='string'
    )
    
  :type traceId: string
  :param traceId: 

    The trace identifier for request tracking.

    

  
  :type traceParent: string
  :param traceParent: 

    The parent trace information for distributed tracing.

    

  
  :type codeInterpreterIdentifier: string
  :param 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.

    

  
  :type name: string
  :param name: 

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

    

  
  :type sessionTimeoutSeconds: integer
  :param sessionTimeoutSeconds: 

    The time in seconds after which the session automatically terminates if there is no activity. The default value is 900 seconds (15 minutes). The minimum allowed value is 60 seconds, and the maximum allowed value is 28800 seconds (8 hours).

    

  
  :type clientToken: string
  :param clientToken: 

    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.

    This field is autopopulated if not provided.

  
  
  :rtype: 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**
  
  *   :py:class:`BedrockAgentCore.Client.exceptions.ServiceQuotaExceededException`

  
  *   :py:class:`BedrockAgentCore.Client.exceptions.AccessDeniedException`

  
  *   :py:class:`BedrockAgentCore.Client.exceptions.ConflictException`

  
  *   :py:class:`BedrockAgentCore.Client.exceptions.ValidationException`

  
  *   :py:class:`BedrockAgentCore.Client.exceptions.ResourceNotFoundException`

  
  *   :py:class:`BedrockAgentCore.Client.exceptions.ThrottlingException`

  
  *   :py:class:`BedrockAgentCore.Client.exceptions.InternalServerException`

  