docs/src/content/en/guides/getting-started/quickstart.mdx
import Steps from "@site/src/components/Steps"; import StepItem from "@site/src/components/StepItem"; import { VideoPlayer } from "@site/src/components/video-player";
The create mastra CLI command is the quickest way to get started. It walks you through setup and creates example agents, workflows, and tools for you to run locally or adapt.
If you need more control over the setup, see the manual installation guide. You can also use mastra init for existing projects.
You can run create mastra anywhere on your machine.
When prompted, choose a provider (e.g. OpenAI) and enter your key:
npm create mastra@latest
This creates a new directory for your project with a src/mastra folder containing an example weather agent and the following files:
index.ts: Entry point for all Mastra-related code and configurationagents/weather-agent.ts: A weather agent with a prompt that uses the tooltools/weather-tool.ts: A tool to fetch weather for a given locationworkflows/weather-workflow.ts: A workflow that runs the weather agentscorers/weather-scorer.ts: A scorer to evaluate the weather agent's responsesDepending on your choices, you'll also end up with Mastra Skills or the MCP Docs Server installed.
:::tip
You can use flags with create mastra like --no-example to skip the example weather agent or --template to start from a specific template.
:::
Once setup is complete, follow the instructions in your terminal to start the Mastra dev server, then open Studio at localhost:4111.
Try asking about the weather. If your API key is set up correctly, you'll get a response:
<VideoPlayer src="https://res.cloudinary.com/mastra-assets/video/upload/v1751406022/local-dev-agents-playground_100_m3begx.mp4" />
Studio lets you rapidly build and prototype agents without needing to build a UI. Once you're ready, you can integrate your Mastra agent into your app using the guides below.