put_experiment_run_results
¶
put_experiment_run_results(
experiment_id: ExperimentId,
run_id: ExperimentRunId,
results: ExperimentCaseResultList,
*,
config_overrides: Optional[CloudWatchOmniClientConfig] = None,
client_token: Optional[ClientToken] = None,
run: Optional[ReportedRunInfo] = None,
) -> PutExperimentRunResultsOutput
Reports a batch of scored cases for a run. Applies to runs reported from the caller's code (REPORTED runs). Each call reports up to 25 cases. The first call with a new runId creates the run and must include the run block. Repeat the call to report more cases, then call CompleteExperimentRun to end the run. Fails with a ConflictException (RUN_TERMINAL) for a run that has ended, and (RUN_ID_DELETED) for the runId of a deleted run. The batch is atomic: an invalid item fails the whole request with a ValidationException that names the item and field (for example, results[3].caseId), and nothing is written. A request is at most 1 MB, and each results item at most 256 KB as canonical JSON. A larger item fails with a ValidationException, and a larger request is rejected before it reaches the API.
Parameters:
-
experiment_id(ExperimentId) –The ID of the experiment the run belongs to.
-
run_id(ExperimentRunId) –The ID of the run, chosen by the caller. A runId that is new to the experiment creates a run. A call that fails validation does not create the run.
-
client_token(Optional[ClientToken], default:None) –Idempotency token for safe retries. Repeated requests with the same token and identical input return the recorded response. A call that fails validation frees the token, so the corrected batch can be resent with the same token.
-
run(Optional[ReportedRunInfo], default:None) –The details of the run. Required on the call that creates the run; optional afterwards, and must match the run when present.
-
results(ExperimentCaseResultList) –The cases to report: up to 25 distinct cases, written atomically so that all are accepted or none are. Each item is at most 256 KB as canonical JSON.
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:
Create a reported run and report its first cases The following example creates a run reported from the caller's code and reports two cases: one the agent answered, and one where the agent could not be invoked. Payloads are shown as JSON; on the wire they are CBOR-encoded.
>>> client.put_experiment_run_results(experiment_id='exp-01JD8K3M5N7P9Q2R4S6T8V0W1X', run_id='ci-build-4821', client_token='ci-build-4821-batch-1', run={'producer': {'kind': 'CUSTOM', 'name': 'release-eval-harness', 'version': '1.4.0', 'externalId': '4821'}, 'evaluators': [{'evaluatorId': 'Builtin.Helpfulness', 'ratingScale': 'NUMERIC'}], 'rule': {'source': 'FILE', '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', 'version': '7'}}, 'dataset': {'source': 'FILE', 'name': 'support-faq.jsonl', 'caseCount': 50}, 'metadata': {'gitCommit': '4f9c2e1'}, 'startedAt': '2026-11-10T15:01:58Z'}, results=[{'caseId': 'faq-001', 'sessionId': 'ci-build-4821-faq-001', 'executionStatus': 'COMPLETED', 'turns': [{'traceId': '6f1c2a9e4b7d3f08a5c1e9b2d4f6a8c0', 'input': 'How do I reset my password?', 'output': 'Choose Forgot password on the sign-in page and follow the link that we email you.'}], 'evaluators': [{'evaluatorId': 'Builtin.Helpfulness', 'score': 0.86}]}, {'caseId': 'faq-002', 'executionStatus': 'TARGET_ERROR', 'statusReason': 'TARGET_INVOKE_ERROR', 'turns': [{'input': 'Can I change the email on my account?'}]}])
Source code in docs_src/capo_cloudwatchomni/_services/cloud_watch_omni.py
7127 7128 7129 7130 7131 7132 7133 7134 7135 7136 7137 7138 7139 7140 7141 7142 7143 7144 7145 7146 7147 7148 7149 7150 7151 7152 7153 7154 7155 7156 7157 7158 7159 7160 7161 7162 7163 7164 7165 7166 7167 7168 7169 7170 7171 7172 7173 7174 7175 7176 7177 7178 7179 7180 7181 7182 7183 7184 7185 7186 7187 7188 7189 7190 7191 7192 7193 7194 7195 7196 7197 7198 7199 7200 7201 7202 7203 7204 7205 7206 7207 7208 7209 7210 7211 | |