Upgrade to Mastra v1
This guide provides a comprehensive overview of breaking changes when upgrading from Mastra 0.x to v1.0. The migration is organized by package and feature area to help you systematically update your codebase.
Need help with the migration? Join our Discord community to ask questions.
Migration Strategy
Update all Mastra packages
Use your package manager to update your project's versions. Be sure to update all Mastra packages at the same time to ensure compatibility.
Update Node.js version
Mastra v1 requires Node.js 22.13.0 or higher. Update your development and production environments accordingly.
Breaking Changes by Area
- Mastra Class - Import restructuring and property access changes.
- Agent Class - Voice methods moved to namespace and streaming API updates.
- Tools - CreateTool execute signature changed to separate input and context.
- Workflows - Function name changes and legacy features removed.
- Memory - Configuration now requires explicit parameters and defaults changed.
- Storage - Pagination standardized and methods renamed to list pattern.
- Vectors - Vector store methods renamed to list pattern.
- MCP - Tool context reorganized and deprecated client classes removed.
- Tracing - OTEL telemetry replaced with dedicated observability package and exporters.
- Evals & Scorers - Scorers API consolidated with new naming conventions.
- CLI - Commands and flags removed for simpler interface.
- Client SDKs - Types and utilities renamed for consistency.
- Voice Packages - Packages renamed from speech to voice.
Migration Checklist
Work through this checklist in order, starting with high-impact changes that affect most applications.
We prepared automated codemods for you. Throughout the migration guide you'll find instructions on how to use them for specific changes.
If you want, you can run all v1 codemods at once:
npx @mastra/codemod@beta v1
High Impact Changes
- Update
createTooltool signatures to(inputData, context)format - Tools - Restructure
@mastra/coreimports to use subpath imports - Mastra Class - Update pagination from
offset/limittopage/perPage- Storage - Install
@mastra/observabilityand wrap configuration withnew Observability()- Tracing - Migrate from
telemetry:toobservability:configuration (if upgrading from 0.x OTEL) - Tracing
Medium Impact Changes
- Rename
RuntimeContexttoRequestContextthroughout codebase - Agent Class, Tools, Workflows - Update storage methods from
get*tolist*pattern - Storage - Replace direct property access with getter methods - Mastra Class, Agent Class
- Update memory scope if relying on default
threadscope - Memory - Update vector store calls to use named arguments - Storage
- Remove
formatparameter from agent methods - Agent Class - Update voice methods to use
agent.voicenamespace - Agent Class - Rename configuration property
processorstospanOutputProcessors(if using custom processors) - Tracing
Low Impact Changes
- Rename
createRunAsynctocreateRun- Workflows - Update voice package names from
@mastra/speech-*to@mastra/voice-*- Voice Packages - Update scorer methods:
runExperiment→runEvals,getScorerByName→getScorerById- Evals & Scorers - Remove deprecated CLI flags - CLI
- Update client SDK types from
Get*toList*- Client SDKs - Replace
runCountwithretryCount- Workflows - Update custom exporter method
exportEventtoexportTracingEvent(if using custom exporters) - Tracing