dotsagent.io
Ngôn ngữ:Tiếng Việt
Framework · Mastra

Tổng quan về Mastra

Framework TypeScript tích hợp agent, workflow có thể tạm dừng và tiếp tục, memory, evals và giao diện Studio trong một package. Framework có thể tích hợp vào ứng dụng Next.js, Express hoặc Hono; phần lõi dùng giấy phép Apache-2.0, còn các thư mục ee/ dùng giấy phép enterprise.

Phù hợp nhất với: Các đội ngũ TypeScript muốn dùng một stack duy nhất cho agent, workflow, memory và evals.

Thông tin chính

Đơn vị duy trì
Mastra
Ngôn ngữ
TypeScript
Giấy phép
Apache-2.0 (core)
Phiên bản mới nhất
@mastra/core 1.73.0 · 1 tháng 10, 2026
Repository
mastra-ai/mastra · 28.467 sao
Tùy chọn chạy trên nền tảng lưu trữ
Mastra Cloud / Mastra Platform
mastra deploy tạo và deploy một Docker image.

Bắt đầu nhanh

Cài package, thiết lập thông tin xác thực, rồi chạy agent đơn giản nhất theo tài liệu chính thức. ID model sử dụng trong tài liệu có thể chưa được bật cho tài khoản của bạn.

Cài đặt
npm install @mastra/core@latest zod@latest typescript@latest @types/node@latest mastra@latest  (or scaffold: npm create mastra@latest)

Cần OPENAI_API_KEY

TypeScript
// src/mastra/agents/weather-agent.ts
import { Agent } from '@mastra/core/agent'
import { weatherTool } from '../tools/weather-tool.ts'

export const weatherAgent = new Agent({
  id: 'weather-agent',
  name: 'Weather Agent',
  instructions: `
      You are a helpful weather assistant that provides accurate weather information.

      Your primary function is to help users get weather details for specific locations. When responding:
      - Include relevant details like humidity, wind conditions, and precipitation
      - Keep responses concise but informative

      Use the weatherTool to fetch current weather data.
`,
  // Use a string in provider/model format, not provider:model or a provider object.
  model: 'openai/gpt-5.6-sol',
  tools: { weatherTool },
})

// run.mjs (after registering the agent in src/mastra/index.ts)
import { mastra } from './src/mastra/index.ts'

const agent = mastra.getAgentById('weather-agent')
const response = await agent.generate('Weather in SF')
console.log(response.text)

Nguồn hướng dẫn bắt đầu nhanh

Tính năng

Mọi modelCóChuỗi định tuyến model theo định dạng provider/model
MCP clientCó
MCP serverCóMCPServer cung cấp agent, tool, workflow, prompt và resource
Đa agentCóAgent có thể hoạt động như tool cho các agent khác
Lượt chạy bền vữngCóTạm dừng và tiếp tục với snapshot lưu trong libSQL, Postgres và các hệ quản trị khác
Phê duyệt của con ngườiCósuspend() và resume() thu thập thông tin đầu vào từ con người
TracingCóCác OTel exporter gửi dữ liệu đến Langfuse, Braintrust, Datadog và LangSmith
EvalsCóScorer chạy trực tiếp với sampling hoặc chạy ngoại tuyến trong CI

Các thay đổi gần đây

  • npm create mastra hiện khởi tạo harness đa dụng với workspace, shell tool, memory và lịch chạy.
  • Mastra Factory hướng đến các software factory được xây dựng bằng coding agent.

Các lựa chọn thay thế cùng ngôn ngữ

Nguồn

  1. mastra.ai/docs
  2. mastra.ai/docs/connections/mcp
  3. mastra.ai/reference/tools/mcp-server
  4. mastra.ai/docs/workflows/suspend-and-resume
  5. mastra.ai/docs/workflows/snapshots
  6. mastra.ai/ai-agent-observability
  7. github.com/mastra-ai/mastra/blob/main/LICENSE.md
  8. registry.npmjs.org/@mastra%2fcore