Skip to content

create_online_evaluation_config async

create_online_evaluation_config(
    online_evaluation_config_name: EvaluationConfigName,
    rule: Rule,
    data_source_config: DataSourceConfig,
    evaluation_execution_role_arn: RoleArn,
    enable_on_create: bool,
    *,
    config_overrides: Optional[AsyncBedrockAgentCoreControlClientConfig] = None,
    client_token: Optional[ClientToken] = None,
    description: Optional[EvaluationConfigDescription] = None,
    evaluators: Optional[EvaluatorList] = None,
    insights: Optional[InsightList] = None,
    clustering_config: Optional[ClusteringConfig] = None,
    output_config: Optional[OutputConfig] = None,
    tags: Optional[TagsMap] = None,
) -> CreateOnlineEvaluationConfigResponse

Creates an online evaluation configuration for continuous monitoring of agent performance. Online evaluation automatically samples live traffic from CloudWatch logs at specified rates and applies evaluators to assess agent quality in production.

Parameters:

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

    A unique, case-sensitive identifier to ensure that the API request completes no more than one time. If you don't specify this field, a value is randomly generated for you. If this token matches a previous request, the service ignores the request, but doesn't return an error. For more information, see Ensuring idempotency.

  • online_evaluation_config_name (EvaluationConfigName) –

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

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

    The description of the online evaluation configuration that explains its monitoring purpose and scope.

  • rule (Rule) –

    The evaluation rule that defines sampling configuration, filters, and session detection settings for the online evaluation.

  • data_source_config (DataSourceConfig) –

    The data source configuration that specifies CloudWatch log groups and service names to monitor for agent traces.

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

    The list of evaluators to apply during online evaluation. Can include both built-in evaluators and custom evaluators created with CreateEvaluator.

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

    The list of insight types to run against agent sessions.

  • clustering_config (Optional[ClusteringConfig], default: None ) –

    Configuration for periodic batch evaluation clustering of insight results.

  • evaluation_execution_role_arn (RoleArn) –

    The Amazon Resource Name (ARN) of the IAM role that grants permissions to read from CloudWatch logs, write evaluation results, and invoke Amazon Bedrock models for evaluation. If the configuration references evaluators encrypted with a customer managed KMS key, this role must also have kms:Decrypt permission on the KMS key. The service validates this permission at configuration creation time. For more information, see Encryption at rest for AgentCore Evaluations.

  • enable_on_create (bool) –

    Whether to enable the online evaluation configuration immediately upon creation. If true, evaluation begins automatically.

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

    A map of tag keys and values to assign to an AgentCore Online Evaluation Config. 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_online_evaluation_config(
    self,
    online_evaluation_config_name: "capo_bedrock_agentcore_control.types.evaluation_config_name.EvaluationConfigName",
    rule: "capo_bedrock_agentcore_control.types.rule.Rule",
    data_source_config: "capo_bedrock_agentcore_control.types.data_source_config.DataSourceConfig",
    evaluation_execution_role_arn: "capo_bedrock_agentcore_control.types.role_arn.RoleArn",
    enable_on_create: bool,
    *,
    config_overrides: Optional[AsyncBedrockAgentCoreControlClientConfig] = None,
    client_token: Optional[
        "capo_bedrock_agentcore_control.types.client_token.ClientToken"
    ] = None,
    description: Optional[
        "capo_bedrock_agentcore_control.types.evaluation_config_description.EvaluationConfigDescription"
    ] = None,
    evaluators: Optional[
        "capo_bedrock_agentcore_control.types.evaluator_list.EvaluatorList"
    ] = None,
    insights: Optional[
        "capo_bedrock_agentcore_control.types.insight_list.InsightList"
    ] = None,
    clustering_config: Optional[
        "capo_bedrock_agentcore_control.types.clustering_config.ClusteringConfig"
    ] = None,
    output_config: Optional[
        "capo_bedrock_agentcore_control.types.output_config.OutputConfig"
    ] = None,
    tags: Optional["capo_bedrock_agentcore_control.types.tags_map.TagsMap"] = None,
) -> "capo_bedrock_agentcore_control.types.create_online_evaluation_config_response.CreateOnlineEvaluationConfigResponse":
    """<p> Creates an online evaluation configuration for continuous monitoring of agent performance. Online evaluation automatically samples live traffic from CloudWatch logs at specified rates and applies evaluators to assess agent quality in production. </p>

    Args:
        client_token: <p>A unique, case-sensitive identifier to ensure that the API request completes no more than one time. If you don't specify this field, a value is randomly generated for you. If this token matches a previous request, the service ignores the request, but doesn't return an error. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html">Ensuring idempotency</a>.</p>
        online_evaluation_config_name: <p> The name of the online evaluation configuration. Must be unique within your account. </p>
        description: <p> The description of the online evaluation configuration that explains its monitoring purpose and scope. </p>
        rule: <p> The evaluation rule that defines sampling configuration, filters, and session detection settings for the online evaluation. </p>
        data_source_config: <p> The data source configuration that specifies CloudWatch log groups and service names to monitor for agent traces. </p>
        evaluators: <p> The list of evaluators to apply during online evaluation. Can include both built-in evaluators and custom evaluators created with <code>CreateEvaluator</code>. </p>
        insights: <p>The list of insight types to run against agent sessions.</p>
        clustering_config: <p>Configuration for periodic batch evaluation clustering of insight results.</p>
        evaluation_execution_role_arn: <p> The Amazon Resource Name (ARN) of the IAM role that grants permissions to read from CloudWatch logs, write evaluation results, and invoke Amazon Bedrock models for evaluation. If the configuration references evaluators encrypted with a customer managed KMS key, this role must also have <code>kms:Decrypt</code> permission on the KMS key. The service validates this permission at configuration creation time. For more information, see <a href="https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/evaluations-encryption.html">Encryption at rest for AgentCore Evaluations</a>. </p>
        enable_on_create: <p> Whether to enable the online evaluation configuration immediately upon creation. If true, evaluation begins automatically. </p>
        tags: <p>A map of tag keys and values to assign to an AgentCore Online Evaluation Config. 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_online_evaluation_config_request.CreateOnlineEvaluationConfigRequest]",
    ) -> AsyncOperationResponse[
        "capo_bedrock_agentcore_control.types.create_online_evaluation_config_response.CreateOnlineEvaluationConfigResponse"
    ]:
        import capo_bedrock_agentcore_control._operations.amazon_bedrock_agent_core_control.create_online_evaluation_config

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

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

        return capo_bedrock_agentcore_control.types.create_online_evaluation_config_request.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "CreateOnlineEvaluationConfig", redact_input=_redact_input
        ),
    )
    input_: capo_bedrock_agentcore_control.types.create_online_evaluation_config_request.CreateOnlineEvaluationConfigRequest = {
        "online_evaluation_config_name": online_evaluation_config_name,
        "rule": rule,
        "data_source_config": data_source_config,
        "evaluation_execution_role_arn": evaluation_execution_role_arn,
        "enable_on_create": enable_on_create,
    }
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if description is not None:
        input_["description"] = description
    if evaluators is not None:
        input_["evaluators"] = evaluators
    if insights is not None:
        input_["insights"] = insights
    if clustering_config is not None:
        input_["clustering_config"] = clustering_config
    if output_config is not None:
        input_["output_config"] = output_config
    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