Mastra CLI

1.6.0 · active · verified Sat Apr 18

The `mastra` package provides the command-line interface (CLI) for the Mastra AI platform, enabling development, deployment, and management of AI agents, LLMs, and related services. It is currently at version 1.6.0. While the CLI itself might have a slower release pace, its core library (`@mastra/core`), which it depends on, is under active and rapid development, seeing multiple releases per month, indicating a quickly evolving ecosystem of features.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates initializing an agent with @mastra/core and how to use the 'mastra' CLI to deploy it. Note: replace 'gpt-4o' with a valid model.

import { Agent } from '@mastra/core';

const agent = new Agent({ name: 'MyFirstAgent', model: 'gpt-4o' });

// To run a command via the CLI (most common usage):
// npx mastra deploy MyFirstAgent --env production

view raw JSON →