เฟรมเวิร์ก · Mastra
ภาพรวม Mastra
เฟรมเวิร์ก TypeScript ที่รวม agents, workflows ซึ่งหยุดและทำงานต่อได้, memory, evals และ UI ของ Studio ไว้ในแพ็กเกจเดียว ใช้ร่วมกับแอป Next.js, Express หรือ Hono ได้ทันที โดย core ใช้สัญญาอนุญาต Apache-2.0 ส่วนไดเรกทอรี ee/ ใช้สัญญาอนุญาตสำหรับองค์กร
เหมาะสำหรับ: ทีม TypeScript ที่ต้องการ stack เดียวสำหรับ agents, workflows, memory และ evals
ข้อมูลสำคัญ
- ผู้ดูแล
- Mastra
- ภาษา
- TypeScript
- ไลเซนส์
- Apache-2.0 (core)
- เวอร์ชันล่าสุด
@mastra/core 1.73.0· 1 ตุลาคม 2569- Repository
- mastra-ai/mastra
- ตัวเลือกแบบโฮสต์
- Mastra Cloud / Mastra Platform
Quickstart
ติดตั้งแพ็กเกจ ตั้งค่าข้อมูลรับรอง แล้วเรียกใช้ agent ตัวอย่างที่เล็กที่สุดจากเอกสารทางการ Model ID เป็นค่าที่เอกสารใช้ และอาจยังไม่ได้เปิดใช้งานในบัญชีของคุณ
npm install @mastra/core@latest zod@latest typescript@latest @types/node@latest mastra@latest (or scaffold: npm create mastra@latest)// 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)ฟีเจอร์
| ใช้ได้กับทุกโมเดล | ใช่ | ระบุโมเดลเป็น string ในรูปแบบ provider/model |
|---|---|---|
| MCP client | ใช่ | |
| MCP server | ใช่ | MCPServer เปิดให้ใช้งาน agents, tools, workflows, prompts และ resources |
| หลาย agent | ใช่ | เอเจนต์สามารถทำหน้าที่เป็น tools ให้เอเจนต์อื่นได้ |
| การทำงานต่อเนื่องแบบทนทาน | ใช่ | หยุดและทำงานต่อได้ โดยบันทึก snapshots ใน libSQL, Postgres และฐานข้อมูลอื่น ๆ |
| การอนุมัติโดยมนุษย์ | ใช่ | suspend() และ resume() ใช้รับข้อมูลจากมนุษย์ |
| Tracing | ใช่ | ส่งออกข้อมูลผ่าน OTel ไปยัง Langfuse, Braintrust, Datadog และ LangSmith |
| Evals | ใช่ | Scorers ทำงานระหว่างรันโดยสุ่มตัวอย่าง หรือทำงานแบบออฟไลน์ใน CI ได้ |
การเปลี่ยนแปลงล่าสุด
- npm create mastra สร้าง harness สำหรับใช้งานทั่วไป พร้อม workspace, shell tools, memory และ schedules
- Mastra Factory ออกแบบมาสำหรับ software factory ที่สร้างจาก coding agents