Skip to content

BedrockAgentCoreClient.create_ab_test

rboto-bedrock-agentcore==0.4.0 · Service index · Types

Model summary (excerpt): 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.

Install and imports

python -m pip install "rboto[bedrock-agentcore]==0.4.0"
from rboto import BedrockAgentCoreClient
from collections.abc import Sequence
from rboto_bedrock_agentcore.types import (
    ABTestEvaluationConfig,
    CreateABTestOutput,
    GatewayFilter,
    Variant,
)

Signature

async def create_ab_test(
    *,
    name: str,
    gateway_arn: str,
    variants: Sequence[Variant],
    evaluation_config: ABTestEvaluationConfig,
    role_arn: str,
    description: str | None = None,
    gateway_filter: GatewayFilter | None = None,
    enable_on_create: bool | None = None,
    client_token: str | None = None,
    tags: dict[str, str] | None = None,
) -> CreateABTestOutput: ...

Arguments without defaults are required. None omits an optional request argument. Static types do not validate resource existence, permissions, lengths, ranges, or conditional service requirements.

Arguments

Argument Required Model notes (excerpt)
name Yes The name of the A/B test. Must be unique within your account.
gateway_arn Yes The Amazon Resource Name (ARN) of the gateway to use for traffic splitting.
variants Yes 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.
evaluation_config Yes The evaluation configuration specifying which online evaluation configurations to use for measuring variant performance.
role_arn Yes The IAM role ARN that grants permissions for the A/B test to access gateway and evaluation resources.
description No The description of the A/B test.
gateway_filter No Optional filter to restrict which gateway target paths are included in the A/B test.
enable_on_create No Whether to enable the A/B test immediately upon creation. If true, traffic splitting begins automatically.
client_token No 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.
tags No A map of tag keys and values to associate with the A/B test.

Output

CreateABTestOutput.

Read-only native attributes, accessed as response.field. Collection getters materialize Python values; to_dict() recursively materializes a mapping. Streams are consumed once.

Field Type Presence References
ab_test_id str Always present —
ab_test_arn str Always present —
name str | None Always present —
status ABTestStatusOutput Always present ABTestStatusOutput
execution_status ABTestExecutionStatusOutput Always present ABTestExecutionStatusOutput
created_at str Always present —

| None means a value can be absent. Output mappings include every declared key; optional input keys may be omitted. Unknown output enum/union variants are not automatically valid inputs.

ABTestEvaluationConfig, CreateABTestOutput, GatewayFilter, Variant

Follow these links for nested inputs and outputs; recursive types link back to the same type page.

Pagination and streaming

No generated paginator for this operation.

No output stream.

Errors

Import from rboto_bedrock_agentcore.exceptions:

AccessDeniedError, ConflictError, InternalServerError, ServiceQuotaExceededError, ThrottlingError, UnauthorizedError, ValidationError.

Other service failures use the service base error; credential, transport and timeout failures use shared errors.

Service guide · Pinned model