Highlights
Observability Storage Domain (schemas + in-memory implementations)
Mastra now ships zod-based storage schemas and in-memory implementations for all observability signals (scores, logs, feedback, metrics, discovery), with full type inference and a base ObservabilityStorage that includes default method implementations.
New persistent Workspace filesystem: @mastra/agentfs
The new AgentFSFilesystem workspace provider adds Turso/SQLite-backed, database-persistent file storage for agents across sessions via agentfs-sdk.
Observability pipeline upgrades: renamed types + EventBuffer batching
@mastra/observability exporters/event bus were updated to align with renamed core observability types, and an EventBuffer was added to batch non-tracing signals with configurable flush intervals.
Type-safe server route inference via @mastra/server/schemas
A new @mastra/server/schemas export provides utility types (RouteMap, InferPathParams, InferBody, InferResponse, etc.) that automatically infer request/response types from SERVER_ROUTES, including routes added via createRoute().
Lower token costs for long-running Observational Memory
Observational Memory adds observation.previousObserverTokens to truncate the “Previous Observations” context to a token budget (or omit/disable truncation), reducing observer prompt size in long conversations.
Breaking Changes
MetricType(counter/gauge/histogram) is deprecated — metrics are now raw events with aggregation at query time- Score schemas now use
scorerIdinstead ofscorerName ObservabilityBusconstructor now takes a config object (cardinalityFilter,autoExtractMetrics);setCardinalityFilter()andenableAutoExtractedMetrics()were removed
Changelog
@mastra/core@1.13.0
Minor Changes
-
Added observability storage domain schemas and implementations (#14214)
Introduced comprehensive storage schemas and in-memory implementations for all observability signals (scores, logs, feedback, metrics, discovery). All schemas are zod-based with full type inference. The
ObservabilityStoragebase class includes default implementations for all new methods.Breaking changes:
MetricType(counter/gauge/histogram) is deprecated — metrics are now raw events with aggregation at query time- Score schemas use
scorerIdinstead ofscorerNamefor scorer identification
Patch Changes
-
Update provider registry and model documentation with latest models and providers (
ea86967) -
Fixed provider tools (e.g.
openai.tools.webSearch()) being silently dropped when using a custom gateway that returns AI SDK v6 (V3) models. The router now remaps tool types fromprovider-definedtoproviderwhen delegating to V3 models, so provider tools work correctly through gateways. Fixes #13667. (#13895) -
Fixed TypeScript type errors in
onStepFinishandonFinishcallbacks, and resolved compatibility issues withcreateOpenRouter()across different AI SDK versions. (#14229) -
Fixed a bug where thread metadata (e.g. title, custom properties) passed via
options.memory.threadwas discarded whenMASTRA_THREAD_ID_KEYwas set in the request context. The thread ID from context still takes precedence, but all other user-provided thread properties are now preserved. (#13146) -
Fixed workspace tools such as
mastra_workspace_list_filesandmastra_workspace_read_filefailing withWorkspaceNotAvailableErrorin some execution paths. (#14228)Workspace tools now work consistently across execution paths.
-
Added observer context optimization for Observational Memory. The
observation.previousObserverTokensfield reduces Observer input token costs for long-running conversations: (#13568)- previousObserverTokens (default:
2000): Truncates the 'Previous Observations' section to a token budget, keeping the most recent observations and automatically replacing already-reflected lines with the buffered reflection summary. Set to0to omit previous observations entirely, orfalseto disable truncation and keep the full observation history.
const memory = new Memory({ options: { observationalMemory: { model: 'google/gemini-2.5-flash', observation: { previousObserverTokens: 10_000, }, }, }, });
- previousObserverTokens (default:
@mastra/agentfs@0.1.0
Minor Changes
-
Added AgentFSFilesystem workspace provider — a Turso/SQLite-backed filesystem via the agentfs-sdk that gives agents persistent, database-backed file storage across sessions. (#13450)
Basic usage
import { Workspace } from '@mastra/core/workspace'; import { AgentFSFilesystem } from '@mastra/agentfs'; const workspace = new Workspace({ filesystem: new AgentFSFilesystem({ agentId: 'my-agent', }), });
Patch Changes
@mastra/deployer@1.13.0
Patch Changes
-
Bump esbuild from ^0.25.10 to ^0.27.3 to resolve Go stdlib CVEs (CVE-2025-22871, CVE-2025-61729) flagged by npm audit in consumer projects. (#13124)
-
Fixed Agent-to-Agent requests to return a clear error message when the agent ID parameter is missing. (#14229)
-
Add dynamicPackages bundler config for runtime-loaded packages and auto-detect pino (#11779)
Adds a new
dynamicPackagesbundler config option for packages that are loaded
dynamically at runtime and cannot be detected by static analysis (e.g.,
pino.transport({ target: "pino-opentelemetry-transport" })).Usage:
import { Mastra } from '@mastra/core'; export const mastra = new Mastra({ bundler: { dynamicPackages: ['my-custom-transport', 'some-plugin'], }, });
Additionally, pino transport targets are now automatically detected from the
bundled code, so most pino users won't need any configuration.This keeps
externalsfor its intended purpose (packages to not bundle) and
provides a clear mechanism for dynamic packages that need to be in the output
package.json.Fixes #10893
@mastra/mcp@1.2.1
Patch Changes
- Fixed TypeScript compilation errors when using MCP resource methods in projects with pnpm workspaces. (#14229)
@mastra/memory@1.8.0
Minor Changes
-
Added observer context optimization for Observational Memory. The
observation.previousObserverTokensfield reduces Observer input token costs for long-running conversations: (#13568)- previousObserverTokens (default:
2000): Truncates the 'Previous Observations' section to a token budget, keeping the most recent observations and automatically replacing already-reflected lines with the buffered reflection summary. Set to0to omit previous observations entirely, orfalseto disable truncation and keep the full observation history.
const memory = new Memory({ options: { observationalMemory: { model: 'google/gemini-2.5-flash', observation: { previousObserverTokens: 10_000, }, }, }, });
- previousObserverTokens (default:
Patch Changes
@mastra/observability@1.5.0
Minor Changes
-
Updated exporters and event bus to use renamed observability types from
@mastra/core. AddedEventBufferfor batching non-tracing signals with configurable flush intervals. (#14214)Breaking changes:
ObservabilityBusnow takes a config object in its constructor (cardinalityFilter,autoExtractMetrics);setCardinalityFilter()andenableAutoExtractedMetrics()removed
Patch Changes
@mastra/playground-ui@16.1.0
Minor Changes
- Added group-by-thread utility for the Observability tab. Traces can now be grouped by their conversation thread ID, making it easier to follow multi-turn agent conversations in Studio. See #14004. (#14112)
Patch Changes
-
Fixed agent playground panels growing together when content overflows. Left and right columns now scroll independently. (#14244)
-
Fixed an agent chat editor crash in Playground UI caused by duplicate CodeMirror state instances. (#14241)
-
Improved studio loading performance by lazy-loading the Prettier code formatter. Prettier and its plugins are now loaded on-demand when formatting is triggered, rather than being bundled in the initial page load. (#13934)
-
Improved list-style pages across the Playground UI (agents, datasets, MCPs, processors, prompt blocks, scorers, tools, workflows) with a new list layout and updated empty states. (#14173)
@mastra/schema-compat@1.2.2
Patch Changes
-
@mastra/schema-compat: patch (#14195)Fixed published
@mastra/schema-compattypes so AI SDK v5 schemas resolve correctly for consumers -
Fixed false
z.toJSONSchema is not availableerrors for compatible Zod versions. (#14264)What changed
- Improved Zod schema conversion detection so JSON Schema generation works more reliably across different runtime setups.
@mastra/server@1.13.0
Minor Changes
-
Added
@mastra/server/schemasexport with utility types that infer path params, query params, request body, and response types from any route inSERVER_ROUTES. When you add a new route viacreateRoute(), it automatically appears in theRouteMaptype — no manual contract needed. (#14008)import type { RouteMap, RouteContract, InferPathParams, InferBody, InferResponse } from '@mastra/server/schemas'; type GetAgentParams = InferPathParams<RouteMap['GET /agents/:agentId']>; // => { agentId: string } type GenerateBody = InferBody<RouteMap['POST /agents/:agentId/generate']>; // => { messages: CoreMessage[], ... } type AgentResponse = InferResponse<RouteMap['GET /agents/:agentId']>; // => { name: string, tools: ..., ... }
Patch Changes
-
Fixed OpenAPI spec for custom route paths. Custom routes registered via
registerApiRouteare served at the root path (e.g./health), not under/api. The OpenAPI spec now correctly represents this so that API tools and clients using the spec will resolve them to the correct URL. (#13930) -
Fixed an unnecessary runtime dependency in
@mastra/server, reducing install size for consumers. Moved@mastra/schema-compatfrom dependencies to devDependencies since it is only needed at build time. (#14223)
Other updated packages
The following packages were updated with dependency changes only:
- @mastra/agent-builder@1.0.13
- @mastra/arize@1.0.8
- @mastra/braintrust@1.0.8
- @mastra/client-js@1.8.2
- @mastra/datadog@1.0.7
- @mastra/deployer-cloud@1.13.0
- @mastra/deployer-cloudflare@1.1.10
- @mastra/deployer-netlify@1.0.14
- @mastra/deployer-vercel@1.1.4
- @mastra/express@1.2.2
- @mastra/fastify@1.2.2
- @mastra/hono@1.2.2
- @mastra/koa@1.3.2
- @mastra/laminar@1.0.7
- @mastra/langfuse@1.0.7
- @mastra/langsmith@1.1.5
- @mastra/longmemeval@1.0.14
- @mastra/mcp-docs-server@1.1.11
- @mastra/opencode@0.0.11
- @mastra/otel-bridge@1.0.7
- @mastra/otel-exporter@1.0.7
- @mastra/posthog@1.0.8
- @mastra/react@0.2.12
- @mastra/sentry@1.0.7