Mastra Platform - Hướng dẫn triển khai và quản lý ứng dụng AI
Trust: ★★★☆☆ (0.90) · 0 validations · factual
Published: 2026-05-09 · Source: crawler_authoritative
Tình huống
Nhà phát triển cần triển khai và quản lý ứng dụng AI được xây dựng với framework Mastra lên cloud production
Insight
Mastra platform cung cấp hai sản phẩm chính: Studio - môi trường visual để test agents, chạy workflows và inspect traces; Server - target triển khai production chạy ứng dụng Mastra dưới dạng API server. Nền tảng được xây dựng từ ba khối cơ bản: Agents (AI agents có thể sử dụng tools, follow instructions và maintain context), Tools (callable functions và integrations), và Workflows (pipeline điều phối multi-step giữa agents và tools). Project là entity cha chung cho tất cả products, có thể chứa cả Studio deployment và Server deployment. Projects thuộc về Organization - container đa tenant cho team. File .mastra-project.json được tạo tự động khi deploy lần đầu, chứa projectId, projectName và organizationId.
Hành động
Yêu cầu: Node.js 22.13.0 hoặc cao hơn. Cài đặt mastra CLI toàn cục với npm install -g mastra, pnpm add -g mastra, yarn global add mastra, hoặc bun add —global mastra. Deploy Studio bằng lệnh mastra studio deploy, deploy Server bằng lệnh mastra server deploy. Sau khi deploy thành công, CLI sẽ xuất URL của Studio/Server instance. Commit file .mastra-project.json vào repository để CI/CD biết project nào cần deploy. Phát triển local với mastra dev và mở Studio để test. Nếu host trên infrastructure riêng, vẫn có thể gửi observability data đến Studio qua CloudExporter.
Kết quả
Triển khai thành công cả Studio và Server instances của ứng dụng Mastra lên cloud
Điều kiện áp dụng
Yêu cầu Node.js 22.13.0 hoặc phiên bản cao hơn. Hỗ trợ npm, pnpm, Yarn, Bun.
Nội dung gốc (Original)
Mastra platform
The Mastra platform provides two products for deploying and managing AI applications built with the Mastra framework:
- Studio: A hosted visual environment for testing agents, running workflows, and inspecting traces
- Server: A production deployment target that runs your Mastra application as an API server
Quickstart
Before you begin, ensure you have Node.js 22.13.0 or later installed.
-
Follow the get started guide to create your first Mastra project.
-
Install the
mastraCLI globally:npm:
npm install -g mastrapnpm:
pnpm add -g mastraYarn:
yarn global add mastraBun:
bun add --global mastra -
Deploy Studio with a single command:
mastra studio deployOn a successful deploy, the CLI will output the URL of your deployed Studio instance.
-
Deploy Server with a single command:
mastra server deployOn a successful deploy, the CLI will output the URL of your deployed Server instance.
You have now successfully deployed both Studio and Server instances of your Mastra application. The CLI created a .mastra-project.json file in your project directory.
This file links your local project to a platform project. It’s auto-generated on your first deploy and contains the projectId, projectName, and organizationId. Commit this file to your repository so CI/CD knows which project to deploy to.
Key Concepts
Projects are the shared parent entity across all products. A single project can have a Studio deployment and a Server deployment. Projects belong to an Organization, which is the multi-tenant container for your team.
Your Mastra application is built from three building blocks:
- Agents: AI agents that can use tools, follow instructions, and maintain context
- Tools: Callable functions and integrations available to your agents
- Workflows: Multi-step orchestration pipelines that coordinate agents and tools
Going to production
Develop your project locally with mastra dev and open Studio to test your agents, workflows, and tools in a visual environment.
Once you’re ready to deploy your application to production, use mastra studio deploy and mastra server deploy to push your application to the cloud.
Follow the Studio deployment guide and Server deployment guide for step-by-step instructions.
If you host your Mastra application on your own infrastructure, you can still send observability data to Studio using the CloudExporter.
Liên kết
- Nền tảng: Mastra
- Nguồn: https://mastra.ai/docs/mastra-platform/overview
Xem thêm: