create_experiment
¶
create_experiment(
target: ExperimentTarget,
experiment_type: ExperimentType,
experiment_config: ExperimentConfig,
*,
config_overrides: Optional[CloudWatchOmniClientConfig] = None,
client_token: Optional[ClientToken] = None,
name: Optional[ExperimentName] = None,
description: Optional[Description] = None,
tags: Optional[TagMap] = None,
) -> CreateExperimentOutput
Creates an experiment. An experiment defines the target its runs are tested against and the configuration for its type; each run specifies the dataset it tests and the evaluators it is scored with. The name, description, and configuration can be changed later, but the target and type cannot. Use GetExperiment to retrieve the experiment, ListExperiments to enumerate experiments, UpdateExperiment to modify it, and DeleteExperiment to remove it.
Parameters:
-
client_token(Optional[ClientToken], default:None) –Idempotency token for safe retries. Repeated requests with the same token return the original result instead of creating a second experiment.
-
name(Optional[ExperimentName], default:None) –The name of the experiment.
-
description(Optional[Description], default:None) –An optional description of the experiment. Up to 1,024 characters, with no control characters.
-
target(ExperimentTarget) –The target that the experiment tests, including its service name, environment, and definition. Cannot be changed after the experiment is created.
-
experiment_type(ExperimentType) –The type of the experiment. Cannot be changed after the experiment is created.
-
experiment_config(ExperimentConfig) –The configuration for the experiment's type. Its member must match experimentType: a DATASET experiment takes experimentConfig.dataset. The caller must have iam:PassRole on the execution role, the role must be assumable, and the results log group must exist and use the Standard log class.
-
tags(Optional[TagMap], default:None) –The tags to associate with the experiment. Tag keys that begin with the reserved
aws:prefix are rejected with a ValidationException.
Raises:
-
AccessDeniedException–The caller is not authorized to perform this action.
-
ConflictException–The operation could not be completed because of a conflict with the current state of the resource.
-
InternalServerException–An unexpected error occurred while processing the request.
-
ServiceQuotaExceededException–A service quota was exceeded.
-
ThrottlingException–The request was throttled due to exceeding the allowed request rate.
-
ValidationException–A parameter is specified incorrectly.
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
Create a DATASET experiment for an AgentCore Runtime agent The following example creates a DATASET experiment that tests an AgentCore Runtime agent. Its runs write their records to the results log group using the execution role. Payloads are shown as JSON; on the wire they are CBOR-encoded.
>>> client.create_experiment(client_token='3f1b2c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d', name='Travel agent regression suite', description='Checks booking accuracy before each release.', target={'name': 'Travel agent', 'serviceName': 'travel-agent', 'environment': 'staging', 'definition': {'agentCoreRuntime': {'runtimeArn': 'arn:aws:bedrock-agentcore:us-east-1:123456789012:runtime/travel_agent-a1B2c3D4e5'}}}, experiment_type='DATASET', experiment_config={'dataset': {'executionRoleArn': 'arn:aws:iam::123456789012:role/ExperimentExecutionRole', 'resultsLogGroup': '/experiments/travel-agent/results'}}, tags={'team': 'travel'})
Source code in docs_src/capo_cloudwatchomni/_services/cloud_watch_omni.py
6383 6384 6385 6386 6387 6388 6389 6390 6391 6392 6393 6394 6395 6396 6397 6398 6399 6400 6401 6402 6403 6404 6405 6406 6407 6408 6409 6410 6411 6412 6413 6414 6415 6416 6417 6418 6419 6420 6421 6422 6423 6424 6425 6426 6427 6428 6429 6430 6431 6432 6433 6434 6435 6436 6437 6438 6439 6440 6441 6442 6443 6444 6445 6446 6447 6448 6449 6450 6451 6452 6453 6454 6455 6456 6457 6458 6459 6460 6461 6462 6463 6464 6465 6466 6467 6468 6469 6470 6471 6472 6473 6474 6475 6476 6477 6478 6479 6480 6481 6482 6483 6484 6485 6486 6487 6488 6489 | |