create_ab_test
¶
create_ab_test(
name: ABTestName,
gateway_arn: GatewayArn,
variants: VariantList,
evaluation_config: ABTestEvaluationConfig,
role_arn: RoleArn,
*,
config_overrides: Optional[BedrockAgentCoreClientConfig] = None,
description: Optional[ABTestDescription] = None,
gateway_filter: Optional[GatewayFilter] = None,
enable_on_create: Optional[bool] = None,
client_token: Optional[ClientToken] = None,
tags: Optional[TagsMap] = None,
) -> CreateABTestResponse
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(ABTestName) –The name of the A/B test. Must be unique within your account.
-
description(Optional[ABTestDescription], default:None) –The description of the A/B test.
-
gateway_arn(GatewayArn) –The Amazon Resource Name (ARN) of the gateway to use for traffic splitting.
-
variants(VariantList) –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.
-
gateway_filter(Optional[GatewayFilter], default:None) –Optional filter to restrict which gateway target paths are included in the A/B test.
-
evaluation_config(ABTestEvaluationConfig) –The evaluation configuration specifying which online evaluation configurations to use for measuring variant performance.
-
role_arn(RoleArn) –The IAM role ARN that grants permissions for the A/B test to access gateway and evaluation resources.
-
enable_on_create(Optional[bool], default:None) –Whether to enable the A/B test immediately upon creation. If true, traffic splitting begins automatically.
-
client_token(Optional[ClientToken], default: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.
-
tags(Optional[TagsMap], default:None) –A map of tag keys and values to associate with the A/B test.
Raises:
-
AccessDeniedException–The exception that occurs when you do not have sufficient permissions to perform an action. Verify that your IAM policy includes the necessary permissions for the operation you are trying to perform.
-
ConflictException–The exception that occurs when the request conflicts with the current state of the resource. This can happen when trying to modify a resource that is currently being modified by another request, or when trying to create a resource that already exists.
-
InternalServerException–The exception that occurs when the service encounters an unexpected internal error. This is a temporary condition that will resolve itself with retries. We recommend implementing exponential backoff retry logic in your application.
-
ServiceQuotaExceededException–The exception that occurs when the request would cause a service quota to be exceeded. Review your service quotas and either reduce your request rate or request a quota increase.
-
ThrottlingException–The exception that occurs when the request was denied due to request throttling. This happens when you exceed the allowed request rate for an operation. Reduce the frequency of requests or implement exponential backoff retry logic in your application.
-
UnauthorizedException–This exception is thrown when the JWT bearer token is invalid or not found for OAuth bearer token based access
-
ValidationException–The exception that occurs when the input fails to satisfy the constraints specified by the service. Check the error message for details about which input parameter is invalid and correct your request.
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_bedrock_agentcore/_services/bedrock_agent_core.py
2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 | |