存储
🌐 Storage
存储 API 已经标准化,所有方法都采用了一致的分页和命名模式。
🌐 Storage APIs have been standardized with consistent pagination and naming patterns across all methods.
数据库迁移Direct link to 数据库迁移
🌐 Database Migration
通过你正常的迁移流程运行这些 SQL 迁移(例如,Prisma Migrate、Drizzle Kit 或你的 DBA 审核流程)。
🌐 Run these SQL migrations through your normal migration process (e.g., Prisma Migrate, Drizzle Kit, or your DBA review process).
得分表列重命名Direct link to 得分表列重命名
🌐 Scorers table column rename
mastra_scorers 中的 runtimeContext 列已重命名为 requestContext。
🌐 The runtimeContext column in mastra_scorers was renamed to requestContext.
Only if you use @mastra/pg or @mastra/libsql with evals/scoring and have existing data in the runtimeContext column.
Existing score records won't have their request context data accessible.
在部署 v1(它在初始化时添加了新的 requestContext 列)之后,复制数据并删除旧列:
🌐 After deploying v1 (which adds the new requestContext column on init), copy the data and drop the old column:
UPDATE mastra_scorers SET "requestContext" = "runtimeContext" WHERE "runtimeContext" IS NOT NULL;
ALTER TABLE mastra_scorers DROP COLUMN "runtimeContext";
重复跨度迁移Direct link to 重复跨度迁移
🌐 Duplicate spans migration
如果你正在从旧版本的 Mastra 升级,mastra_spans 表中可能存在重复的 (traceId, spanId) 条目。V1 在这些列上增加了唯一约束以确保数据完整性,但如果存在重复项,则无法添加此约束。
🌐 If you're upgrading from an older version of Mastra, you may have duplicate (traceId, spanId) entries in your mastra_spans table. V1 adds a unique constraint on these columns to ensure data integrity, but this constraint cannot be added if duplicates exist.
Only if you have existing spans data from Mastra versions prior to v1 and encounter errors about duplicate key violations or constraint creation failures.
The storage initialization may fail when trying to add the unique constraint, or you may see errors like "duplicate key value violates unique constraint".
选项 1:使用命令行接口(推荐)
运行迁移命令,它会自动去重跨度并添加约束条件:
🌐 Run the migration command which automatically deduplicates spans and adds the constraint:
npx mastra migrate
CLI 会打包你的项目,连接到已配置的存储,并运行迁移。在移除重复项时,它会保留最完整的记录(基于 endTime 和属性)。
🌐 The CLI bundles your project, connects to your configured storage, and runs the migration. It keeps the most complete record (based on endTime and attributes) when removing duplicates.
选项 2:手动 SQL(PostgreSQL)
如果你更喜欢手动运行迁移:
🌐 If you prefer to run the migration manually:
-- Remove duplicates, keeping the most complete record
DELETE FROM mastra_spans a USING mastra_spans b
WHERE a.ctid < b.ctid
AND a."traceId" = b."traceId"
AND a."spanId" = b."spanId";
-- Add the unique constraint
ALTER TABLE mastra_spans ADD CONSTRAINT mastra_spans_trace_span_unique UNIQUE ("traceId", "spanId");
选项 3:手动迁移(其他数据库)
对于 ClickHouse、LibSQL、MongoDB 或 MSSQL,请使用编程接口:
🌐 For ClickHouse, LibSQL, MongoDB, or MSSQL, use the programmatic API:
const storage = mastra.getStorage();
const observabilityStore = await storage.getStore('observability');
// Check if migration is needed
const status = await observabilityStore?.checkSpansMigrationStatus();
console.log(status);
// Run the migration
const result = await observabilityStore?.migrateSpans();
console.log(result);
JSON 列(TEXT → JSONB)Direct link to JSON 列(TEXT → JSONB)
🌐 JSON columns (TEXT → JSONB)
仅限 PostgreSQL。 mastra_threads 表中的 metadata 列和 mastra_workflow_snapshot 表中的 snapshot 列已从 TEXT 类型更改为 JSONB 类型。
Migrating to JSONB enables native PostgreSQL JSON operators and GIN indexing for better query performance on JSON fields.
ALTER TABLE mastra_threads
ALTER COLUMN metadata TYPE jsonb
USING metadata::jsonb;
ALTER TABLE mastra_workflow_snapshot
ALTER COLUMN snapshot TYPE jsonb
USING snapshot::jsonb;
已添加Direct link to 已添加
🌐 Added
MastraCompositeStore 中的存储组成Direct link to MastraCompositeStore 中的存储组成
🌐 Storage composition in MastraCompositeStore
MastraCompositeStore 现在可以从不同的适配器创建存储域。当你需要为不同用途使用不同的数据库时,可以使用它——例如,使用 PostgreSQL 处理内存和工作流,但为可观测性使用专门的数据库。
import { MastraCompositeStore } from "@mastra/core/storage";
import { MemoryPG, WorkflowsPG, ScoresPG } from "@mastra/pg";
import { MemoryLibSQL } from "@mastra/libsql";
import { Mastra } from "@mastra/core";
// Compose domains from different stores
const mastra = new Mastra({
storage: new MastraCompositeStore({
id: "composite",
domains: {
memory: new MemoryLibSQL({ url: "file:./local.db" }),
workflows: new WorkflowsPG({ connectionString: process.env.DATABASE_URL }),
scores: new ScoresPG({ connectionString: process.env.DATABASE_URL }),
},
}),
});
有关更多详细信息,请参见 存储组成参考。
🌐 See the Storage Composition reference for more details.
已更改Direct link to 已更改
🌐 Changed
MastraStorage 已重命名为 MastraCompositeStoreDirect link to mastrastorage-renamed-to-mastracompositestore
🌐 MastraStorage renamed to MastraCompositeStore
MastraStorage 类已重命名为 MastraCompositeStore,以更好地反映其作为复合存储实现的角色,该实现将不同的域路由到不同的底层存储。这避免了与通用的“Mastra 存储”概念(Mastra 实例上的 storage 属性)混淆。
🌐 The MastraStorage class has been renamed to MastraCompositeStore to better reflect its role as a composite storage implementation that routes different domains to different underlying stores. This avoids confusion with the general "Mastra Storage" concept (the storage property on the Mastra instance).
旧的 MastraStorage 名称仍可作为向后兼容的已弃用别名使用,但将在未来版本中移除。
🌐 The old MastraStorage name remains available as a deprecated alias for backward compatibility, but will be removed in a future version.
要迁移,请更新你的导入和实例化:
🌐 To migrate, update your imports and instantiation:
- import { MastraStorage } from "@mastra/core/storage";
+ import { MastraCompositeStore } from "@mastra/core/storage";
import { MemoryLibSQL } from "@mastra/libsql";
import { WorkflowsPG } from "@mastra/pg";
export const mastra = new Mastra({
- storage: new MastraStorage({
+ storage: new MastraCompositeStore({
id: "composite",
domains: {
memory: new MemoryLibSQL({ url: "file:./memory.db" }),
workflows: new WorkflowsPG({ connectionString: process.env.DATABASE_URL }),
},
}),
});
如果你直接使用单一存储实现(如 PostgresStore 或 LibSQLStore),则无需做任何更改。这只影响明确使用 MastraStorage 进行复合存储的代码。
存储实例所需的 id 属性Direct link to required-id-property-for-storage-instances
🌐 Required id property for storage instances
存储实例现在需要一个 id 属性。此唯一标识符用于在 Mastra 中跟踪和管理存储实例。id 应该是每个存储实例在你的应用中独一无二且具有描述性的字符串。
🌐 Storage instances now require an id property. This unique identifier is used for tracking and managing storage instances within Mastra. The id should be a descriptive, unique string for each storage instance in your application.
要进行迁移,请在你的存储构造函数中添加一个 id 字段。
🌐 To migrate, add an id field to your storage constructor.
const storage = new PostgresStore({
+ id: 'main-postgres-store',
connectionString: process.env.POSTGRES_CONNECTION_STRING,
schemaName: 'public',
});
const upstashStore = new UpstashStore({
+ id: 'upstash-cache-store',
url: process.env.UPSTASH_REDIS_REST_URL,
token: process.env.UPSTASH_REDIS_REST_TOKEN,
});
分页从 offset/limit 到 page/perPageDirect link to pagination-from-offsetlimit-to-pageperpage
🌐 Pagination from offset/limit to page/perPage
所有分页 API 现在使用 page 和 perPage,而不是 offset 和 limit。此更改提供了一个更直观的分页模型,与常见的网页分页模式一致。
🌐 All pagination APIs now use page and perPage instead of offset and limit. This change provides a more intuitive pagination model that aligns with common web pagination patterns.
要进行迁移,请将所有分页参数从 offset/limit 更新为 page/perPage。注意,page 是从 0 开始计数的。
🌐 To migrate, update all pagination parameters from offset/limit to page/perPage. Note that page is 0-indexed.
memoryStore.listMessages({
threadId: 'thread-123',
- offset: 0,
- limit: 20,
+ page: 0,
+ perPage: 20,
});
getMessagesPaginated 到 listMessagesDirect link to getmessagespaginated-to-listmessages
🌐 getMessagesPaginated to listMessages
getMessagesPaginated() 方法已被 listMessages() 替换。新方法支持 perPage: false 来获取所有记录而无需分页。此更改符合 list* 命名规范,并为获取所有记录增加了灵活性。
🌐 The getMessagesPaginated() method has been replaced with listMessages(). The new method supports perPage: false to fetch all records without pagination. This change aligns with the list* naming convention and adds flexibility for fetching all records.
要进行迁移,请重命名方法并更新分页参数。你现在可以使用 perPage: false 来获取所有记录。
🌐 To migrate, rename the method and update pagination parameters. You can now use perPage: false to fetch all records.
+ const memoryStore = await storage.getStore('memory');
+
// Paginated
- const result = await storage.getMessagesPaginated({
+ const result = await memoryStore?.listMessages({
threadId: 'thread-123',
- offset: 0,
- limit: 20,
+ page: 0,
+ perPage: 20,
});
// Fetch all records (no pagination limit)
+ const allMessages = await memoryStore?.listMessages({
+ threadId: 'thread-123',
+ page: 0,
+ perPage: false,
+ });
你可以使用 Mastra 的 codemod CLI 来自动更新你的代码:
🌐 You can use Mastra's codemod CLI to update your code automatically:
npx @mastra/codemod@latest v1/storage-get-messages-paginated .
通过 getStore() 进行特定字段的存储访问Direct link to domain-specific-storage-access-via-getstore
🌐 Domain-specific storage access via getStore()
现在,存储操作是通过特定字段的存储访问的,而不是直接在存储实例上进行。
🌐 Storage operations are now accessed through domain-specific stores instead of directly on the storage instance.
字段包括:
🌐 Domains include:
memory- 线程、消息和资源workflows- 工作流程快照scores- 评估得分observability- 跟踪与跨度agents- 存储的代理数据
要进行迁移,请使用域名调用 getStore(),然后在返回的存储上调用方法。
🌐 To migrate, call getStore() with the domain name, then call methods on the returned store.
const storage = mastra.getStorage();
// Memory operations (threads, messages, resources)
- const thread = await storage.getThread({ threadId: '123' });
- await storage.saveThread({ thread });
+ const memoryStore = await storage.getStore('memory');
+ const thread = await memoryStore?.getThreadById({ threadId: '123' });
+ await memoryStore?.saveThread({ thread });
// Workflow operations (snapshots)
- const snapshot = await storage.loadWorkflowSnapshot({ runId, workflowName });
- await storage.persistWorkflowSnapshot({ runId, workflowName, snapshot });
+ const workflowStore = await storage.getStore('workflows');
+ const snapshot = await workflowStore?.loadWorkflowSnapshot({ runId, workflowName });
+ await workflowStore?.persistWorkflowSnapshot({ runId, workflowName, snapshot });
// Observability operations (traces, spans)
- const traces = await storage.listTraces({ page: 0, perPage: 20 });
+ const observabilityStore = await storage.getStore('observability');
+ const traces = await observabilityStore?.listTraces({ page: 0, perPage: 20 });
// Score operations (evaluations)
- const scores = await storage.listScoresByScorerId({ scorerId: 'helpfulness' });
+ const scoresStore = await storage.getStore('scores');
+ const scores = await scoresStore?.listScoresByScorerId({ scorerId: 'helpfulness' });
getThreadsByResourceId 到 listThreadsDirect link to getthreadsbyresourceid-to-listthreads
🌐 getThreadsByResourceId to listThreads
getThreadsByResourceId() 方法已被 listThreads() 取代。新方法增加了分页支持,并可以按 resourceId、metadata 或两者进行过滤。
🌐 The getThreadsByResourceId() method has been replaced with listThreads(). The new method adds pagination support and filtering by resourceId, metadata, or both.
旧的 getThreadsByResourceId() 会返回所有匹配的线程,不进行分页。新的 listThreads() 需要分页参数。要保持获取所有线程的旧行为,请使用 perPage: false。
🌐 The old getThreadsByResourceId() returned all matching threads without pagination. The new listThreads() requires pagination parameters. To preserve the old behavior of fetching all threads, use perPage: false.
要进行迁移,请使用内存存储和带分页的新 listThreads() 方法,以及可选的过滤对象。
🌐 To migrate, use the memory store and the new listThreads() method with pagination and an optional filter object.
- const threads = await storage.getThreadsByResourceId({
- resourceId: 'res-123',
- });
+ const memoryStore = await storage.getStore('memory');
+
+ // Paginated (recommended for large datasets)
+ const result = await memoryStore?.listThreads({
+ filter: { resourceId: 'res-123' },
+ page: 0,
+ perPage: 20,
+ });
+ const threads = result?.threads;
+
+ // Or fetch all threads like before (use perPage: false)
+ const allResult = await memoryStore?.listThreads({
+ filter: { resourceId: 'res-123' },
+ perPage: false,
+ });
+ const allThreads = allResult?.threads;
新方法还支持:
🌐 The new method also supports:
- 列出所有线程(省略筛选)
- 仅按元数据筛选
- 组合的 resourceId + 元数据筛选器
// List all threads
await memoryStore?.listThreads({ page: 0, perPage: 20 });
// Filter by metadata only
await memoryStore?.listThreads({
filter: { metadata: { status: 'active' } },
page: 0,
perPage: 20,
});
// Combined filter
await memoryStore?.listThreads({
filter: {
resourceId: 'user-123',
metadata: { category: 'support' },
},
page: 0,
perPage: 20,
});
你可以使用 Mastra 的 codemod CLI 来自动更新你的代码:
🌐 You can use Mastra's codemod CLI to update your code automatically:
npx @mastra/codemod@latest v1/storage-list-threads-by-resource-to-list-threads .
getWorkflowRuns 到 listWorkflowRunsDirect link to getworkflowruns-to-listworkflowruns
🌐 getWorkflowRuns to listWorkflowRuns
getWorkflowRuns() 方法已重命名为 listWorkflowRuns()。此更改符合 list* 方法返回集合的惯例。
🌐 The getWorkflowRuns() method has been renamed to listWorkflowRuns(). This change aligns with the convention that list* methods return collections.
要进行迁移,请使用工作流存储,重命名方法调用,并更新分页参数。
🌐 To migrate, use the workflows stores, rename the method call and update pagination parameters.
- const runs = await storage.getWorkflowRuns({
+ const workflowStore = await storage.getStore('workflows');
+ const runs = await workflowStore?.listWorkflowRuns({
fromDate,
toDate,
+ page: 0,
+ perPage: 20,
});
你可以使用 Mastra 的 codemod CLI 来自动更新你的代码:
🌐 You can use Mastra's codemod CLI to update your code automatically:
npx @mastra/codemod@latest v1/storage-list-workflow-runs .
getMessagesById 到 listMessagesByIdDirect link to getmessagesbyid-to-listmessagesbyid
🌐 getMessagesById to listMessagesById
getMessagesById() 方法已重命名为 listMessagesById()。此更改符合 list* 方法返回集合的惯例。
🌐 The getMessagesById() method has been renamed to listMessagesById(). This change aligns with the convention that list* methods return collections.
要进行迁移,请使用内存存储并重命名方法调用。
🌐 To migrate, use the memory store and rename the method call.
+ const memoryStore = await storage.getStore('memory');
- const result = await storage.getMessagesById({
+ const result = await memoryStore?.listMessagesById({
messageIds: ['msg-1', 'msg-2'],
});
你可以使用 Mastra 的 codemod CLI 来自动更新你的代码:
🌐 You can use Mastra's codemod CLI to update your code automatically:
npx @mastra/codemod@latest v1/storage-list-messages-by-id .
存储 getMessages 和 saveMessages 签名Direct link to storage-getmessages-and-savemessages-signatures
🌐 Storage getMessages and saveMessages signatures
getMessages() 和 saveMessages() 方法的签名和返回类型已更改。格式重载已被移除,这些方法现在始终与 MastraDBMessage 一起使用。此更改通过删除格式变体简化了 API。
🌐 The getMessages() and saveMessages() methods have changed signatures and return types. Format overloads have been removed, and the methods now always work with MastraDBMessage. This change simplifies the API by removing format variations.
要进行迁移,请使用内存存储,移除格式参数,并更新代码以处理一致的返回类型。
🌐 To migrate, use the memory store, remove format parameters, and update code to work with the consistent return type.
+ const memoryStore = await storage.getStore('memory');
+
// Always returns { messages: MastraDBMessage[] }
- const v1Messages = await storage.getMessages({ threadId, format: 'v1' });
- const v2Messages = await storage.getMessages({ threadId, format: 'v2' });
+ const result = await memoryStore?.getMessages({ threadId });
+ const messages = result?.messages; // MastraDBMessage[]
// SaveMessages always uses MastraDBMessage
- await storage.saveMessages({ messages: v1Messages, format: 'v1' });
- await storage.saveMessages({ messages: v2Messages, format: 'v2' });
+ const saveResult = await memoryStore?.saveMessages({ messages: mastraDBMessages });
+ const saved = saveResult?.messages; // MastraDBMessage[]
向量存储 API 从位置参数改为命名参数Direct link to 向量存储 API 从位置参数改为命名参数
🌐 Vector store API from positional to named arguments
所有向量存储方法现在都使用命名参数而不是位置参数。此更改提高了代码的可读性,并使方法签名更易于维护。
🌐 All vector store methods now use named arguments instead of positional arguments. This change improves code readability and makes method signatures more maintainable.
要进行迁移,请更新所有向量存储方法调用以使用命名参数。
🌐 To migrate, update all vector store method calls to use named arguments.
- await vectorDB.createIndex(indexName, 3, 'cosine');
+ await vectorDB.createIndex({
+ indexName: indexName,
+ dimension: 3,
+ metric: 'cosine',
+ });
- await vectorDB.upsert(indexName, [[1, 2, 3]], [{ test: 'data' }]);
+ await vectorDB.upsert({
+ indexName: indexName,
+ vectors: [[1, 2, 3]],
+ metadata: [{ test: 'data' }],
+ });
- await vectorDB.query(indexName, [1, 2, 3], 5);
+ await vectorDB.query({
+ indexName: indexName,
+ queryVector: [1, 2, 3],
+ topK: 5,
+ });
向量存储方法重命名Direct link to 向量存储方法重命名
🌐 Vector store method renames
updateIndexById 和 deleteIndexById 方法已分别重命名为 updateVector 和 deleteVector。此更改提供了更清晰的命名,更好地描述了操作。
🌐 The updateIndexById and deleteIndexById methods have been renamed to updateVector and deleteVector respectively. This change provides clearer naming that better describes the operations.
要进行迁移,请重命名方法并使用命名参数。
🌐 To migrate, rename the methods and use named arguments.
- await vectorDB.updateIndexById(indexName, id, update);
- await vectorDB.deleteIndexById(indexName, id);
+ await vectorDB.updateVector({ indexName, id, update });
+ await vectorDB.deleteVector({ indexName, id });
从连接字符串到对象的 PGVector 构造函数Direct link to 从连接字符串到对象的 PGVector 构造函数
🌐 PGVector constructor from connection string to object
PGVector 构造函数现在需要对象参数,而不是连接字符串。这一更改使所有存储适配器的 API 更加一致。
🌐 The PGVector constructor now requires object parameters instead of a connection string. This change provides a more consistent API across all storage adapters.
要进行迁移,请将连接字符串作为对象属性传递。
🌐 To migrate, pass the connection string as an object property.
- const pgVector = new PgVector(process.env.POSTGRES_CONNECTION_STRING!);
+ const pgVector = new PgVector({
+ connectionString: process.env.POSTGRES_CONNECTION_STRING,
+ });
你可以使用 Mastra 的 codemod CLI 来自动更新你的代码:
🌐 You can use Mastra's codemod CLI to update your code automatically:
npx @mastra/codemod@latest v1/vector-pg-constructor .
PGVector defineIndex 到 buildIndexDirect link to pgvector-defineindex-to-buildindex
🌐 PGVector defineIndex to buildIndex
defineIndex() 方法已被移除,取而代之的是 buildIndex()。此更改为索引构建操作提供了更清晰的命名。
🌐 The defineIndex() method has been removed in favor of buildIndex(). This change provides clearer naming for the index building operation.
要迁移,请重命名方法并使用命名参数。
🌐 To migrate, rename the method and use named arguments.
- await vectorDB.defineIndex(indexName, 'cosine', { type: 'flat' });
+ await vectorDB.buildIndex({
+ indexName: indexName,
+ metric: 'cosine',
+ indexConfig: { type: 'flat' },
+ });
PostgresStore 从 schema 到 schemaNameDirect link to postgresstore-schema-to-schemaname
🌐 PostgresStore schema to schemaName
PostgresStore 构造函数中的 schema 参数已重命名为 schemaName。此更改提供了更清晰的命名,以避免与数据库模式概念混淆。
🌐 The schema parameter has been renamed to schemaName in the PostgresStore constructor. This change provides clearer naming to avoid confusion with database schema concepts.
要迁移,请重命名该参数。
🌐 To migrate, rename the parameter.
const pgStore = new PostgresStore({
connectionString: process.env.POSTGRES_CONNECTION_STRING,
- schema: customSchema,
+ schemaName: customSchema,
});
你可以使用 Mastra 的 codemod CLI 来自动更新你的代码:
🌐 You can use Mastra's codemod CLI to update your code automatically:
npx @mastra/codemod@latest v1/storage-postgres-schema-name .
将分数存储方法调整为 listScoresBy* 模式Direct link to score-storage-methods-to-listscoresby-pattern
🌐 Score storage methods to listScoresBy* pattern
分数存储 API 已被重新命名,以遵循 listScoresBy* 模式。此更改使其与更广泛的 API 命名规范保持一致。
🌐 Score storage APIs have been renamed to follow the listScoresBy* pattern. This change provides consistency with the broader API naming conventions.
要迁移,请将方法名称从 getScores 更新为 listScoresByScorerId 及相关变体。
🌐 To migrate, update method names from getScores to listScoresByScorerId and related variants.
- const scores = await storage.getScores({ scorerName: 'helpfulness-scorer' });
+ const scores = await storage.listScoresByScorerId({
+ scorerId: 'helpfulness-scorer',
+ });
+ // Also available: listScoresByRunId, listScoresByEntityId, listScoresBySpan
已移除Direct link to 已移除
🌐 Removed
非分页存储功能Direct link to 非分页存储功能
🌐 Non-paginated storage functions
非分页存储功能已被移除,取而代之的是分页版本。现在所有列表操作都使用分页,尽管你可以使用 perPage: false 获取所有记录。此更改提供了 API 的一致性,并防止意外加载大量数据集。
🌐 Non-paginated storage functions have been removed in favor of paginated versions. All list operations now use pagination, though you can fetch all records with perPage: false. This change provides consistency across the API and prevents accidental loading of large datasets.
要进行迁移,请通过域存储使用分页方法。要获取所有记录,请使用 perPage: false。
🌐 To migrate, use paginated methods via domain stores. For fetching all records, use perPage: false.
- // Non-paginated direct access
- const messages = await storage.getMessages({ threadId });
+ // Use paginated methods via domain stores
+ const memoryStore = await storage.getStore('memory');
+ const result = await memoryStore?.listMessages({ threadId, page: 0, perPage: 20 });
+ // Or fetch all
+ const allMessages = await memoryStore?.listMessages({
+ threadId,
+ page: 0,
+ perPage: false,
+ });
getTraces 和 getTracesPaginatedDirect link to gettraces-and-gettracespaginated
🌐 getTraces and getTracesPaginated
getTraces() 和 getTracesPaginated() 方法已从存储中移除。追踪现在通过 observability 包处理,而不是核心存储。此更改在核心存储和可观测性功能之间提供了更好的关注点分离。
🌐 The getTraces() and getTracesPaginated() methods have been removed from storage. Traces are now handled through the observability package rather than core storage. This change provides better separation of concerns between core storage and observability features.
要迁移,请改用可观测性存储方法。
🌐 To migrate, use observability storage methods instead.
- const traces = await storage.getTraces({ traceId: 'trace-123' });
- const paginated = await storage.getTracesPaginated({ page: 0, perPage: 20 });
+ // Use observability API for traces
+ import { initObservability } from '@mastra/observability';
+ const observability = initObservability({ config: { ... } });
+ // Access traces through observability API
评估测试工具Direct link to 评估测试工具
🌐 Evals test utilities
@internal/test-utils 中已移除 Evals 域测试工具。此更改反映了对旧版 evals 功能的移除。
🌐 Evals domain test utilities have been removed from @internal/test-utils. This change reflects the removal of legacy evals functionality.
要进行迁移,请直接使用存储 API 进行测试,而不是使用专门的评估测试工具。
🌐 To migrate, use storage APIs directly for testing instead of specialized evals test utilities.
- import { createEvalsTests } from '@internal/test-utils/domains/evals';
- createEvalsTests({ storage });
+ // Use storage APIs directly for testing
来自 MSSQL 存储的 TABLE_EVALSDirect link to 来自 MSSQL 存储的 TABLE_EVALS
🌐 TABLE_EVALS from MSSQL storage
TABLE_EVALS 表已从 MSSQL 存储实现中移除。此更改反映了对旧版评估功能的移除。
🌐 The TABLE_EVALS table has been removed from MSSQL storage implementations. This change reflects the removal of legacy evals functionality.
如果你正在使用带有 evals 的 MSSQL 存储,请迁移到其他存储适配器或移除 evals 功能。
🌐 If you were using MSSQL storage with evals, migrate to a different storage adapter or remove evals functionality.