start_experiment_run
¶
start_experiment_run(
experiment_id: ExperimentId,
evaluators: ExperimentEvaluatorList,
target: TargetConfig,
dataset: ExperimentRunDataset,
*,
config_overrides: Optional[CloudWatchOmniClientConfig] = 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.
>>> 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/cloud_watch_omni.py
7213 7214 7215 7216 7217 7218 7219 7220 7221 7222 7223 7224 7225 7226 7227 7228 7229 7230 7231 7232 7233 7234 7235 7236 7237 7238 7239 7240 7241 7242 7243 7244 7245 7246 7247 7248 7249 7250 7251 7252 7253 7254 7255 7256 7257 7258 7259 7260 7261 7262 7263 7264 7265 7266 7267 7268 7269 7270 7271 7272 7273 7274 7275 7276 7277 7278 7279 7280 7281 7282 7283 7284 7285 7286 7287 7288 7289 7290 7291 7292 7293 7294 7295 7296 7297 7298 7299 7300 7301 7302 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 | |