Skip to content

Bedrock Agentcore  >  Operations  >  create_ab_test

create_ab_test

Operation

create_ab_test async

create_ab_test(input: CreateABTestInput, plugins: list[Plugin] | None = None) -> CreateABTestOutput

Creates an A/B test for comparing agent configurations. A/B tests split traffic between a control variant and a treatment variant through a gateway, then evaluate performance using online evaluation configurations to determine which variant performs better.

Parameters:

Name Type Description Default
input CreateABTestInput

An instance of CreateABTestInput.

required
plugins list[Plugin] | None

A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations.

None

Returns:

Type Description
CreateABTestOutput

An instance of CreateABTestOutput.

Input

CreateABTestInput dataclass

Dataclass for CreateABTestInput structure.

Attributes

client_token class-attribute instance-attribute
client_token: str | None = 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.

description class-attribute instance-attribute
description: str | None = None

The description of the A/B test.

enable_on_create class-attribute instance-attribute
enable_on_create: bool | None = None

Whether to enable the A/B test immediately upon creation. If true, traffic splitting begins automatically.

evaluation_config class-attribute instance-attribute
evaluation_config: ABTestEvaluationConfig | None = None

The evaluation configuration specifying which online evaluation configurations to use for measuring variant performance.

gateway_arn class-attribute instance-attribute
gateway_arn: str | None = None

The Amazon Resource Name (ARN) of the gateway to use for traffic splitting.

gateway_filter class-attribute instance-attribute
gateway_filter: GatewayFilter | None = None

Optional filter to restrict which gateway target paths are included in the A/B test.

name class-attribute instance-attribute
name: str | None = None

The name of the A/B test. Must be unique within your account.

role_arn class-attribute instance-attribute
role_arn: str | None = None

The IAM role ARN that grants permissions for the A/B test to access gateway and evaluation resources.

tags class-attribute instance-attribute
tags: dict[str, str] | None = None

A map of tag keys and values to associate with the A/B test.

variants class-attribute instance-attribute
variants: list[Variant] | None = None

The list of variants for the A/B test. Must contain exactly two variants: a control (C) and a treatment (T1), each with a configuration bundle or target reference and a traffic weight.

Output

CreateABTestOutput dataclass

Dataclass for CreateABTestOutput structure.

Attributes

ab_test_arn instance-attribute
ab_test_arn: str

The Amazon Resource Name (ARN) of the created A/B test.

ab_test_id instance-attribute
ab_test_id: str

The unique identifier of the created A/B test.

created_at instance-attribute
created_at: datetime

The timestamp when the A/B test was created.

execution_status instance-attribute
execution_status: ABTestExecutionStatus

The execution status indicating whether the A/B test is currently running.

name class-attribute instance-attribute
name: str | None = None

The name of the A/B test.

status instance-attribute
status: ABTestStatus

The status of the A/B test.