Skip to content

create_code_interpreter async

create_code_interpreter(
    name: SandboxName,
    network_configuration: CodeInterpreterNetworkConfiguration,
    *,
    config_overrides: Optional[AsyncBedrockAgentCoreControlClientConfig] = None,
    description: Optional[Description] = None,
    execution_role_arn: Optional[RoleArn] = None,
    certificates: Optional[Certificates] = None,
    filesystem_configurations: Optional[ToolsFileSystemConfigurations] = None,
    client_token: Optional[ClientToken] = None,
    tags: Optional[TagsMap] = None,
) -> CreateCodeInterpreterResponse

Creates a custom code interpreter.

Parameters:

  • name (SandboxName) –

    The name of the code interpreter. The name must be unique within your account.

  • description (Optional[Description], default: None ) –

    The description of the code interpreter.

  • execution_role_arn (Optional[RoleArn], default: None ) –

    The Amazon Resource Name (ARN) of the IAM role that provides permissions for the code interpreter to access Amazon Web Services services.

  • network_configuration (CodeInterpreterNetworkConfiguration) –

    The network configuration for the code interpreter. This configuration specifies the network mode for the code interpreter.

  • certificates (Optional[Certificates], default: None ) –

    A list of certificates to install in the code interpreter.

  • filesystem_configurations (Optional[ToolsFileSystemConfigurations], default: None ) –

    The file system configurations to mount into the code interpreter. Use these configurations to mount your own Amazon Simple Storage Service (Amazon S3) Files or Amazon Elastic File System (Amazon EFS) access points. Your sessions can then access your data. If you don't specify this field, no file systems are mounted.

  • client_token (Optional[ClientToken], default: None ) –

    A unique, case-sensitive identifier to ensure that the operation 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.

  • tags (Optional[TagsMap], default: None ) –

    A map of tag keys and values to assign to the code interpreter. Tags enable you to categorize your resources in different ways, for example, by purpose, owner, or environment.

Raises:

Source code in docs_src/capo_bedrock_agentcore_control/_services/async_bedrock_agent_core_control.py
async def create_code_interpreter(
    self,
    name: "capo_bedrock_agentcore_control.types.sandbox_name.SandboxName",
    network_configuration: "capo_bedrock_agentcore_control.types.code_interpreter_network_configuration.CodeInterpreterNetworkConfiguration",
    *,
    config_overrides: Optional[AsyncBedrockAgentCoreControlClientConfig] = None,
    description: Optional[
        "capo_bedrock_agentcore_control.types.description.Description"
    ] = None,
    execution_role_arn: Optional[
        "capo_bedrock_agentcore_control.types.role_arn.RoleArn"
    ] = None,
    certificates: Optional[
        "capo_bedrock_agentcore_control.types.certificates.Certificates"
    ] = None,
    filesystem_configurations: Optional[
        "capo_bedrock_agentcore_control.types.tools_file_system_configurations.ToolsFileSystemConfigurations"
    ] = None,
    client_token: Optional[
        "capo_bedrock_agentcore_control.types.client_token.ClientToken"
    ] = None,
    tags: Optional["capo_bedrock_agentcore_control.types.tags_map.TagsMap"] = None,
) -> "capo_bedrock_agentcore_control.types.create_code_interpreter_response.CreateCodeInterpreterResponse":
    """<p>Creates a custom code interpreter.</p>

    Args:
        name: <p>The name of the code interpreter. The name must be unique within your account.</p>
        description: <p>The description of the code interpreter.</p>
        execution_role_arn: <p>The Amazon Resource Name (ARN) of the IAM role that provides permissions for the code interpreter to access Amazon Web Services services.</p>
        network_configuration: <p>The network configuration for the code interpreter. This configuration specifies the network mode for the code interpreter.</p>
        certificates: <p>A list of certificates to install in the code interpreter.</p>
        filesystem_configurations: <p>The file system configurations to mount into the code interpreter. Use these configurations to mount your own Amazon Simple Storage Service (Amazon S3) Files or Amazon Elastic File System (Amazon EFS) access points. Your sessions can then access your data. If you don't specify this field, no file systems are mounted.</p>
        client_token: <p>A unique, case-sensitive identifier to ensure that the operation 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.</p>
        tags: <p>A map of tag keys and values to assign to the code interpreter. Tags enable you to categorize your resources in different ways, for example, by purpose, owner, or environment.</p>

    Raises:
        capo_bedrock_agentcore_control.errors.access_denied_exception.AccessDeniedException: <p>This exception is thrown when a request is denied per access permissions</p>
        capo_bedrock_agentcore_control.errors.conflict_exception.ConflictException: <p>This exception is thrown when there is a conflict performing an operation</p>
        capo_bedrock_agentcore_control.errors.internal_server_exception.InternalServerException: <p>This exception is thrown if there was an unexpected error during processing of request</p>
        capo_bedrock_agentcore_control.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>This exception is thrown when a request is made beyond the service quota</p>
        capo_bedrock_agentcore_control.errors.throttling_exception.ThrottlingException: <p>This exception is thrown when the number of requests exceeds the limit</p>
        capo_bedrock_agentcore_control.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints specified by the service.</p>
        capo_bedrock_agentcore_control.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_bedrock_agentcore_control.types.create_code_interpreter_request.CreateCodeInterpreterRequest]",
    ) -> AsyncOperationResponse[
        "capo_bedrock_agentcore_control.types.create_code_interpreter_response.CreateCodeInterpreterResponse"
    ]:
        import capo_bedrock_agentcore_control._operations.amazon_bedrock_agent_core_control.create_code_interpreter

        (
            output,
            http_response,
        ) = await capo_bedrock_agentcore_control._operations.amazon_bedrock_agent_core_control.create_code_interpreter.async_create_code_interpreter(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_bedrock_agentcore_control.types.create_code_interpreter_request.CreateCodeInterpreterRequest",
    ) -> dict[str, Any]:
        import capo_bedrock_agentcore_control.types.create_code_interpreter_request

        return capo_bedrock_agentcore_control.types.create_code_interpreter_request.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("CreateCodeInterpreter", redact_input=_redact_input),
    )
    input_: capo_bedrock_agentcore_control.types.create_code_interpreter_request.CreateCodeInterpreterRequest = {
        "name": name,
        "network_configuration": network_configuration,
    }
    if description is not None:
        input_["description"] = description
    if execution_role_arn is not None:
        input_["execution_role_arn"] = execution_role_arn
    if certificates is not None:
        input_["certificates"] = certificates
    if filesystem_configurations is not None:
        input_["filesystem_configurations"] = filesystem_configurations
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if tags is not None:
        input_["tags"] = tags

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output