mastra-studio-editor
Skill2 starsChanged 29 days agoApache-2.0View on GitHub
Run, secure, and deploy Mastra Studio, the local and hosted UI for chatting with agents, running workflows and tools, reviewing traces, logs, metrics, scores, datasets, experiments, and knowledge, and set up the Mastra Editor so non-developers can change agent instructions, tools, and prompt blocks with drafts, publishing, and version selection. Use this skill whenever the user wants to open or configure Studio, put Studio behind login or RBAC, host Studio standalone or alongside the server, let a team edit prompts without a deploy, reuse prompt blocks, or pin agents to a draft or published version. Triggers on mastra dev, localhost:4111, mastra studio, mastra build --studio, MASTRA_STUDIO_PATH, Studio auth, StaticRBACProvider, @mastra/editor, MastraEditor, mastra.getEditor, prompt blocks, prompt_block_ref, editor field on Agent, ComposioToolProvider, getAgentById status draft, KNOWLEDGE_ROUTES. Also triggers when a product or support team wants to tune an agent without touching code.
- Reads credentials
- Installs packages
In this repository46 other files it gives its agents.
- mastra-a2a-acpSkill
- mastra-agent-approval-hitlSkill
- mastra-agentic-uiSkill
- mastra-agent-skillsSkill
- mastra-agentsSkill
- mastra-authSkill
- mastra-browserSkill
- mastra-build-playbookSkill
- mastra-channelsSkill
- mastra-classifierSkill
- mastra-cli-apiSkill
- mastra-client-sdkSkill
- mastra-datasets-experimentsSkill
- mastra-deploymentSkill
- mastra-evalsSkill
- mastra-file-based-agentsSkill
- mastra-framework-integrationSkill
- mastra-guideSkill
- mastra-harnessSkill
- mastra-knowledgeSkill
- mastra-mcpSkill
- mastra-memorySkill
- mastra-migrationsSkill
- mastra-modelsSkill
- mastra-multi-agentSkill
- mastra-observabilitySkill
- mastra-observational-memorySkill
- mastra-platformSkill
- mastra-processors-guardrailsSkill
- mastra-project-setupSkill
- mastra-ragSkill
- mastra-schedulesSkill
- mastra-semantic-recallSkill
- mastra-serverSkill
- mastra-signalsSkill
- mastra-storageSkill
- mastra-streamingSkill
- mastra-structured-outputSkill
- mastra-tool-integrationsSkill
- mastra-toolsSkill
- mastra-troubleshootingSkill
- mastra-vector-storesSkill
- mastra-voiceSkill
- mastra-workflowsSkill
- mastra-workflow-suspend-resumeSkill
- mastra-workspace-sandboxSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 1 is distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 14
Use Studio to build, test, and observe a Mastra app, secure and deploy it for a team, and add the Editor so collaborators can change agents …
- Very specific: line 99
Verify the API: If node_modules/@mastra/ exists, read node_modules/@mastra/editor/dist/docs/, node_modules/@mastra/core/dist/docs/, and the …
- Very specific: line 145
Model editing on a function-valued model: Not supported. Use a static array with stable ids.
- Very specific: line 146
Knowledge page says browsing is not enabled: Add server: { apiRoutes: [...KNOWLEDGE_ROUTES] } and register knowledge on Mastra.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Mastra Studio and Editor
Use Studio to build, test, and observe a Mastra app, secure and deploy it for a team, and add the Editor so collaborators can change agents without code.
When to use
- Starting Studio locally and knowing what each section does
- Testing agents, workflows, tools, processors, MCP servers, and request context in the UI
- Reviewing traces, logs, metrics, scores, datasets, and experiments in Studio
- Adding login, roles, or permissions to a shared Studio
- Deploying Studio standalone, alongside the server, or as a static SPA
- Enabling the Knowledge browser
- Letting non-developers edit instructions, tools, and prompt blocks with draft and publish
- Selecting a published, draft, or exact agent version per request
When NOT to use
- Configuring tracing, exporters, logging, metrics (use
mastra-observability) - Writing scorers (use
mastra-evals) or building datasets and experiments in code (usemastra-datasets-experiments) - Auth providers in depth (use
mastra-auth) - Hosted Studio on Mastra platform (use
mastra-platform) - Deploying the Mastra server itself (use
mastra-deployment) - Knowledge scopes, pages, and APIs (use
mastra-knowledge) - Defining agents in code (use
mastra-agents) or file-based agents (usemastra-file-based-agents) - Connect tool integrations (use
mastra-tool-integrations)
Required inputs
- Who uses Studio: only developers locally, or a team on a shared deployment
- Where it runs:
mastra dev, standalonemastra studio, alongside the server, a CDN, or Mastra platform - Auth provider and the roles each person needs
- For Editor: which agent fields collaborators may own (instructions, tools, tool descriptions, model)
- Where Editor changes live: database (default) or JSON files in the repo
- Which tool sources collaborators may pick from (project tools, Composio, Arcade, MCP)
The framework: Studio surfaces and Editor ownership
Studio is a React SPA talking to a Mastra server. mastra dev serves both: UI at http://localhost:4111, REST explorer at http://localhost:4111/swagger-ui.
| Section | What it does | Needs |
| Agents | Chat, switch models, tweak settings, Models panel, Editor | Registered agents |
| Workflows | Graph view, step-by-step runs, Resource ID run option | Registered workflows |
| Tools, Processors, MCP servers, Workspaces | Run tools alone, inspect processors, browse files and skills | Registered on Mastra |
| Request context | JSON or schema form that flows into instructions and tools | requestContextSchema for the form |
| Scorers, Datasets, Experiments | Score results, CSV/JSON import, version compare, experiment compare | storage, registered scorers |
| Observability | Metrics, Traces, Logs | Observability storage (metrics need DuckDB, ClickHouse, or PostgresStoreVNext) |
| Knowledge | Read-only tree, graph, page, activity, search | KNOWLEDGE_ROUTES (@mastra/core 1.81.0+) |
| Settings | Instance URL, API prefix, custom headers, theme | none |
Editor works like a CMS for code-defined agents. The agent's editor field decides ownership:
import { Agent } from '@mastra/core/agent'
import { searchOrders } from './tools/search-orders'
export const supportAgent = new Agent({
id: 'support-agent',
name: 'Support agent',
model: 'openai/gpt-6.1-sol',
tools: { searchOrders },
editor: {
instructions: true, // Studio owns instructions: omit them from code
tools: { description: true }, // collaborators only rewrite tool descriptions
},
})editor value | Collaborators can change | Code must provide |
| Omitted | Instructions, tools, tool descriptions | instructions |
false | Nothing | instructions |
{ instructions: true } | Instructions | No instructions |
{ tools: true } | Tools and descriptions | instructions, no tools |
{ tools: { description: true } } | Descriptions of code tools | instructions and the tools |
{ model: true } | A static fallback list | Static model array with stable entry ids |
Workflow
- Verify the API. If
node_modules/@mastra/exists, readnode_modules/@mastra/editor/dist/docs/,node_modules/@mastra/core/dist/docs/, and the installed types. Otherwise fetchhttps://mastra.ai/docs/studio/overview.md,https://mastra.ai/docs/studio/editor.md, andhttps://mastra.ai/reference/editor/mastra-editor.md. Trust these over memory. - Run Studio.
npm run dev(ornpx mastra dev). Change host and port throughserverinsrc/mastra/index.ts. Usemastra dev --httpsfor local HTTPS. - Register everything you want visible: agents, workflows, tools, scorers, MCP servers on
new Mastra({...}). - Add storage and observability so threads, scores, datasets, and traces persist (see
mastra-observability). - Secure before sharing. Set
server.auth(one config covers Studio and API). Addserver.rbacwithStaticRBACProvider. Production SSO, RBAC, and FGA need an EE license. - Deploy. Choose: Mastra platform,
mastra studiostandalone (port 3000),mastra build --studioplusMASTRA_STUDIO_PATH, or a Vite SPA build. - Add Editor.
npm install @mastra/editor, theneditor: new MastraEditor()with storage. Seteditoron agents to hand fields to Studio. - Expose tools to collaborators. Register project tools on
Mastra.tools, addtoolProviders(Composio, Arcade), or let them create MCP clients. - Ship changes through versions. Save drafts, test, publish. Select versions in code with
mastra.getAgentById(id, { status | versionId }). - Script changes with
mastra.getEditor()when bulk edits or eval-driven tuning are needed.
Deep dive: versions and prompt blocks
const live = await mastra.getAgentById('support-agent', { status: 'published' })
const draft = await mastra.getAgentById('support-agent', { status: 'draft' })
const pinned = await mastra.getAgentById('support-agent', { versionId: 'abc-123' })
const editor = mastra.getEditor()!
await editor.prompt.create({
id: 'brand-voice',
name: 'Brand voice',
content: 'Write in a friendly, concise tone. Address the user as {{userName || "there"}}.',
})
await editor.agent.update({
id: 'support-agent',
instructions: [
{ type: 'prompt_block_ref', id: 'brand-voice' },
{ type: 'text', content: 'Answer only questions about Acme products.' },
],
}) // creates an inactive draftupdate() never publishes by itself. Publish with editor.agent.update({ id, status: 'published', activeVersionId }), or PATCH /api/stored/agents/:id with autoPublish: true. Referenced prompt blocks resolve to their published version at runtime and to drafts in previews.
Failure patterns
- Studio left public. Without
server.auth, Studio and every API route are open. Add auth before deploying. - Agent fails with Studio-owned instructions.
editor.instructions: truefails closed until a version with instructions is published. Publish one in Studio first. - TypeScript error on
instructionsortools. The field is handed to Studio. Remove it from code. - Editor edit not visible in production. It is still a draft. Publish, or request
status: 'draft'on purpose. - Expecting Models panel edits to persist. Without
editor: { model: true }they change only the running server's memory. - Model editing on a function-valued model. Not supported. Use a static array with stable
ids. - Knowledge page says browsing is not enabled. Add
server: { apiRoutes: [...KNOWLEDGE_ROUTES] }and registerknowledgeonMastra. - Knowledge returns 403 with auth. Set
MASTRA_KNOWLEDGE_PRINCIPALS_KEYinauthorizefor/api/knowledgepaths, and keep the app's decision for other paths. - Studio under a subpath shows a blank page. Set
MASTRA_STUDIO_BASE_PATHbeforemastra studio. - Copying built Studio assets straight to a CDN. They need runtime config. Use the Vite SPA build with
%%PLACEHOLDER%%replacement. auth_headerURL tokens in logs. The token rides in the URL. Generate and transmit those links carefully.- No metrics or token columns. The observability store lacks metrics support (see
mastra-observability).
Output format
A finished Studio or Editor delivery contains:
- Updated
src/mastra/index.tswithserver.auth, optionalserver.rbac,storage, andeditor: new MastraEditor({...}) - Agents with an explicit
editorfield stating what collaborators own - Deployment instructions for the chosen mode, with env vars (
MASTRA_STUDIO_PATH,MASTRA_STUDIO_BASE_PATH, provider keys) - Tool provider keys (
COMPOSIO_API_KEY,ARCADE_API_KEY) in.env.example - A release note on how drafts are tested and who publishes
Reference files
references/api.md- Studio sections, auth and RBAC, deployment env vars,MastraEditoroptions and namespaces, prompt blocks, versioning, REST routes.references/examples.md- Team Studio with RBAC, Studio with the server, Editor with repo files, prompt block fallback, sub-agent versions.references/checklist.md- Studio deployment and Editor rollout checklist.
Live docs
- https://mastra.ai/docs/studio/overview
- https://mastra.ai/docs/studio/auth
- https://mastra.ai/docs/studio/deployment
- https://mastra.ai/docs/studio/observability
- https://mastra.ai/docs/studio/knowledge
- https://mastra.ai/docs/studio/editor
- https://mastra.ai/reference/editor/mastra-editor
- https://mastra.ai/reference/editor/prompt-blocks
- https://mastra.ai/reference/editor/versioning
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

