Mastra.getEditor()
.getEditor() 方法用於取得 Mastra 執行個體中已設定的 Editor 執行個體。Editor 提供 CRUD 命名空間,可透過程式化方式管理已儲存的 Agent、prompt block、MCP client、Scorer、Skill 和 Workspace。
使用範例「使用範例」的直接連結
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.',
})
參數「參數」的直接連結
此方法不接受任何參數。
傳回值「傳回值」的直接連結
editor:
MastraEditor | undefined
已設定的 editor 執行個體;如果未設定 editor,則為 undefined。