dataset.submitExperimentResult()
Added in: @mastra/core@1.61.0
Submits (or re-submits) one externally computed item result for a target-less experiment created with createExperiment().
Submissions are upserts keyed by (experimentId, itemId, attempt): a retried worker that submits the same key converges on a single row instead of duplicating results. Use a different attempt value to record repeated trials as separate rows.
Usage exampleDirect link to Usage example
const result = await dataset.submitExperimentResult({
experimentId,
itemId: 'item-1',
output: { translation: 'Hola' },
scores: [{ scorerId: 'accuracy', score: 0.92, reason: 'Faithful translation' }],
})
The item must be visible at the experiment's pinned dataset version. Submissions to an experiment that has a target throw EXPERIMENT_HAS_TARGET, which prevents two writers from racing on the same rows. Submissions after finalization throw EXPERIMENT_ALREADY_FINALIZED.
ParametersDirect link to Parameters
experimentId:
itemId:
attempt?:
0. Same (experimentId, itemId, attempt) upserts the existing row.input?:
output?:
groundTruth?:
error?:
message, optional stack and code) when the item failed.startedAt?:
completedAt?:
traceId?:
scores?:
scorerId, score, optional scorerName, reason, metadata). Persisted to the scores store under the experiment, so they appear in comparisons alongside native scorer runs. Score persistence is best-effort and never fails the submission.ReturnsDirect link to Returns
Returns a Promise<ExperimentResult>, the persisted result row, including its id, attempt, and timestamps.