Skip to content

create_ab_test

Operation

create_ab_test

create_ab_test(request: CreateABTestInput | CreateABTestInputDict | None = None, /, *, plugins: list[Plugin] | None = None, **kwargs: Unpack[CreateABTestInputDict]) -> 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
request CreateABTestInput | CreateABTestInputDict | None

The input as a model or dictionary. Pass this or keyword arguments, not both.

None
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
**kwargs Unpack[CreateABTestInputDict]

The input fields as keyword arguments.

{}

Returns:

Type Description
CreateABTestOutput

An instance of CreateABTestOutput.

create_ab_test async

create_ab_test(request: CreateABTestInput | CreateABTestInputDict | None = None, /, *, plugins: list[Plugin] | None = None, **kwargs: Unpack[CreateABTestInputDict]) -> 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
request CreateABTestInput | CreateABTestInputDict | None

The input as a model or dictionary. Pass this or keyword arguments, not both.

None
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
**kwargs Unpack[CreateABTestInputDict]

The input fields as keyword arguments.

{}

Returns:

Type Description
CreateABTestOutput

An instance of CreateABTestOutput.

Input

Pass the input as keyword arguments, a positional dictionary, or a positional model object. Pass plugins separately as a keyword argument.

CreateABTestInputDict

Bases: TypedDict

Dictionary form of CreateABTestInput.

Attributes

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

This field is autopopulated if not provided.

description instance-attribute
description: str | None

The description of the A/B test.

enable_on_create instance-attribute
enable_on_create: bool | None

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

evaluation_config instance-attribute

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

gateway_arn instance-attribute
gateway_arn: Required[str]

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

gateway_filter instance-attribute
gateway_filter: GatewayFilter | GatewayFilterDict | None

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

name instance-attribute
name: Required[str]

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

role_arn instance-attribute
role_arn: Required[str]

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

tags instance-attribute
tags: Mapping[str, str] | None

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

variants instance-attribute

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.

CreateABTestInput dataclass

Bases: _SerdeShape

Dataclass for CreateABTestInput structure.

Attributes

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

This field is autopopulated if not provided.

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

The description of the A/B test.

enable_on_create class-attribute instance-attribute
enable_on_create: bool | 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 = ...

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

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

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

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

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

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

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

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

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

variants class-attribute instance-attribute
variants: list[Variant] | 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

Bases: _SerdeShape

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

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

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

The name of the A/B test.

response_metadata class-attribute instance-attribute
response_metadata: ResponseMetadata = ...

Metadata about the response that produced this output. Use this to recover the request identifiers a service's support team needs in order to investigate a call. Members of the metadata are individually optional.

status instance-attribute
status: str

The status of the A/B test.