create_experiment
async
¶
create_experiment(
target: ExperimentTarget,
experiment_type: ExperimentType,
experiment_config: ExperimentConfig,
*,
config_overrides: Optional[AsyncCloudWatchOmniClientConfig] = 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.
>>> await 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/async_cloud_watch_omni.py
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 6490 6491 6492 6493 6494 6495 6496 6497 6498 6499 6500 6501 6502 6503 6504 6505 6506 6507 6508 6509 6510 6511 6512 6513 6514 6515 6516 6517 6518 6519 6520 6521 6522 6523 6524 6525 6526 6527 6528 6529 6530 6531 6532 6533 6534 6535 6536 6537 6538 6539 6540 6541 6542 6543 6544 6545 6546 6547 6548 6549 6550 6551 6552 6553 6554 6555 6556 6557 6558 6559 6560 6561 6562 6563 6564 6565 6566 6567 6568 | |