start_experiment_run
async
¶
start_experiment_run(
experiment_id: ExperimentId,
evaluators: ExperimentEvaluatorList,
target: TargetConfig,
dataset: ExperimentRunDataset,
*,
config_overrides: Optional[AsyncCloudWatchOmniClientConfig] = None,
client_token: Optional[ClientToken] = None,
rule: Optional[ExperimentRule] = None,
control: Optional[ControlSource] = None,
metadata: Optional[RunMetadataMap] = None,
description: Optional[Description] = None,
) -> StartExperimentRunOutput
Starts a hosted run of an experiment. The service runs the dataset's cases against the given version of the experiment's target with an Amazon Bedrock AgentCore batch evaluation and scores them with the given evaluators. The run starts as RUNNING and ends as COMPLETED, or as DID_NOT_FINISH when it is stopped or fails. Use GetExperimentRun to check the run's progress. When the run has a rule, it gets a verdict when it ends. A target control starts a second, live control run alongside this one.
Parameters:
-
experiment_id(ExperimentId) –The ID of the experiment to start the run in.
-
client_token(Optional[ClientToken], default:None) –Idempotency token for safe retries. Repeated requests with the same token return the original run instead of starting another.
-
rule(Optional[ExperimentRule], default:None) –An optional rule. When present, the run gets a verdict when it ends.
-
evaluators(ExperimentEvaluatorList) –The evaluators to score the run with, from 1 to 10 for a hosted run. The run's rule can reference only these evaluators.
-
target(TargetConfig) –The version of the experiment's target to run. Hosted runs support only agentCoreRuntime.
-
dataset(ExperimentRunDataset) –The dataset to run, with source AGENTCORE, an id and a published version. Fails with FIELD_REQUIRED without a version, and the version cannot be DRAFT. Omit caseCount and contentHash.
-
control(Optional[ControlSource], default:None) –An optional control to compare the run with. A target control starts a second run on the same dataset alongside this one, which uses a second AgentCore batch evaluation and counts toward the experiment's run quota. Required by rules that use vsControl or paired metrics (RULE_CONTROL_REQUIRED).
-
metadata(Optional[RunMetadataMap], default:None) –Additional details about what the run tested, beyond the target and dataset versions.
-
description(Optional[Description], default:None) –An optional description of the run, up to 1024 characters with no control characters. Cannot be changed after the run starts.
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.
-
ResourceNotFoundException–The specified resource does not exist.
-
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:
Start a hosted run The following example starts a hosted run of an experiment against version 3 of an AgentCore dataset, scored with one evaluator and gated on a 90% pass rate. Payloads are shown as JSON; on the wire they are CBOR-encoded.
>>> await client.start_experiment_run(experiment_id='exp-01JD8K3M5N7P9Q2R4S6T8V0W1X', client_token='release-2026-11-10-hosted', evaluators=[{'evaluatorId': 'Builtin.Helpfulness', 'ratingScale': 'NUMERIC'}], rule={'source': 'INLINE', 'name': 'release-gate', 'caseCriteria': [{'evaluator': {'evaluatorId': 'Builtin.Helpfulness', 'threshold': {'minScore': 0.7}}}], 'gates': [{'metric': {'passRate': {}}, 'bound': {'min': 0.9}}]}, target={'agentCoreRuntime': {'endpointArn': 'arn:aws:bedrock-agentcore:us-east-1:123456789012:runtime/support_agent-a1B2c3D4e5/runtime-endpoint/production'}}, dataset={'source': 'AGENTCORE', 'id': 'support-faq-dataset', 'version': '3'}, metadata={'modelId': 'anthropic.claude-sonnet', 'promptVersion': 'v3'}, description='Release candidate with the v3 support prompt')
Source code in docs_src/capo_cloudwatchomni/_services/async_cloud_watch_omni.py
7303 7304 7305 7306 7307 7308 7309 7310 7311 7312 7313 7314 7315 7316 7317 7318 7319 7320 7321 7322 7323 7324 7325 7326 7327 7328 7329 7330 7331 7332 7333 7334 7335 7336 7337 7338 7339 7340 7341 7342 7343 7344 7345 7346 7347 7348 7349 7350 7351 7352 7353 7354 7355 7356 7357 7358 7359 7360 7361 7362 7363 7364 7365 7366 7367 7368 7369 7370 7371 7372 7373 7374 7375 7376 7377 7378 7379 7380 7381 7382 7383 7384 7385 7386 7387 7388 7389 7390 7391 7392 7393 7394 7395 7396 7397 7398 7399 7400 7401 7402 7403 7404 7405 7406 7407 7408 7409 7410 7411 7412 7413 7414 7415 7416 7417 7418 7419 7420 7421 7422 7423 7424 7425 7426 7427 7428 | |