dotsagent.io
言語:日本語
Framework · Mastra

Mastra の概要

エージェント、一時停止・再開に対応したワークフロー、メモリ、評価機能、Studio UIを1つのパッケージにまとめたTypeScriptフレームワークです。Next.js、Express、Honoのアプリに組み込めます。コア部分はApache-2.0ライセンスですが、ee/ディレクトリはエンタープライズライセンスです。

おすすめの用途: エージェント、ワークフロー、メモリ、評価機能を単一のスタックにまとめたいTypeScriptチーム。

基本情報

メンテナー
Mastra
言語
TypeScript
ライセンス
Apache-2.0 (core)
最新バージョン
@mastra/core 1.73.0 · 2026年10月1日
リポジトリ
mastra-ai/mastra · 28,467 スター
ホスティング विकल्प
Mastra Cloud / Mastra Platform
mastra deployでDockerイメージをビルドしてデプロイします。

クイックスタート

パッケージをインストールして認証情報を設定し、公式ドキュメントにある最小構成のエージェントを実行します。モデル ID はドキュメントで使われているものです。アカウントで有効になっていない場合があります。

インストール
npm install @mastra/core@latest zod@latest typescript@latest @types/node@latest mastra@latest  (or scaffold: npm create mastra@latest)

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)

クイックスタートの参照元

機能

任意のモデルはいprovider/model形式のモデルルーター文字列に対応
MCPクライアントはい
MCPサーバーはいMCPServerでエージェント、ツール、ワークフロー、プロンプト、リソースを公開
マルチエージェントはいエージェントを別のエージェントのツールとして利用可能
耐久性のある実行はいlibSQL、Postgresなどにスナップショットを保存して一時停止・再開
人による承認はいsuspend()とresume()で人間からの入力を受け付け
トレーシングはいLangfuse、Braintrust、Datadog、LangSmith向けのOTelエクスポーター
Evalsはいサンプリングを使った実行時評価と、CIでのオフライン評価に対応

最近の変更

  • npm create mastraで、ワークスペース、シェルツール、メモリ、スケジュールを備えた汎用ハーネスを生成できるようになりました。
  • Mastra Factoryは、コーディングエージェントで構成するソフトウェアファクトリーを対象としています。

同じ言語の代替ツール

参照元

  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