---
title: "POST /ab-tests"
method: POST
path: "/ab-tests"
---

# POST /ab-tests

`POST /ab-tests`

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.

## Request body

- object
  - `name` string, required — The name of the A/B test. Must be unique within your account.
  - `description` string — The description of the A/B test.
  - `gatewayArn` string, required — The Amazon Resource Name (ARN) of the gateway to use for traffic splitting.
  - `variants` Variant[], required — 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.
    - `name` string, required — The name of the variant. Must be <code>C</code> for control or <code>T1</code> for treatment.
    - `weight` integer, required — The percentage of traffic to route to this variant. Weights across all variants must sum to 100.
    - `variantConfiguration` object, required — The configuration for this variant, including the configuration bundle or target reference.
      - `configurationBundle` object — A reference to a configuration bundle version to use for this variant.
        - `bundleArn` string, required — The Amazon Resource Name (ARN) of the configuration bundle.
        - `bundleVersion` string, required — The version of the configuration bundle.
      - `target` object — A reference to a gateway target to route traffic to for this variant.
        - `name` string, required — The name of the gateway target.
  - `gatewayFilter` object — A filter to restrict which gateway target paths are included in the A/B test.
    - `targetPaths` PathPattern[] — A list of target path patterns to include in the A/B test.
  - `evaluationConfig` object, required — The evaluation configuration for an A/B test, specifying which online evaluation configurations to use for measuring variant performance.
    - `onlineEvaluationConfigArn` string — The Amazon Resource Name (ARN) of a single online evaluation configuration to use for both variants.
    - `perVariantOnlineEvaluationConfig` PerVariantOnlineEvaluationConfig[] — Per-variant online evaluation configurations, allowing different evaluation settings for each variant.
      - `name` string, required — The name of the variant this evaluation configuration applies to.
      - `onlineEvaluationConfigArn` string, required — The Amazon Resource Name (ARN) of the online evaluation configuration for this variant.
  - `roleArn` string, required — The IAM role ARN that grants permissions for the A/B test to access gateway and evaluation resources.
  - `enableOnCreate` boolean — Whether to enable the A/B test immediately upon creation. If true, traffic splitting begins automatically.
  - `clientToken` string — 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` object — A map of tag keys and values to associate with the A/B test.

## Response `202`

Success

- CreateABTestResponse
  - `abTestId` string, required — The unique identifier of the created A/B test.
  - `abTestArn` string, required — The Amazon Resource Name (ARN) of the created A/B test.
  - `name` string — The name of the A/B test.
  - `status` 'CREATING' | 'ACTIVE' | 'CREATE_FAILED' | 'UPDATING' | 'UPDATE_FAILED' | 'DELETING' | 'DELETE_FAILED' | 'FAILED', required — The status of the A/B test.
  - `executionStatus` 'PAUSED' | 'RUNNING' | 'STOPPED' | 'NOT_STARTED', required — The execution status indicating whether the A/B test is currently running.
  - `createdAt` string, date-time, required — The timestamp when the A/B test was created.

## Other responses

- `480` — ServiceQuotaExceededException
- `481` — UnauthorizedException
- `482` — ValidationException
- `483` — AccessDeniedException
- `484` — ConflictException
- `485` — ThrottlingException
- `486` — InternalServerException

---

[API](https://skmtc.net/aws/apis/bedrock-agentcore.md) · [All operations](https://skmtc.net/aws/apis/bedrock-agentcore/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/aws/bedrock-agentcore/versions/79623b33d495/schema)
