Mastra.getEditor()
The .getEditor() method is used to retrieve the editor instance that has been configured on the Mastra instance. The editor exposes CRUD namespaces for managing stored agents, prompt blocks, MCP clients, scorers, skills, and workspaces programmatically.
Usage exampleUsage example的直接链接
import { Mastra } from '@mastra/core'
import { MastraEditor } from '@mastra/editor'
const mastra = new Mastra({
editor: new MastraEditor(),
})
const editor = mastra.getEditor()
const agent = await editor?.agent.create({
id: 'support-agent',
name: 'Support Agent',
instructions: 'Help customers with their questions.',
})
ParametersParameters的直接链接
This method doesn't accept any parameters.
ReturnsReturns的直接链接
editor:
MastraEditor | undefined
The configured editor instance, or undefined if no editor has been configured.