mastra

Guides Mastra agent, workflow, memory, and streaming development with version-matched official documentation.

1|Updated Sep 15, 2026
One-click install
npx skills add https://github.com/amoai-tech/mdeai --skill mastra-amoai-tech
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: mastra
Source: https://github.com/amoai-tech/mdeai/tree/main/.claude/skills/mastra
Command: npx skills add https://github.com/amoai-tech/mdeai --skill mastra-amoai-tech

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Working with the Mastra framework across beta versions means APIs change frequently, and relying on remembered or outdated documentation causes type errors, broken agents, and failed workflows. This Skill routes every Mastra task to version-accurate sources—installed package docs, embedded docs, and official references—before any code change. ## Core Features & Use Cases - Version-matched doc resolution: Enforces a source order that inspects installed @mastra/* packages and embedded docs before falling back to remote mastra.ai documentation. - Domain coverage: Owns agents, tools, workflows, memory/storage, streaming, RequestContext, suspend/resume, HITL, evals, traces, and the Mastra-side CopilotKit integration. - MDE project invariants: Preserves tenant/user/request context, stable tool-map keys, durable storage for resumable workflows, and S3/S4 verification contracts for persistence and replay paths. - Use Case: When a Mastra workflow fails to resume after suspension, the Skill directs you to reproduce the failure, consult the official suspend/resume reference, apply the smallest version-compatible fix, and verify retry/replay behavior. ## Quick Start Ask the assistant to diagnose why your Mastra workflow suspend/resume is failing and have it verify the fix against the installed @mastra/core version.

Frequently Asked Questions about mastra

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix a Mastra workflow that fails to resume after suspend?

Reproduce the failure first, then consult the official suspend-and-resume reference matched to your installed @mastra/core version. Ensure the workflow uses durable storage rather than ephemeral process state, and verify resumeData matches the declared resumeSchema.

How do I create a tool in Mastra with createTool?

Define the tool with createTool using an id, description, Zod inputSchema, and an execute function, then register it on the Mastra instance and assign it to the agent. Tool IDs must match between registration and agent assignment or the agent will not call them.

Why does my Mastra agent not remember previous messages?

Agent memory requires a configured storage backend such as PostgresStore, a Memory instance assigned to the agent, and a consistent threadId and resourceId passed on every call. Without storage, conversation history is lost between invocations.

Does Mastra work with CopilotKit in a Next.js app?

Yes, Mastra integrates with CopilotKit either as a standalone server using registerCopilotKit from @ag-ui/mastra, or embedded in Next.js API routes. When deploying a bundled server, add @copilotkit/runtime to bundler externals to avoid 500 errors.

What model format does Mastra expect for agents?

Mastra expects the provider/model format such as google/gemini-2.5-pro or openai/gpt-5.4, not bare model names. Verify model and provider identifiers with the official provider-registry helper when changing model selection.

Why do I get 'Property does not exist on type Agent' errors in Mastra?

These errors usually mean your code relies on outdated API knowledge that mismatches the installed package version. Check the embedded docs under node_modules/@mastra/core/dist/docs and confirm all @mastra packages share the same version.