Skip to content

start_batch_evaluation

start_batch_evaluation(
    batch_evaluation_name: BatchEvaluationName,
    data_source_config: DataSourceConfig,
    *,
    config_overrides: Optional[BedrockAgentCoreClientConfig] = None,
    evaluators: Optional[EvaluatorList] = None,
    insights: Optional[InsightList] = None,
    client_token: Optional[ClientToken] = None,
    evaluation_metadata: Optional[EvaluationMetadata] = None,
    tags: Optional[TagsMap] = None,
    kms_key_arn: Optional[KmsKeyArn] = None,
    description: Optional[BatchEvaluationDescription] = None,
    output_config: Optional[OutputConfig] = None,
) -> StartBatchEvaluationResponse

Starts a batch evaluation job that evaluates agent performance across multiple sessions. Batch evaluations pull agent traces from CloudWatch Logs or an existing online evaluation configuration and run specified evaluators and insights against them.

Parameters:

  • batch_evaluation_name (BatchEvaluationName) –

    The name of the batch evaluation. Must be unique within your account.

  • evaluators (Optional[EvaluatorList], default: None ) –

    The list of evaluators to apply during the batch evaluation. Can include both built-in evaluators and custom evaluators. Maximum of 10 evaluators.

  • insights (Optional[InsightList], default: None ) –

    The list of insight analyses to run against sessions during the batch evaluation. Maximum of 10 insights.

  • data_source_config (DataSourceConfig) –

    The data source configuration that specifies where to pull agent session traces from for evaluation.

  • client_token (Optional[ClientToken], default: 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, the service ignores the request, but does not return an error.

  • evaluation_metadata (Optional[EvaluationMetadata], default: None ) –

    Optional metadata for the evaluation, including session-specific ground truth data and test scenario identifiers.

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

    A map of tag keys and values to associate with the batch evaluation.

  • kms_key_arn (Optional[KmsKeyArn], default: None ) –

    The ARN of the KMS key used to encrypt evaluation data. If provided, customer data is encrypted at rest with the specified key.

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

    The description of the batch evaluation.

Raises:

  • AccessDeniedException –

    The exception that occurs when you do not have sufficient permissions to perform an action. Verify that your IAM policy includes the necessary permissions for the operation you are trying to perform.

  • ConflictException –

    The exception that occurs when the request conflicts with the current state of the resource. This can happen when trying to modify a resource that is currently being modified by another request, or when trying to create a resource that already exists.

  • InternalServerException –

    The exception that occurs when the service encounters an unexpected internal error. This is a temporary condition that will resolve itself with retries. We recommend implementing exponential backoff retry logic in your application.

  • ServiceQuotaExceededException –

    The exception that occurs when the request would cause a service quota to be exceeded. Review your service quotas and either reduce your request rate or request a quota increase.

  • ThrottlingException –

    The exception that occurs when the request was denied due to request throttling. This happens when you exceed the allowed request rate for an operation. Reduce the frequency of requests or implement exponential backoff retry logic in your application.

  • UnauthorizedException –

    This exception is thrown when the JWT bearer token is invalid or not found for OAuth bearer token based access

  • ValidationException –

    The exception that occurs when the input fails to satisfy the constraints specified by the service. Check the error message for details about which input parameter is invalid and correct your request.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_bedrock_agentcore/_services/bedrock_agent_core.py
def start_batch_evaluation(
    self,
    batch_evaluation_name: "capo_bedrock_agentcore.types.batch_evaluation_name.BatchEvaluationName",
    data_source_config: "capo_bedrock_agentcore.types.data_source_config.DataSourceConfig",
    *,
    config_overrides: Optional[BedrockAgentCoreClientConfig] = None,
    evaluators: Optional[
        "capo_bedrock_agentcore.types.evaluator_list.EvaluatorList"
    ] = None,
    insights: Optional[
        "capo_bedrock_agentcore.types.insight_list.InsightList"
    ] = None,
    client_token: Optional[
        "capo_bedrock_agentcore.types.client_token.ClientToken"
    ] = None,
    evaluation_metadata: Optional[
        "capo_bedrock_agentcore.types.evaluation_metadata.EvaluationMetadata"
    ] = None,
    tags: Optional["capo_bedrock_agentcore.types.tags_map.TagsMap"] = None,
    kms_key_arn: Optional[
        "capo_bedrock_agentcore.types.kms_key_arn.KmsKeyArn"
    ] = None,
    description: Optional[
        "capo_bedrock_agentcore.types.batch_evaluation_description.BatchEvaluationDescription"
    ] = None,
    output_config: Optional[
        "capo_bedrock_agentcore.types.output_config.OutputConfig"
    ] = None,
) -> "capo_bedrock_agentcore.types.start_batch_evaluation_response.StartBatchEvaluationResponse":
    """<p>Starts a batch evaluation job that evaluates agent performance across multiple sessions. Batch evaluations pull agent traces from CloudWatch Logs or an existing online evaluation configuration and run specified evaluators and insights against them.</p>

    Args:
        batch_evaluation_name: <p>The name of the batch evaluation. Must be unique within your account.</p>
        evaluators: <p>The list of evaluators to apply during the batch evaluation. Can include both built-in evaluators and custom evaluators. Maximum of 10 evaluators.</p>
        insights: <p>The list of insight analyses to run against sessions during the batch evaluation. Maximum of 10 insights.</p>
        data_source_config: <p>The data source configuration that specifies where to pull agent session traces from for evaluation.</p>
        client_token: <p>A unique, case-sensitive identifier to ensure that the API request completes no more than one time. If this token matches a previous request, the service ignores the request, but does not return an error.</p>
        evaluation_metadata: <p>Optional metadata for the evaluation, including session-specific ground truth data and test scenario identifiers.</p>
        tags: <p>A map of tag keys and values to associate with the batch evaluation.</p>
        kms_key_arn: <p>The ARN of the KMS key used to encrypt evaluation data. If provided, customer data is encrypted at rest with the specified key.</p>
        description: <p>The description of the batch evaluation.</p>

    Raises:
        capo_bedrock_agentcore.errors.access_denied_exception.AccessDeniedException: <p>The exception that occurs when you do not have sufficient permissions to perform an action. Verify that your IAM policy includes the necessary permissions for the operation you are trying to perform.</p>
        capo_bedrock_agentcore.errors.conflict_exception.ConflictException: <p>The exception that occurs when the request conflicts with the current state of the resource. This can happen when trying to modify a resource that is currently being modified by another request, or when trying to create a resource that already exists.</p>
        capo_bedrock_agentcore.errors.internal_server_exception.InternalServerException: <p>The exception that occurs when the service encounters an unexpected internal error. This is a temporary condition that will resolve itself with retries. We recommend implementing exponential backoff retry logic in your application.</p>
        capo_bedrock_agentcore.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The exception that occurs when the request would cause a service quota to be exceeded. Review your service quotas and either reduce your request rate or request a quota increase.</p>
        capo_bedrock_agentcore.errors.throttling_exception.ThrottlingException: <p>The exception that occurs when the request was denied due to request throttling. This happens when you exceed the allowed request rate for an operation. Reduce the frequency of requests or implement exponential backoff retry logic in your application.</p>
        capo_bedrock_agentcore.errors.unauthorized_exception.UnauthorizedException: <p>This exception is thrown when the JWT bearer token is invalid or not found for OAuth bearer token based access</p>
        capo_bedrock_agentcore.errors.validation_exception.ValidationException: <p>The exception that occurs when the input fails to satisfy the constraints specified by the service. Check the error message for details about which input parameter is invalid and correct your request.</p>
        capo_bedrock_agentcore.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_bedrock_agentcore.types.start_batch_evaluation_request.StartBatchEvaluationRequest]",
    ) -> OperationResponse[
        "capo_bedrock_agentcore.types.start_batch_evaluation_response.StartBatchEvaluationResponse"
    ]:
        import capo_bedrock_agentcore._operations.amazon_bedrock_agent_core.start_batch_evaluation

        output, http_response = (
            capo_bedrock_agentcore._operations.amazon_bedrock_agent_core.start_batch_evaluation.start_batch_evaluation(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("StartBatchEvaluation")
    )
    input_: capo_bedrock_agentcore.types.start_batch_evaluation_request.StartBatchEvaluationRequest = {
        "batch_evaluation_name": batch_evaluation_name,
        "data_source_config": data_source_config,
    }
    if evaluators is not None:
        input_["evaluators"] = evaluators
    if insights is not None:
        input_["insights"] = insights
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if evaluation_metadata is not None:
        input_["evaluation_metadata"] = evaluation_metadata
    if tags is not None:
        input_["tags"] = tags
    if kms_key_arn is not None:
        input_["kms_key_arn"] = kms_key_arn
    if description is not None:
        input_["description"] = description
    if output_config is not None:
        input_["output_config"] = output_config

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output