MastraStorage
MastraStorage provides a unified interface for managing
- Workflow Tracking, allowing users to suspend and resume workflow runs.
- Memory, threads and messages per resourceId in your application
- Traces - OpenTelemetry traces from all components of Mastra
- Evaluation Datasets - as evaluations are run, the scores and reasons are stored in datasets.

Mastra provides different storage providers, but you can treat them as interchangeable. Eg, you could use libsql in development but postgres in production, and your code will work the same both ways.
Data Schema
Memory
Messages
Stores conversation messages and their metadata. Each message belongs to a thread and contains the actual content along with metadata about the sender role and message type.
Threads
Groups related messages together and associates them with a resource. Contains metadata about the conversation.
Workflows
Preserves workflow execution states and enables resuming workflows:
Evaluation Datasets
Stores evaluation results from running metrics against agent outputs:
Traces
Captures OpenTelemetry traces for monitoring and debugging:
Configuration
Mastra can be configured with a default storage option:
import { Mastra } from '@mastra/core/mastra';
import { DefaultStorage } from '@mastra/core/storage/libsql';
const mastra = new Mastra({
storage: new DefaultStorage({
config: {
url: "file:storage.db",
}
}),
});
Other Storage Providers
If you want to use other storage, check out the following providers: