Interface: MastraAgentDefinition
A code-defined Mastra agent. Mirrors the shape AppKit’s agents
plugin uses for AgentDefinition. The registry key under
config.agents is the agentId the client streams against; name
is purely informational (defaults to the key).
Properties
Section titled “Properties”description?
Section titled “description?”
optionaldescription?:string
Optional long-form description; surfaced as Agent.description.
instructions
Section titled “instructions”instructions:
string
System prompt body.
memory?
Section titled “memory?”
optionalmemory?:boolean|MastraMemoryConfigOverride
Per-agent semantic recall (PgVector) override. Cascades from
config.memory; the agent value wins when set.
undefined(default): inheritconfig.memory. When that’s enabled, the agent shares the plugin-level singletonPgVectorinstance (cross-agent semantic recall across the same index).false: disable semantic recall for this agent only.true: enable using the shared singleton (same as default when plugin memory is enabled; useful to opt in when plugin disabled).- MastraMemoryConfig object: dedicated
PgVectorfor this agent (private recall index). Bypasses the shared singleton.
model?
Section titled “model?”
optionalmodel?:string|LanguageModelV1|LanguageModelV2|LanguageModelV3|LanguageModelV4|string&object| {apiKey?:string;headers?:Record<string,string>;id:`${string}/${string}`;url?:string; } | {apiKey?:string;headers?:Record<string,string>;modelId:string;providerId:string;url?:string; } |MastraLanguageModelV2|MastraLanguageModelV3|MastraLanguageModelV4|ModelWithRetries[] | ((__namedParameters) =>MastraModelConfig|ModelWithRetries[] |Promise<MastraModelConfig | ModelWithRetries[]>)
Per-agent model override.
undefined(default): falls back to the workspace/serving-endpointsresolver that buildModel configures from the per-requestWorkspaceClient.string: shorthand for “use the default resolver but swap themodelId” (e.g."databricks-meta-llama-3-3-70b-instruct").- Any other Mastra
DynamicArgument<MastraModelConfig>: passed straight through toAgent.model. Use this when you need full control over auth or providerId.
optionalname?:string
Display name used as Agent.name. Defaults to the registry key.
storage?
Section titled “storage?”
optionalstorage?:boolean|MastraStorageConfigOverride
Per-agent thread/message storage (PostgresStore) override.
Cascades from config.storage; the agent value wins when set.
undefined(default): inheritconfig.storage. When that’s enabled, the agent gets its own per-agentPostgresStorekeyed by agentStorageSchemaName so threads and messages stay isolated between agents in the same database.false: disable storage for this agent only (purely in-memory).true: enable with the per-agent default schema.- MastraStorageConfigOverride object: dedicated
PostgresStoreconfig (custom schema, connection, etc.).
tools?
Section titled “tools?”
optionaltools?:ToolsInput|MastraToolsFn
Per-agent tool record. Either a plain map or a callback that receives the typed MastraPlugins sibling-plugin index and returns a map. The callback runs exactly once at agent setup; the result is cached for the agent’s lifetime.
workspace?
Section titled “workspace?”
optionalworkspace?:MastraAgentWorkspaceResolver|Workspace<WorkspaceFilesystem|undefined,WorkspaceSandbox|undefined,undefined>
Mastra Workspace for this agent (filesystem, sandbox, or other providers). Assistant skills from Databricks workspace paths are wired via createWorkspace.