dataset.updateExperiment()
Added in: @mastra/core@1.64.0
Updates the name, description, or metadata of an existing experiment (run). Status and result counters are managed by the experiment lifecycle and can't be changed here.
Usage exampleDirect link to Usage example
import { Mastra } from '@mastra/core'
const mastra = new Mastra({/* storage config */})
const dataset = await mastra.datasets.get({ id: 'dataset-id' })
const experiment = await dataset.updateExperiment({
experimentId: 'exp-id',
name: 'Baseline vs. new prompt',
description: 'Run after switching to the shorter system prompt',
})
console.log(experiment.name)
ParametersDirect link to Parameters
experimentId:
string
ID of the experiment to update. Must belong to this dataset.
name?:
string
New display name for the experiment.
description?:
string
New description for the experiment.
metadata?:
Record<string, unknown>
Replacement metadata for the experiment.
Omitted fields are left unchanged.
ReturnsDirect link to Returns
result:
Promise<Experiment>
The updated experiment record. See dataset.listExperiments() for the full shape.