Framework · Mastra
Mastra in breve
Un framework TypeScript che riunisce agenti, workflow con sospensione e ripresa, memoria, eval e interfaccia Studio in un unico pacchetto. Si integra con le app Next.js, Express o Hono; il core è distribuito con licenza Apache-2.0, mentre le directory ee/ usano una licenza enterprise.
Ideale per: Team TypeScript che vogliono un unico stack per agenti, workflow, memoria ed eval.
Informazioni principali
- Responsabile
- Mastra
- Linguaggi
- TypeScript
- Licenza
- Apache-2.0 (core)
- Ultima versione
@mastra/core 1.73.0· 1 ottobre 2026- Repository
- mastra-ai/mastra
- Opzione hosted
- Mastra Cloud / Mastra Platform
Guida rapida
Installa il pacchetto, configura le credenziali, quindi esegui l'agente più semplice indicato nella documentazione ufficiale. Gli ID dei modelli sono quelli usati nella documentazione e potrebbero non essere abilitati per il tuo account.
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)Funzionalità
| Qualsiasi modello | Sì | Stringhe del router dei modelli nel formato provider/model |
|---|---|---|
| Client MCP | Sì | |
| Server MCP | Sì | MCPServer espone agenti, strumenti, workflow, prompt e risorse |
| Multi-agent | Sì | Gli agenti possono fungere da strumenti per altri agenti |
| Esecuzioni durevoli | Sì | Sospensione e ripresa con snapshot in libSQL, Postgres e altri database |
| Approvazione umana | Sì | suspend() e resume() raccolgono input da una persona |
| Tracing | Sì | Exporter OTel per Langfuse, Braintrust, Datadog e LangSmith |
| Valutazioni | Sì | Gli scorer vengono eseguiti in tempo reale con campionamento o offline in CI |
Modifiche recenti
- npm create mastra crea ora lo scheletro di un harness generico con workspace, strumenti shell, memoria e pianificazioni.
- Mastra Factory è pensato per le software factory basate su agenti di coding.