Skip to content

Class: MastraPluginClient

@mastra/client-js MastraClient extended with the Mastra plugin’s custom routes. One client drives everything the chat UI needs:

  • Conversation streaming through Mastra’s official AI SDK chatRoute and the browser-native AI SDK DefaultChatTransport.
  • Native Mastra memory history and thread management, plus the model catalogue (models), Genie starter prompts (suggestions), MLflow feedback logging (feedback), and inline embed resolution (chart / statement) over the plugin’s own routes - all derived from basePath + routes.MASTRA_ROUTES.

Built from the plugin’s published clientConfig() payload (MastraClientConfig). credentials: "include" is set once at construction so the session cookie (which pins the server-side thread id) travels with every request, streaming included.

  • MastraClient

new MastraPluginClient(config): MastraPluginClient

string[] = ...

boolean = ...

string = ...

boolean = ...

string = ...

boolean = ...

MastraPluginClient

MastraClient.constructor

readonly agents: readonly string[]

Registered agent ids, surfaced for pickers.


protected readonly apiPrefix: string

MastraClient.apiPrefix


readonly backgroundTurns: boolean

Whether turns continue server-side after the initiating stream disconnects.


readonly basePath: string

Plugin mount prefix (/api/<plugin-name>); all custom routes derive from it.


readonly channels: Channels

MastraClient.channels


readonly chatAlwaysAvailable: boolean

Whether the agents run their Databricks calls as the app service principal rather than on-behalf-of the signed-in user. When true the chat works for any caller who can open the app, so a UI that hides chat when the OBO token is absent should show it regardless. false (the default "user" identity mode) keeps the OBO-gated behavior.


readonly conversations: Conversations

MastraClient.conversations


readonly defaultAgent: string

Agent the bare (un-suffixed) routes resolve to.


readonly feedbackEnabled: boolean

Whether the server can log feedback to MLflow. When false, the chat UI hides thumbs / comment controls and feedback would be rejected server-side, so callers gate on this before offering feedback affordances.


readonly options: ClientOptions

MastraClient.options


readonly responses: Responses

MastraClient.responses

abortAgentRun(params): Promise<boolean>

Explicitly stop one background agent run on the server.

string

string

AbortSignal

string

Promise<boolean>


addDatasetItem(params): Promise<{ createdAt: string; datasetId: string; datasetVersion: number; expectedTrajectory?: unknown; externalId?: string | null; groundTruth?: unknown; id: string; input: unknown; metadata?: {[key: string]: unknown; } | null; requestContext?: {[key: string]: unknown; } | null; scorerIds?: string[] | null; source?: { referenceId?: string; type: "csv" | "json" | "trace" | "llm" | "experiment-result" | "candidate-screener"; } | null; toolMocks?: object[] | null; unmockedToolPolicy?: "allow" | "deny" | null; updatedAt: string; }>

Adds an item to a dataset

AddDatasetItemParams

Promise<{ createdAt: string; datasetId: string; datasetVersion: number; expectedTrajectory?: unknown; externalId?: string | null; groundTruth?: unknown; id: string; input: unknown; metadata?: {[key: string]: unknown; } | null; requestContext?: {[key: string]: unknown; } | null; scorerIds?: string[] | null; source?: { referenceId?: string; type: "csv" | "json" | "trace" | "llm" | "experiment-result" | "candidate-screener"; } | null; toolMocks?: object[] | null; unmockedToolPolicy?: "allow" | "deny" | null; updatedAt: string; }>

MastraClient.addDatasetItem


approveToolCallStream(agentId, params): Promise<MastraStreamResponse>

Resume a suspended requireApproval tool through the same official chat route using Mastra’s native resumeData contract.

string

MastraRequestContextSnapshot

string

AbortSignal

string

string

Promise<MastraStreamResponse>


awaitBufferStatus(params): Promise<{ record: { activeObservations: string; bufferedObservationChunks?: object[]; bufferedObservations?: string; bufferedReflection?: string; config: {[key: string]: unknown; }; createdAt: string; generationCount: number; id: string; isObserving: boolean; isReflecting: boolean; lastObservedAt?: string; metadata?: {[key: string]: unknown; }; observationTokenCount: number; originType: "initial" | "observation" | "reflection"; pendingMessageTokens: number; resourceId: string; scope: "thread" | "resource"; threadId: string | null; totalTokensObserved: number; updatedAt: string; } | null; }>

Blocks until any in-flight observational memory buffering completes, then returns the updated record

AwaitBufferStatusParams

Parameters containing agentId, resourceId, threadId

Promise<{ record: { activeObservations: string; bufferedObservationChunks?: object[]; bufferedObservations?: string; bufferedReflection?: string; config: {[key: string]: unknown; }; createdAt: string; generationCount: number; id: string; isObserving: boolean; isReflecting: boolean; lastObservedAt?: string; metadata?: {[key: string]: unknown; }; observationTokenCount: number; originType: "initial" | "observation" | "reflection"; pendingMessageTokens: number; resourceId: string; scope: "thread" | "resource"; threadId: string | null; totalTokensObserved: number; updatedAt: string; } | null; }>

Promise containing the updated OM record after buffering completes

MastraClient.awaitBufferStatus


batchDeleteDatasetItems(params): Promise<{ deletedCount: number; success: boolean; }>

Batch deletes items from a dataset

BatchDeleteDatasetItemsParams

Promise<{ deletedCount: number; success: boolean; }>

MastraClient.batchDeleteDatasetItems


batchInsertDatasetItems(params): Promise<{ count: number; items: object[]; }>

Batch inserts items to a dataset

BatchInsertDatasetItemsParams

Promise<{ count: number; items: object[]; }>

MastraClient.batchInsertDatasetItems


chart(id, signal?): Promise<{ chartId: string; error?: string; result?: { chartType: "custom" | "bar" | "horizontalBar" | "line" | "area" | "combo" | "waterfall" | "scatter" | "heatmap" | "radar" | "pie" | "funnel" | "treemap"; option: Record<string, unknown>; }; } | undefined>

Resolve a [chart:<id>] marker from GET ${basePath}/embed/chart/:id. The chart planner runs in the background, so the server long-polls the cache and returns the settled entry in one response. A 404 (unknown / expired id) resolves to undefined so the slot renders nothing.

string

AbortSignal

Promise<{ chartId: string; error?: string; result?: { chartType: "custom" | "bar" | "horizontalBar" | "line" | "area" | "combo" | "waterfall" | "scatter" | "heatmap" | "radar" | "pie" | "funnel" | "treemap"; option: Record<string, unknown>; }; } | undefined>


clearHistory(options): Promise<void>

Delete one native memory thread so the same id can start cleanly.

string

AbortSignal

string

Promise<void>


clusterFailures(params): Promise<{ clusters: object[]; proposedTags?: object[]; }>

Cluster experiment failures using AI to identify common failure patterns.

PostDatasetsClusterFailures_Body

Promise<{ clusters: object[]; proposedTags?: object[]; }>

MastraClient.clusterFailures


compareExperiments(params): Promise<{ baselineId: string; items: object[]; }>

Compares two dataset experiments for regression detection

CompareExperimentsParams

Promise<{ baselineId: string; items: object[]; }>

MastraClient.compareExperiments


createDataset(params): Promise<{ createdAt: string; description?: string | null; groundTruthSchema?: {[key: string]: unknown; }; id: string; inputSchema?: {[key: string]: unknown; }; metadata?: {[key: string]: unknown; } | null; name: string; requestContextSchema?: {[key: string]: unknown; }; scorerIds?: string[] | null; tags?: string[] | null; targetIds?: string[] | null; targetType?: string | null; updatedAt: string; version: number; }>

Creates a new dataset

CreateDatasetParams

Promise<{ createdAt: string; description?: string | null; groundTruthSchema?: {[key: string]: unknown; }; id: string; inputSchema?: {[key: string]: unknown; }; metadata?: {[key: string]: unknown; } | null; name: string; requestContextSchema?: {[key: string]: unknown; }; scorerIds?: string[] | null; tags?: string[] | null; targetIds?: string[] | null; targetType?: string | null; updatedAt: string; version: number; }>

MastraClient.createDataset


createDatasetExperiment(params): Promise<{ completedAt: string | null; datasetVersion?: number; experimentId: string; failedCount: number; results: object[]; startedAt: string | null; status: "running" | "pending" | "completed" | "failed"; succeededCount: number; totalItems: number; }>

Creates an experiment without starting the in-process runner, so the caller drives the loop (e.g. a Temporal workflow). With a target, execute items server-side via runExperimentItem; without one, ingest results via submitExperimentResult. Idempotent when a caller-supplied id is provided.

CreateDatasetExperimentParams

Promise<{ completedAt: string | null; datasetVersion?: number; experimentId: string; failedCount: number; results: object[]; startedAt: string | null; status: "running" | "pending" | "completed" | "failed"; succeededCount: number; totalItems: number; }>

MastraClient.createDatasetExperiment


createFeedback(params): Promise<{ success: boolean; }>

Creates a single feedback record in the observability store.

PostObservabilityFeedback_Body

Promise<{ success: boolean; }>

MastraClient.createFeedback


createMemoryThread(params): Promise<{ createdAt: string; id: string; metadata?: {[key: string]: unknown; }; resourceId: string; title?: string; updatedAt: string; }>

Creates a new memory thread

CreateMemoryThreadParams

Parameters for creating the memory thread including optional request context

Promise<{ createdAt: string; id: string; metadata?: {[key: string]: unknown; }; resourceId: string; title?: string; updatedAt: string; }>

Promise containing the created memory thread

MastraClient.createMemoryThread


createSchedule(options): Promise<ScheduleResponse>

Creates a schedule. Pass agentId (plus prompt) to schedule an agent, or workflowId (plus optional inputData) to schedule a workflow. By default each call creates a new schedule with a random id (agent_<uuid> for agents, schedule_<uuid> for workflows) — pass id to choose a stable id instead; creating one with an id that already exists throws.

Trigger (fire) history is read through listScheduleTriggers(schedule.id).

CreateScheduleInput

Promise<ScheduleResponse>

MastraClient.createSchedule


createScore(params): Promise<{ success: boolean; }>

Creates a single score record in the observability store.

PostObservabilityScores_Body

Promise<{ success: boolean; }>

MastraClient.createScore


createStoredAgent(params): Promise<{ activeVersionId?: string; agents?: object[] | {[key: string]: object; }; author?: { avatarUrl?: string; email?: string; id: string; name?: string; }; authorId?: string; browser?: boolean | { config: { headless?: boolean; provider: string; screencast?: { everyNthFrame?: number; format?: "jpeg" | "png"; maxHeight?: number; maxWidth?: number; quality?: number; }; timeout?: number; viewport?: { height: number; width: number; }; }; type: "inline"; } | object[] | null; createdAt: string; defaultOptions?: {[key: string]: unknown; activeTools?: string[]; autoResumeSuspendedTools?: boolean; eagerToolExecution?: boolean; includeRawChunks?: boolean; maxProcessorRetries?: number; maxSteps?: number; modelSettings?: { frequencyPenalty?: number; maxRetries?: number; maxTokens?: number; presencePenalty?: number; seed?: number; stopSequences?: string[]; temperature?: number; topK?: number; topP?: number; }; requireToolApproval?: boolean; returnScorerData?: boolean; runId?: string; savePerStep?: boolean; toolCallConcurrency?: number | { limit?: number; strategy?: "available" | "called"; }; toolChoice?: "none" | "auto" | "required" | { toolName: string; type: "tool"; }; tracingOptions?: { attributes?: {[key: string]: unknown; }; spanId?: string; traceId?: string; traceName?: string; }; } | object[]; description?: string; durable?: boolean | { cleanupTimeoutMs?: number; maxSteps?: number; }; favoriteCount?: number; id: string; inputProcessors?: { steps: ({ step: { config: {[key: string]: unknown; }; enabledPhases: ("processInput" | "processInputStep" | "processOutputStream" | "processOutputResult" | "processOutputStep" | "processToolResult")[]; id: string; providerId: string; }; type: "step"; } | { branches: ({ step: …; type: …; } | { branches: …; type: …; } | { conditions: …; type: …; })[][]; type: "parallel"; } | { conditions: object[]; type: "conditional"; })[]; } | object[]; instructions: string | ({ content: string; type: "text"; } | { id: string; type: "prompt_block_ref"; } | { content: string; rules?: { conditions: ({ field: …; operator: …; value?: …; } | { conditions: …; operator: …; })[]; operator: "AND" | "OR"; }; type: "prompt_block"; })[]; integrationTools?: {[key: string]: object; } | object[]; isFavorited?: boolean; mcpClients?: {[key: string]: object; } | object[]; memory?: { embedder?: string; embedderOptions?: {[key: string]: unknown; }; observationalMemory?: boolean | { model?: string; observation?: { blockAfter?: number; bufferActivation?: number; bufferTokens?: number | false; maxTokensPerBatch?: number; messageTokens?: number; model?: string; modelSettings?: {[key: string]: unknown; }; providerOptions?: {[key: string]: … | …; }; }; reflection?: { blockAfter?: number; bufferActivation?: number; model?: string; modelSettings?: {[key: string]: unknown; }; observationTokens?: number; providerOptions?: {[key: string]: … | …; }; }; scope?: "thread" | "resource"; shareTokenBudget?: boolean; }; options?: { generateTitle?: boolean | { emitEvent?: boolean; instructions?: string; minMessages?: number; model?: string; }; lastMessages?: number | false; messageHistory?: { atMaxRemoveTokens?: number; maxTokens: number; }; readOnly?: boolean; semanticRecall?: boolean | { indexName?: string; messageRange: number | { after: number; before: number; }; scope?: "thread" | "resource"; threshold?: number; topK: number; }; }; vector?: string | false; } | object[]; metadata?: {[key: string]: unknown; }; model: {[key: string]: unknown; name: string; provider: string; } | object[]; name: string; outputProcessors?: { steps: ({ step: { config: {[key: string]: unknown; }; enabledPhases: ("processInput" | "processInputStep" | "processOutputStream" | "processOutputResult" | "processOutputStep" | "processToolResult")[]; id: string; providerId: string; }; type: "step"; } | { branches: ({ step: …; type: …; } | { branches: …; type: …; } | { conditions: …; type: …; })[][]; type: "parallel"; } | { conditions: object[]; type: "conditional"; })[]; } | object[]; requestContextSchema?: {[key: string]: unknown; }; scorers?: {[key: string]: object; } | object[]; skills?: {[key: string]: object; } | object[]; status: string; toolProviders?: {[key: string]: object; } | object[]; tools?: {[key: string]: object; } | object[]; updatedAt: string; visibility?: "public" | "private"; workflows?: object[] | {[key: string]: object; }; workspace?: { type: "id"; workspaceId: string; } | { config: { autoSync?: boolean; description?: string; filesystem?: { config: {[key: string]: unknown; }; provider: string; }; mounts?: {[key: string]: object; }; name: string; operationTimeout?: number; sandbox?: { config: {[key: string]: unknown; }; provider: string; }; search?: { autoIndexPaths?: string[]; bm25?: boolean | { b?: number; k1?: number; }; embedderConfig?: {[key: string]: unknown; }; embedderModel?: string; embedderProvider?: string; searchIndexName?: string; vectorConfig?: {[key: string]: unknown; }; vectorProvider?: string; }; skills?: string[]; tools?: { enabled?: boolean; requireApproval?: boolean; tools?: {[key: string]: object; }; }; }; type: "inline"; } | { config: {[key: string]: unknown; }; provider: string; type: "provider"; } | object[]; }>

Creates a new stored agent

Agent configuration including id, name, instructions, model, etc.

{[key: string]: object; } | object[]

Agent keys with optional per-agent config — static or conditional

string

Author identifier for multi-tenant filtering

boolean

Publish the initial version so the agent resolves at status=“published”. Defaults to true when omitted. Pass false to stage the agent as an unpublished draft — useful when overriding a code-defined agent, whose code definition keeps serving traffic until the override is published.

boolean | { config: { headless?: boolean; provider: string; screencast?: { everyNthFrame?: number; format?: "jpeg" | "png"; maxHeight?: number; maxWidth?: number; quality?: number; }; timeout?: number; viewport?: { height: number; width: number; }; }; type: "inline"; } | object[] | null

Browser configuration — object config, true (apply default), false/null (disable)

{[key: string]: unknown; activeTools?: string[]; autoResumeSuspendedTools?: boolean; eagerToolExecution?: boolean; includeRawChunks?: boolean; maxProcessorRetries?: number; maxSteps?: number; modelSettings?: { frequencyPenalty?: number; maxRetries?: number; maxTokens?: number; presencePenalty?: number; seed?: number; stopSequences?: string[]; temperature?: number; topK?: number; topP?: number; }; requireToolApproval?: boolean; returnScorerData?: boolean; runId?: string; savePerStep?: boolean; toolCallConcurrency?: number | { limit?: number; strategy?: "available" | "called"; }; toolChoice?: "none" | "auto" | "required" | { toolName: string; type: "tool"; }; tracingOptions?: { attributes?: {[key: string]: unknown; }; spanId?: string; traceId?: string; traceName?: string; }; } | object[]

Default options for generate/stream calls — static or conditional

string

Description of the agent

boolean | { cleanupTimeoutMs?: number; maxSteps?: number; }

Opt this agent into durable execution when it is hydrated. Cache and pubsub are inherited from the Mastra instance; without distributed backends durability is process-local. Does not enable automatic recovery — that stays recovery.durableAgents.

string

Unique identifier for the agent. If not provided, derived from name.

{ steps: ({ step: { config: {[key: string]: unknown; }; enabledPhases: ("processInput" | "processInputStep" | "processOutputStream" | "processOutputResult" | "processOutputStep" | "processToolResult")[]; id: string; providerId: string; }; type: "step"; } | { branches: ({ step: { config: …; enabledPhases: …; id: …; providerId: …; }; type: "step"; } | { branches: …[]; type: "parallel"; } | { conditions: …[]; type: "conditional"; })[][]; type: "parallel"; } | { conditions: object[]; type: "conditional"; })[]; } | object[]

Input processor graph — static or conditional

string | ({ content: string; type: "text"; } | { id: string; type: "prompt_block_ref"; } | { content: string; rules?: { conditions: ({ field: string; operator: InputShared_Type_31; value?: unknown; } | { conditions: …[]; operator: … | …; })[]; operator: "AND" | "OR"; }; type: "prompt_block"; })[]

System instructions for the agent (string or array of instruction blocks)

{[key: string]: object; } | object[]

Map of tool provider IDs to their tool configurations — static or conditional

object[] | {[key: string]: object; }

Map of stored MCP client IDs to their tool configurations — static or conditional

{ embedder?: string; embedderOptions?: {[key: string]: unknown; }; observationalMemory?: boolean | { model?: string; observation?: { blockAfter?: number; bufferActivation?: number; bufferTokens?: number | false; maxTokensPerBatch?: number; messageTokens?: number; model?: string; modelSettings?: {[key: string]: unknown; }; providerOptions?: {[key: string]: {[key: …]: …; } | undefined; }; }; reflection?: { blockAfter?: number; bufferActivation?: number; model?: string; modelSettings?: {[key: string]: unknown; }; observationTokens?: number; providerOptions?: {[key: string]: {[key: …]: …; } | undefined; }; }; scope?: "thread" | "resource"; shareTokenBudget?: boolean; }; options?: { generateTitle?: boolean | { emitEvent?: boolean; instructions?: string; minMessages?: number; model?: string; }; lastMessages?: number | false; messageHistory?: { atMaxRemoveTokens?: number; maxTokens: number; }; readOnly?: boolean; semanticRecall?: boolean | { indexName?: string; messageRange: number | { after: number; before: number; }; scope?: "thread" | "resource"; threshold?: number; topK: number; }; }; vector?: string | false; } | object[]

Memory configuration — static or conditional

{[key: string]: unknown; }

Additional metadata for the agent

{[key: string]: unknown; name: string; provider: string; } | object[]

Model configuration — static value or array of conditional variants. When omitted, the builder default model is applied server-side.

string

Name of the agent

{ steps: ({ step: { config: {[key: string]: unknown; }; enabledPhases: ("processInput" | "processInputStep" | "processOutputStream" | "processOutputResult" | "processOutputStep" | "processToolResult")[]; id: string; providerId: string; }; type: "step"; } | { branches: ({ step: { config: …; enabledPhases: …; id: …; providerId: …; }; type: "step"; } | { branches: …[]; type: "parallel"; } | { conditions: …[]; type: "conditional"; })[][]; type: "parallel"; } | { conditions: object[]; type: "conditional"; })[]; } | object[]

Output processor graph — static or conditional

{[key: string]: unknown; }

JSON Schema defining valid request context variables for conditional rule evaluation

{[key: string]: object; } | object[]

Scorer keys with optional sampling config — static or conditional

{[key: string]: object; } | object[]

Skill IDs mapped to per-skill config — static or conditional

{[key: string]: object; } | object[]

Tool provider connections and per-tool config (provider-agnostic). Coexists with the deprecated integrationTools field.

{[key: string]: object; } | object[]

Tool keys mapped to per-tool config — static or conditional

"public" | "private"

Agent visibility: private (owner/admin only) or public (any reader)

{[key: string]: object; } | object[]

Workflow keys with optional per-workflow config — static or conditional

{ type: "id"; workspaceId: string; } | { config: { autoSync?: boolean; description?: string; filesystem?: { config: {[key: string]: unknown; }; provider: string; }; mounts?: {[key: string]: object; }; name: string; operationTimeout?: number; sandbox?: { config: {[key: string]: unknown; }; provider: string; }; search?: { autoIndexPaths?: string[]; bm25?: boolean | { b?: number; k1?: number; }; embedderConfig?: {[key: string]: unknown; }; embedderModel?: string; embedderProvider?: string; searchIndexName?: string; vectorConfig?: {[key: string]: unknown; }; vectorProvider?: string; }; skills?: string[]; tools?: { enabled?: boolean; requireApproval?: boolean; tools?: {[key: string]: object; }; }; }; type: "inline"; } | { config: {[key: string]: unknown; }; provider: string; type: "provider"; } | object[]

Workspace reference (stored ID or inline config) — static or conditional

Promise<{ activeVersionId?: string; agents?: object[] | {[key: string]: object; }; author?: { avatarUrl?: string; email?: string; id: string; name?: string; }; authorId?: string; browser?: boolean | { config: { headless?: boolean; provider: string; screencast?: { everyNthFrame?: number; format?: "jpeg" | "png"; maxHeight?: number; maxWidth?: number; quality?: number; }; timeout?: number; viewport?: { height: number; width: number; }; }; type: "inline"; } | object[] | null; createdAt: string; defaultOptions?: {[key: string]: unknown; activeTools?: string[]; autoResumeSuspendedTools?: boolean; eagerToolExecution?: boolean; includeRawChunks?: boolean; maxProcessorRetries?: number; maxSteps?: number; modelSettings?: { frequencyPenalty?: number; maxRetries?: number; maxTokens?: number; presencePenalty?: number; seed?: number; stopSequences?: string[]; temperature?: number; topK?: number; topP?: number; }; requireToolApproval?: boolean; returnScorerData?: boolean; runId?: string; savePerStep?: boolean; toolCallConcurrency?: number | { limit?: number; strategy?: "available" | "called"; }; toolChoice?: "none" | "auto" | "required" | { toolName: string; type: "tool"; }; tracingOptions?: { attributes?: {[key: string]: unknown; }; spanId?: string; traceId?: string; traceName?: string; }; } | object[]; description?: string; durable?: boolean | { cleanupTimeoutMs?: number; maxSteps?: number; }; favoriteCount?: number; id: string; inputProcessors?: { steps: ({ step: { config: {[key: string]: unknown; }; enabledPhases: ("processInput" | "processInputStep" | "processOutputStream" | "processOutputResult" | "processOutputStep" | "processToolResult")[]; id: string; providerId: string; }; type: "step"; } | { branches: ({ step: …; type: …; } | { branches: …; type: …; } | { conditions: …; type: …; })[][]; type: "parallel"; } | { conditions: object[]; type: "conditional"; })[]; } | object[]; instructions: string | ({ content: string; type: "text"; } | { id: string; type: "prompt_block_ref"; } | { content: string; rules?: { conditions: ({ field: …; operator: …; value?: …; } | { conditions: …; operator: …; })[]; operator: "AND" | "OR"; }; type: "prompt_block"; })[]; integrationTools?: {[key: string]: object; } | object[]; isFavorited?: boolean; mcpClients?: {[key: string]: object; } | object[]; memory?: { embedder?: string; embedderOptions?: {[key: string]: unknown; }; observationalMemory?: boolean | { model?: string; observation?: { blockAfter?: number; bufferActivation?: number; bufferTokens?: number | false; maxTokensPerBatch?: number; messageTokens?: number; model?: string; modelSettings?: {[key: string]: unknown; }; providerOptions?: {[key: string]: … | …; }; }; reflection?: { blockAfter?: number; bufferActivation?: number; model?: string; modelSettings?: {[key: string]: unknown; }; observationTokens?: number; providerOptions?: {[key: string]: … | …; }; }; scope?: "thread" | "resource"; shareTokenBudget?: boolean; }; options?: { generateTitle?: boolean | { emitEvent?: boolean; instructions?: string; minMessages?: number; model?: string; }; lastMessages?: number | false; messageHistory?: { atMaxRemoveTokens?: number; maxTokens: number; }; readOnly?: boolean; semanticRecall?: boolean | { indexName?: string; messageRange: number | { after: number; before: number; }; scope?: "thread" | "resource"; threshold?: number; topK: number; }; }; vector?: string | false; } | object[]; metadata?: {[key: string]: unknown; }; model: {[key: string]: unknown; name: string; provider: string; } | object[]; name: string; outputProcessors?: { steps: ({ step: { config: {[key: string]: unknown; }; enabledPhases: ("processInput" | "processInputStep" | "processOutputStream" | "processOutputResult" | "processOutputStep" | "processToolResult")[]; id: string; providerId: string; }; type: "step"; } | { branches: ({ step: …; type: …; } | { branches: …; type: …; } | { conditions: …; type: …; })[][]; type: "parallel"; } | { conditions: object[]; type: "conditional"; })[]; } | object[]; requestContextSchema?: {[key: string]: unknown; }; scorers?: {[key: string]: object; } | object[]; skills?: {[key: string]: object; } | object[]; status: string; toolProviders?: {[key: string]: object; } | object[]; tools?: {[key: string]: object; } | object[]; updatedAt: string; visibility?: "public" | "private"; workflows?: object[] | {[key: string]: object; }; workspace?: { type: "id"; workspaceId: string; } | { config: { autoSync?: boolean; description?: string; filesystem?: { config: {[key: string]: unknown; }; provider: string; }; mounts?: {[key: string]: object; }; name: string; operationTimeout?: number; sandbox?: { config: {[key: string]: unknown; }; provider: string; }; search?: { autoIndexPaths?: string[]; bm25?: boolean | { b?: number; k1?: number; }; embedderConfig?: {[key: string]: unknown; }; embedderModel?: string; embedderProvider?: string; searchIndexName?: string; vectorConfig?: {[key: string]: unknown; }; vectorProvider?: string; }; skills?: string[]; tools?: { enabled?: boolean; requireApproval?: boolean; tools?: {[key: string]: object; }; }; }; type: "inline"; } | { config: {[key: string]: unknown; }; provider: string; type: "provider"; } | object[]; }>

Promise containing the created stored agent

MastraClient.createStoredAgent


createStoredMCPClient(params): Promise<{ activeVersionId?: string; authorId?: string; createdAt: string; description?: string; id: string; metadata?: {[key: string]: unknown; }; name: string; servers: {[key: string]: object; }; status: string; updatedAt: string; }>

Creates a new stored MCP client

MCP client configuration

string

Author identifier for multi-tenant filtering

string

Description of the MCP client

string

Unique identifier. If not provided, derived from name.

{[key: string]: unknown; }

Additional metadata for the MCP client

string

Name of the MCP client

{[key: string]: object; }

Map of server name to server configuration

Promise<{ activeVersionId?: string; authorId?: string; createdAt: string; description?: string; id: string; metadata?: {[key: string]: unknown; }; name: string; servers: {[key: string]: object; }; status: string; updatedAt: string; }>

Promise containing the created stored MCP client

MastraClient.createStoredMCPClient


createStoredPromptBlock(params): Promise<{ activeVersionId?: string; authorId?: string; content: string; createdAt: string; description?: string; hasDraft?: boolean; id: string; metadata?: {[key: string]: unknown; }; name: string; requestContextSchema?: {[key: string]: unknown; }; rules?: { conditions: ({ field: string; operator: Shared_Type_8; value?: unknown; } | { conditions: ({ field: string; operator: Shared_Type_8; value?: unknown; } | { conditions: …[]; operator: … | …; })[]; operator: "AND" | "OR"; })[]; operator: "AND" | "OR"; }; status: string; updatedAt: string; }>

Creates a new stored prompt block

Prompt block configuration including name, content, rules, etc.

string

Author identifier for multi-tenant filtering

string

Template content with {{variable}} interpolation

string

Purpose description

string

Unique identifier. If not provided, derived from name.

{[key: string]: unknown; }

Additional metadata for the prompt block

string

Display name of the prompt block

{[key: string]: unknown; }

JSON Schema defining available variables for {{variableName}} interpolation and conditions

{ conditions: ({ field: string; operator: InputShared_Type_31; value?: unknown; } | { conditions: ({ field: string; operator: InputShared_Type_31; value?: unknown; } | { conditions: object[]; operator: "AND" | "OR"; })[]; operator: "AND" | "OR"; })[]; operator: "AND" | "OR"; }

Rules for conditional inclusion

({ field: string; operator: InputShared_Type_31; value?: unknown; } | { conditions: ({ field: string; operator: InputShared_Type_31; value?: unknown; } | { conditions: object[]; operator: "AND" | "OR"; })[]; operator: "AND" | "OR"; })[]

"AND" | "OR"

Promise<{ activeVersionId?: string; authorId?: string; content: string; createdAt: string; description?: string; hasDraft?: boolean; id: string; metadata?: {[key: string]: unknown; }; name: string; requestContextSchema?: {[key: string]: unknown; }; rules?: { conditions: ({ field: string; operator: Shared_Type_8; value?: unknown; } | { conditions: ({ field: string; operator: Shared_Type_8; value?: unknown; } | { conditions: …[]; operator: … | …; })[]; operator: "AND" | "OR"; })[]; operator: "AND" | "OR"; }; status: string; updatedAt: string; }>

Promise containing the created stored prompt block

MastraClient.createStoredPromptBlock


createStoredScorer(params): Promise<{ activeVersionId?: string; authorId?: string; createdAt: string; defaultSampling?: { type: "none"; } | { rate: number; type: "ratio"; }; description?: string; id: string; instructions?: string; metadata?: {[key: string]: unknown; }; model?: {[key: string]: unknown; name: string; provider: string; }; name: string; presetConfig?: {[key: string]: unknown; }; scoreRange?: { max?: number; min?: number; }; status: string; type: Shared_Type_76; updatedAt: string; }>

Creates a new stored scorer definition

Scorer definition configuration

string

Author identifier for multi-tenant filtering

{ type: "none"; } | { rate: number; type: "ratio"; }

Default sampling configuration

string

Description of the scorer

string

Unique identifier. If not provided, derived from name.

string

System instructions for the judge LLM (used when type is llm-judge)

{[key: string]: unknown; }

Additional metadata for the scorer

{[key: string]: unknown; name: string; provider: string; }

Model configuration for LLM judge

string

Model name (e.g., gpt-4o, claude-3-opus)

string

Model provider (e.g., openai, anthropic)

string

Name of the scorer

{[key: string]: unknown; }

Serializable config options for preset scorers

{ max?: number; min?: number; }

Score range configuration (used when type is llm-judge)

number

Maximum score value (default: 1)

number

Minimum score value (default: 0)

InputShared_Type_90

Scorer type: llm-judge for custom, or a preset type name

Promise<{ activeVersionId?: string; authorId?: string; createdAt: string; defaultSampling?: { type: "none"; } | { rate: number; type: "ratio"; }; description?: string; id: string; instructions?: string; metadata?: {[key: string]: unknown; }; model?: {[key: string]: unknown; name: string; provider: string; }; name: string; presetConfig?: {[key: string]: unknown; }; scoreRange?: { max?: number; min?: number; }; status: string; type: Shared_Type_76; updatedAt: string; }>

Promise containing the created stored scorer definition

MastraClient.createStoredScorer


createStoredSkill(params): Promise<{ activeVersionId?: string; assets?: string[]; authorId?: string; compatibility?: unknown; createdAt: string; description: string; favoriteCount?: number; files?: object[]; id: string; instructions: string; isFavorited?: boolean; license?: string; metadata?: {[key: string]: unknown; }; name: string; references?: string[]; scripts?: string[]; source?: { packagePath: string; type: "external"; } | { projectPath: string; type: "local"; } | { mastraPath: string; type: "managed"; }; status: string; updatedAt: string; visibility?: "public" | "private"; }>

Creates a new stored skill

Skill configuration

string[]

List of asset file paths

string

Author identifier for multi-tenant filtering

unknown

Compatibility requirements

string

Description of what the skill does and when to use it

object[]

Full file tree structure for the skill

string

Unique identifier. If not provided, derived from name.

string

Markdown instructions for the skill

string

License identifier for the skill

{[key: string]: unknown; }

Additional metadata for the skill

string

Name of the skill

string[]

List of reference file paths

string[]

List of script file paths

{ packagePath: string; type: "external"; } | { projectPath: string; type: "local"; } | { mastraPath: string; type: "managed"; }

Source location of the skill

"public" | "private"

Skill visibility: private (owner/admin only) or public (any reader)

Promise<{ activeVersionId?: string; assets?: string[]; authorId?: string; compatibility?: unknown; createdAt: string; description: string; favoriteCount?: number; files?: object[]; id: string; instructions: string; isFavorited?: boolean; license?: string; metadata?: {[key: string]: unknown; }; name: string; references?: string[]; scripts?: string[]; source?: { packagePath: string; type: "external"; } | { projectPath: string; type: "local"; } | { mastraPath: string; type: "managed"; }; status: string; updatedAt: string; visibility?: "public" | "private"; }>

Promise containing the created stored skill

MastraClient.createStoredSkill


declineToolCallStream(agentId, params): Promise<MastraStreamResponse>

Deny a suspended tool through the same native resume contract.

string

string

MastraRequestContextSnapshot

string

AbortSignal

string

string

Promise<MastraStreamResponse>


defaultModel(agentId?, signal?): Promise<string | null>

Fetch the humanized name of the static default model agentId falls back to when no model is pinned, from GET ${basePath}/default-model. Returns the server-humanized displayName (never a raw endpoint id), or null when the agent resolves its model dynamically at call time (or the agent id is unknown) - there’s nothing static to advertise. The picker uses this to label its default option on load, before the /models catalogue arrives. Defaults to the server’s default agent when agentId is omitted.

string

AbortSignal

Promise<string | null>


defaultModelDetails(agentId?, signal?): Promise<{ agentId: string; displayName: string | null; model: string | null; }>

Fetch the complete resolved default-model descriptor for an agent.

string

AbortSignal

Promise<{ agentId: string; displayName: string | null; model: string | null; }>


deleteDataset(datasetId, tenancy?): Promise<{ success: boolean; }>

Deletes a dataset. When tenancy fields are supplied, the server only deletes the dataset if it belongs to the given tenant (silent no-op otherwise).

string

GetDatasetsDatasetId_QueryParams

Promise<{ success: boolean; }>

MastraClient.deleteDataset


deleteDatasetExperiment(datasetId, experimentId, tenancy?): Promise<{ success: boolean; }>

Deletes a dataset experiment and its results. Tenancy fields, when provided, scope the dataset lookup on the server side.

The server also attempts to delete the experiment’s observability traces, cascading to their spans and trace-linked signals. Stores without observability or trace deletion support leave the traces in place.

string

string

GetDatasetsDatasetId_QueryParams

Promise<{ success: boolean; }>

MastraClient.deleteDatasetExperiment


deleteDatasetItem(datasetId, itemId): Promise<{ success: boolean; }>

Deletes a dataset item

string

string

Promise<{ success: boolean; }>

MastraClient.deleteDatasetItem


deleteExperiment(experimentId, options?): Promise<{ success: boolean; }>

Deletes an experiment and its results regardless of dataset association (including experiments orphaned by dataset deletion). When tenancy fields are supplied, the server only deletes the experiment if it belongs to the given tenant (silent no-op otherwise).

The server also attempts to delete the experiment’s observability traces, cascading to their spans and trace-linked signals. Stores without observability or trace deletion support leave the traces in place.

string

GetDatasetsDatasetId_QueryParams

Promise<{ success: boolean; }>

MastraClient.deleteExperiment


deleteFeedback(params): Promise<{ success: boolean; }>

Deletes feedback records by feedbackId, optionally scoped to a tenant.

DeleteObservabilityFeedback_Body

Promise<{ success: boolean; }>

MastraClient.deleteFeedback


deleteMessages(threadId, messageIds, options?): Promise<void>

Delete selected persisted messages before regenerating a turn.

string

string[]

string

AbortSignal

Promise<void>


deleteSchedule(scheduleId): Promise<PostAgentsAgentIdModel_Response>

Deletes a schedule.

string

Promise<PostAgentsAgentIdModel_Response>

MastraClient.deleteSchedule


deleteScores(params): Promise<{ success: boolean; }>

Deletes score records by scoreId, optionally scoped to a tenant.

DeleteObservabilityScores_Body

Promise<{ success: boolean; }>

MastraClient.deleteScores


deleteThread(threadId, opts): Promise<DeleteMemoryThreadsThreadId_Response>

string

{ agentId: string; networkId?: undefined; requestContext?: RequestContext<unknown> | Record<string, any>; } | { agentId?: undefined; networkId: string; requestContext?: RequestContext<unknown> | Record<string, any>; }

Promise<DeleteMemoryThreadsThreadId_Response>

MastraClient.deleteThread


deleteTraces(params): Promise<{ success: true; }>

Deletes traces by ID, cascading to all associated spans and trace-linked signal events (scores, feedback, metrics, logs). Signals without a trace ID are untouched. On ClickHouse-backed stores, reads may briefly return deleted rows until the delete is fully applied.

PostObservabilityTracesDelete_Body

Promise<{ success: true; }>

MastraClient.deleteTraces


feedback(input): Promise<{ assessmentId?: string; ok: boolean; }>

Log user feedback for a turn to POST ${basePath}/route/feedback. traceId is the tr-<hex> value the server sent on the stream response (via MLFLOW_TRACE_ID_HEADER) for that assistant message; value carries a thumbs (boolean) / rating, and/or comment carries freeform text. The server logs it as a HUMAN assessment on the trace, attributed to the signed-in user.

Resolves with { ok: false } (not a throw) when the assessment couldn’t be recorded yet - most often because the trace is still exporting to MLflow - so callers can prompt a retry. Throws only on a transport / HTTP-level failure.

string = ...

string = ...

string = ...

string | number | boolean = ...

Promise<{ assessmentId?: string; ok: boolean; }>


finalizeExperiment(params): Promise<{ agentVersion?: string | null; comparisonId?: string | null; completedAt: string | null; createdAt: string; datasetId: string | null; datasetVersion: number | null; description?: string; experimentSetId?: string | null; failedCount: number; id: string; metadata?: {[key: string]: unknown; }; name?: string; provenance?: { metadata?: {[key: string]: unknown; }; source?: string; sourceId?: string; sourceVersion?: string; } | null; runnerAttestation?: { invocationId: string; runnerId: string; runnerVersion?: string; } | null; scorerIds?: string[] | null; skippedCount: number; startedAt: string | null; status: "running" | "pending" | "completed" | "failed"; succeededCount: number; targetId: string | null; targetType: "agent" | "workflow" | "scorer" | "processor" | null; totalItems: number; trialIndex?: number | null; updatedAt: string; variantId?: string | null; }>

Finalizes an external experiment. The server computes counts from persisted results. Idempotent.

PostDatasetsDatasetIdExperimentsExperimentIdResults_PathParams

Promise<{ agentVersion?: string | null; comparisonId?: string | null; completedAt: string | null; createdAt: string; datasetId: string | null; datasetVersion: number | null; description?: string; experimentSetId?: string | null; failedCount: number; id: string; metadata?: {[key: string]: unknown; }; name?: string; provenance?: { metadata?: {[key: string]: unknown; }; source?: string; sourceId?: string; sourceVersion?: string; } | null; runnerAttestation?: { invocationId: string; runnerId: string; runnerVersion?: string; } | null; scorerIds?: string[] | null; skippedCount: number; startedAt: string | null; status: "running" | "pending" | "completed" | "failed"; succeededCount: number; targetId: string | null; targetType: "agent" | "workflow" | "scorer" | "processor" | null; totalItems: number; trialIndex?: number | null; updatedAt: string; variantId?: string | null; }>

MastraClient.finalizeExperiment


generateDatasetItems(params): Promise<{ items: object[]; }>

Generates synthetic dataset items using AI. Items are returned for review, not auto-saved.

GenerateDatasetItemsParams

Promise<{ items: object[]; }>

MastraClient.generateDatasetItems


getA2A(agentId): A2A

Gets an A2A client for interacting with an agent via the A2A protocol

string

ID of the agent to interact with

A2A

A2A client instance

MastraClient.getA2A


getA2AV1(agentId): A2AV1

Gets an A2A Protocol v1.0 client for an agent.

string

ID of the agent to interact with

A2AV1

MastraClient.getA2AV1


getAgent(agentId, version?, routeOverrides?): Agent

Gets an agent instance by ID

string

ID of the agent to retrieve

AgentVersionIdentifier

Optional version selector for stored agent overrides

string

Agent

Agent instance

MastraClient.getAgent


getAgentBuilderAction(actionId): AgentBuilder

Gets an agent builder instance for executing agent-builder workflows

string

AgentBuilder

AgentBuilder instance

MastraClient.getAgentBuilderAction


getAgentBuilderActions(): Promise<{[key: string]: object; }>

Gets all available agent builder actions

Promise<{[key: string]: object; }>

Promise containing map of action IDs to action details

MastraClient.getAgentBuilderActions


getAgentController(controllerId): AgentController

Scopes to an agent controller hosted on the connected Mastra instance. Use getAgentController(id).session(resourceId) to create/resume a session, stream its events, and send messages.

string

The id the agent controller is registered under on Mastra

AgentController

MastraClient.getAgentController


getBackgroundTask(backgroundTaskId): Promise<{ agentId: string; args: {[key: string]: unknown; }; completedAt?: string; createdAt: string; error?: { message: string; stack?: string; }; id: string; maxRetries: number; resourceId?: string; result?: unknown; retryCount: number; runId: string; startedAt?: string; status: "suspended" | "running" | "pending" | "completed" | "failed" | "cancelled" | "timed_out"; suspendPayload?: unknown; threadId?: string; timeoutMs: number; toolCallId: string; toolName: string; }>

Gets a single background task by ID.

string

Promise<{ agentId: string; args: {[key: string]: unknown; }; completedAt?: string; createdAt: string; error?: { message: string; stack?: string; }; id: string; maxRetries: number; resourceId?: string; result?: unknown; retryCount: number; runId: string; startedAt?: string; status: "suspended" | "running" | "pending" | "completed" | "failed" | "cancelled" | "timed_out"; suspendPayload?: unknown; threadId?: string; timeoutMs: number; toolCallId: string; toolName: string; }>

MastraClient.getBackgroundTask


getBranch(params): Promise<{ spans: object[]; traceId: string; }>

Retrieves the subtree of spans rooted at a given span. The optional depth field bounds descendant levels below the anchor (0 = anchor only; omitted = full subtree).

GetBranchArgs

Promise<{ spans: object[]; traceId: string; }>

MastraClient.getBranch


getBuilderAvailableModels(): Promise<{ providers: object[]; }>

Retrieves the AI providers/models available under the active builder model policy. The server applies the EE allowlist, so the result can be rendered directly in the model picker.

Promise<{ providers: object[]; }>

Promise containing the policy-filtered providers/models

MastraClient.getBuilderAvailableModels


getBuilderRegistryPopular(registryId, params?): Promise<{ count: number; limit: number; offset: number; skills: object[]; }>

Fetch the popular skills feed from a builder skill registry. Requires stored-skills:read permission.

string

number

number

Promise<{ count: number; limit: number; offset: number; skills: object[]; }>

MastraClient.getBuilderRegistryPopular


getBuilderRegistryPreview(registryId, params): Promise<{ content: string; }>

Fetch the rendered preview content for a single registry skill. Requires stored-skills:read permission.

string

string

string

string

Promise<{ content: string; }>

MastraClient.getBuilderRegistryPreview


getBuilderSettings(): Promise<{ configuration?: { agent?: {[key: string]: unknown; agents?: { allowed?: string[]; }; models?: { allowed?: (… | …)[]; default?: { kind: "custom"; modelId: string; provider: string; } | { modelId: string; provider: string; }; }; tools?: { allowed?: string[]; }; workflows?: { allowed?: string[]; }; }; }; enabled: boolean; features?: { agent?: { agents?: boolean; avatarUpload?: boolean; browser?: boolean; favorites?: boolean; memory?: boolean; model?: boolean; scorers?: boolean; skills?: boolean; tools?: boolean; variables?: boolean; workflows?: boolean; }; }; modelPolicy?: { active: boolean; allowed?: ({ kind: "custom"; modelId?: string; provider: string; } | { modelId?: string; provider: string; })[]; default?: { kind: "custom"; modelId: string; provider: string; } | { modelId: string; provider: string; }; pickerVisible?: boolean; }; modelPolicyWarnings?: string[]; picker?: { visibleAgents: string[] | null; visibleTools: string[] | null; visibleWorkflows: string[] | null; }; }>

Retrieves agent builder settings for UI gating. Returns feature flags and configuration set by admin.

Promise<{ configuration?: { agent?: {[key: string]: unknown; agents?: { allowed?: string[]; }; models?: { allowed?: (… | …)[]; default?: { kind: "custom"; modelId: string; provider: string; } | { modelId: string; provider: string; }; }; tools?: { allowed?: string[]; }; workflows?: { allowed?: string[]; }; }; }; enabled: boolean; features?: { agent?: { agents?: boolean; avatarUpload?: boolean; browser?: boolean; favorites?: boolean; memory?: boolean; model?: boolean; scorers?: boolean; skills?: boolean; tools?: boolean; variables?: boolean; workflows?: boolean; }; }; modelPolicy?: { active: boolean; allowed?: ({ kind: "custom"; modelId?: string; provider: string; } | { modelId?: string; provider: string; })[]; default?: { kind: "custom"; modelId: string; provider: string; } | { modelId: string; provider: string; }; pickerVisible?: boolean; }; modelPolicyWarnings?: string[]; picker?: { visibleAgents: string[] | null; visibleTools: string[] | null; visibleWorkflows: string[] | null; }; }>

Promise containing builder settings

MastraClient.getBuilderSettings


getDataset(datasetId, tenancy?): Promise<SerializedRouteResponse<"GET /datasets/:datasetId">>

Gets a single dataset by ID. Optionally scope the lookup to a specific tenant organization/project — the server returns 404 if the dataset does not belong to the given tenant.

string

GetDatasetsDatasetId_QueryParams

Promise<SerializedRouteResponse<"GET /datasets/:datasetId">>

MastraClient.getDataset


getDatasetExperiment(datasetId, experimentId): Promise<SerializedRouteResponse<"GET /datasets/:datasetId/experiments/:experimentId">>

Gets a single dataset experiment by ID

string

string

Promise<SerializedRouteResponse<"GET /datasets/:datasetId/experiments/:experimentId">>

MastraClient.getDatasetExperiment


getDatasetItem(datasetId, itemId): Promise<{ createdAt: string; datasetId: string; datasetVersion: number; expectedTrajectory?: unknown; externalId?: string | null; groundTruth?: unknown; id: string; input: unknown; metadata?: {[key: string]: unknown; } | null; requestContext?: {[key: string]: unknown; } | null; scorerIds?: string[] | null; source?: { referenceId?: string; type: "csv" | "json" | "trace" | "llm" | "experiment-result" | "candidate-screener"; } | null; toolMocks?: object[] | null; unmockedToolPolicy?: "allow" | "deny" | null; updatedAt: string; }>

Gets a single dataset item by ID

string

string

Promise<{ createdAt: string; datasetId: string; datasetVersion: number; expectedTrajectory?: unknown; externalId?: string | null; groundTruth?: unknown; id: string; input: unknown; metadata?: {[key: string]: unknown; } | null; requestContext?: {[key: string]: unknown; } | null; scorerIds?: string[] | null; source?: { referenceId?: string; type: "csv" | "json" | "trace" | "llm" | "experiment-result" | "candidate-screener"; } | null; toolMocks?: object[] | null; unmockedToolPolicy?: "allow" | "deny" | null; updatedAt: string; }>

MastraClient.getDatasetItem


getDatasetItemVersion(datasetId, itemId, datasetVersion): Promise<{ createdAt: string; datasetId: string; datasetVersion: number; expectedTrajectory?: unknown; externalId?: string | null; groundTruth?: unknown; id: string; input: unknown; metadata?: {[key: string]: unknown; } | null; requestContext?: {[key: string]: unknown; } | null; scorerIds?: string[] | null; source?: { referenceId?: string; type: "csv" | "json" | "trace" | "llm" | "experiment-result" | "candidate-screener"; } | null; toolMocks?: object[] | null; unmockedToolPolicy?: "allow" | "deny" | null; updatedAt: string; }>

Gets a specific version of a dataset item

string

string

number

Promise<{ createdAt: string; datasetId: string; datasetVersion: number; expectedTrajectory?: unknown; externalId?: string | null; groundTruth?: unknown; id: string; input: unknown; metadata?: {[key: string]: unknown; } | null; requestContext?: {[key: string]: unknown; } | null; scorerIds?: string[] | null; source?: { referenceId?: string; type: "csv" | "json" | "trace" | "llm" | "experiment-result" | "candidate-screener"; } | null; toolMocks?: object[] | null; unmockedToolPolicy?: "allow" | "deny" | null; updatedAt: string; }>

MastraClient.getDatasetItemVersion


getDynamicWorkflow(dynamicWorkflowId): DynamicWorkflow

Gets a dynamic workflow instance by ID for further operations (details, delete). To execute a dynamic workflow, use getWorkflow(id).createRun() like any other workflow.

string

ID of the dynamic workflow definition

DynamicWorkflow

DynamicWorkflow instance

MastraClient.getDynamicWorkflow


getEntityNames(params?): Promise<{ names: string[]; }>

Returns distinct entity names with optional type filtering.

GetObservabilityDiscoveryEntityNames_QueryParams

Promise<{ names: string[]; }>

MastraClient.getEntityNames


getEntityTypes(): Promise<{ entityTypes: Shared_Type_58[]; }>

Returns distinct entity types from observability data.

Promise<{ entityTypes: Shared_Type_58[]; }>

MastraClient.getEntityTypes


getEnvironments(): Promise<{ environments: string[]; }>

Returns distinct environments from observability data.

Promise<{ environments: string[]; }>

MastraClient.getEnvironments


getExperimentReviewSummary(): Promise<{ counts: object[]; }>

Gets review status counts aggregated per experiment

Promise<{ counts: object[]; }>

MastraClient.getExperimentReviewSummary


getFeedbackAggregate(params): Promise<{ changePercent?: number | null; previousValue?: number | null; value: number | null; }>

Returns an aggregated feedback value with optional period-over-period comparison.

PostObservabilityFeedbackAggregate_Body

Promise<{ changePercent?: number | null; previousValue?: number | null; value: number | null; }>

MastraClient.getFeedbackAggregate


getFeedbackBreakdown(params): Promise<{ groups: object[]; }>

Returns feedback values grouped by specified dimensions.

PostObservabilityFeedbackBreakdown_Body

Promise<{ groups: object[]; }>

MastraClient.getFeedbackBreakdown


getFeedbackPercentiles(params): Promise<{ series: object[]; }>

Returns percentile values for feedback bucketed by time interval.

PostObservabilityFeedbackPercentiles_Body

Promise<{ series: object[]; }>

MastraClient.getFeedbackPercentiles


getFeedbackTimeSeries(params): Promise<{ series: object[]; }>

Returns feedback values bucketed by time interval with optional grouping.

PostObservabilityFeedbackTimeseries_Body

Promise<{ series: object[]; }>

MastraClient.getFeedbackTimeSeries


getInfrastructureStatus(): Promise<{ browser: { availableProviders: string[]; config: object[]; env: string | null; provider: string | null; registered: boolean; type: string | null; }; channels: { providers: object[]; }; registries: { skillsSh: { enabled: boolean; }; }; workspace: { config: object[]; filesystemProvider: string | null; hasFilesystem: boolean; hasSandbox: boolean; name: string | null; registered: boolean; sandboxProvider: string | null; source: string | null; type: string | null; workspaceId: string | null; }; }>

Retrieves Agent Builder infrastructure configuration and resolution status. Requires infrastructure:read permission.

Promise<{ browser: { availableProviders: string[]; config: object[]; env: string | null; provider: string | null; registered: boolean; type: string | null; }; channels: { providers: object[]; }; registries: { skillsSh: { enabled: boolean; }; }; workspace: { config: object[]; filesystemProvider: string | null; hasFilesystem: boolean; hasSandbox: boolean; name: string | null; registered: boolean; sandboxProvider: string | null; source: string | null; type: string | null; workspaceId: string | null; }; }>

Promise containing infrastructure status

MastraClient.getInfrastructureStatus


getItemHistory(datasetId, itemId): Promise<{ history: object[]; }>

Lists versions for a dataset item

string

string

Promise<{ history: object[]; }>

MastraClient.getItemHistory


getLogForRun(params): Promise<{ hasMore: boolean; logs: object[]; page: number; perPage: number | false; total: number; }>

Gets logs for a specific run

GetLogParams

Parameters containing run ID to retrieve

Promise<{ hasMore: boolean; logs: object[]; page: number; perPage: number | false; total: number; }>

Promise containing array of log messages

MastraClient.getLogForRun


getMcpServerDetails(serverId, params?): Promise<GetMcpV0ServersId_Response>

Retrieves detailed information for a specific MCP server.

string

The ID of the MCP server to retrieve.

GetMcpV0ServersId_QueryParams

Optional parameters, e.g., specific version.

Promise<GetMcpV0ServersId_Response>

Promise containing the detailed MCP server information.

MastraClient.getMcpServerDetails


getMcpServerResources(serverId): Promise<GetMcpServerIdResources_Response>

Lists resources available on an MCP server.

string

The ID of the MCP server.

Promise<GetMcpServerIdResources_Response>

Promise containing the list of resources.

MastraClient.getMcpServerResources


getMcpServers(params?): Promise<{ next: string | null; servers: object[]; total_count: number; }>

Retrieves a list of available MCP servers.

Optional parameters for pagination (page, perPage, or deprecated offset, limit).

number

Deprecated

Use perPage instead

number

Deprecated

Use page instead

number

number

Promise<{ next: string | null; servers: object[]; total_count: number; }>

Promise containing the list of MCP servers and pagination info.

MastraClient.getMcpServers


getMcpServerTool(serverId, toolId): MCPTool

Gets an MCPTool resource instance for a specific tool on an MCP server. This instance can then be used to fetch details or execute the tool.

string

The ID of the MCP server.

string

The ID of the tool.

MCPTool

MCPTool instance.

MastraClient.getMcpServerTool


getMcpServerTools(serverId): Promise<{ tools: object[]; }>

Retrieves a list of tools for a specific MCP server.

string

The ID of the MCP server.

Promise<{ tools: object[]; }>

Promise containing the list of tools.

MastraClient.getMcpServerTools


getMemoryConfig(params): Promise<{ config: { lastMessages?: number | false; messageHistory?: { atMaxRemoveTokens?: number; maxTokens: number; }; observationalMemory?: { enabled: boolean; messageTokens?: number | { max: number; min: number; }; observationModel?: string; observationModelRouting?: object[]; observationTokens?: number | { max: number; min: number; }; reflectionModel?: string; reflectionModelRouting?: object[]; scope?: "thread" | "resource"; shareTokenBudget?: boolean; }; semanticRecall?: unknown; workingMemory?: {[key: string]: unknown; enabled?: boolean; schema?: unknown; scope?: "thread" | "resource"; template?: string; version?: "stable" | "vnext"; }; } | null; memoryType?: "local" | "gateway"; }>

Retrieves memory config for a resource

GetMemoryConfigParams

Parameters containing the resource ID and optional request context

Promise<{ config: { lastMessages?: number | false; messageHistory?: { atMaxRemoveTokens?: number; maxTokens: number; }; observationalMemory?: { enabled: boolean; messageTokens?: number | { max: number; min: number; }; observationModel?: string; observationModelRouting?: object[]; observationTokens?: number | { max: number; min: number; }; reflectionModel?: string; reflectionModelRouting?: object[]; scope?: "thread" | "resource"; shareTokenBudget?: boolean; }; semanticRecall?: unknown; workingMemory?: {[key: string]: unknown; enabled?: boolean; schema?: unknown; scope?: "thread" | "resource"; template?: string; version?: "stable" | "vnext"; }; } | null; memoryType?: "local" | "gateway"; }>

Promise containing memory configuration

MastraClient.getMemoryConfig


getMemoryStatus(agentId, requestContext?, opts?): Promise<{ memoryType?: "local" | "gateway"; observationalMemory?: { enabled: boolean; hasRecord?: boolean; isObserving?: boolean; isReflecting?: boolean; lastObservedAt?: string; observationTokenCount?: number; originType?: string; tokenCount?: number; }; result: boolean; }>

Gets the status of the memory system

string

The agent ID

RequestContext<unknown> | Record<string, any>

Optional parameters including resourceId, threadId, and requestContext

string

string

Promise<{ memoryType?: "local" | "gateway"; observationalMemory?: { enabled: boolean; hasRecord?: boolean; isObserving?: boolean; isReflecting?: boolean; lastObservedAt?: string; observationTokenCount?: number; originType?: string; tokenCount?: number; }; result: boolean; }>

Promise containing memory system status including observational memory info

MastraClient.getMemoryStatus


getMemoryThread(threadId): MemoryThread

Gets a memory thread instance by ID

ID of the memory thread to retrieve

string

string

MemoryThread

MemoryThread instance

MastraClient.getMemoryThread


getMetricAggregate(params): Promise<{ changePercent?: number | null; costChangePercent?: number | null; costUnit?: string | null; estimatedCost?: number | null; previousEstimatedCost?: number | null; previousValue?: number | null; value: number | null; }>

Returns an aggregated metric value with optional period-over-period comparison.

PostObservabilityMetricsAggregate_Body

Promise<{ changePercent?: number | null; costChangePercent?: number | null; costUnit?: string | null; estimatedCost?: number | null; previousEstimatedCost?: number | null; previousValue?: number | null; value: number | null; }>

MastraClient.getMetricAggregate


getMetricBreakdown(params): Promise<{ groups: object[]; }>

Returns metric values grouped by specified dimensions.

PostObservabilityMetricsBreakdown_Body

Promise<{ groups: object[]; }>

MastraClient.getMetricBreakdown


getMetricLabelKeys(params): Promise<{ keys: string[]; }>

Returns distinct label keys for a given metric.

GetObservabilityDiscoveryMetricLabelKeys_QueryParams

Promise<{ keys: string[]; }>

MastraClient.getMetricLabelKeys


getMetricLabelValues(params): Promise<{ values: string[]; }>

Returns distinct values for a given metric label key.

GetObservabilityDiscoveryMetricLabelValues_QueryParams

Promise<{ values: string[]; }>

MastraClient.getMetricLabelValues


getMetricNames(params?): Promise<{ names: string[]; }>

Returns distinct metric names with optional prefix filtering.

GetObservabilityDiscoveryMetricNames_QueryParams

Promise<{ names: string[]; }>

MastraClient.getMetricNames


getMetricPercentiles(params): Promise<{ series: object[]; }>

Returns percentile values for a metric bucketed by time interval.

PostObservabilityMetricsPercentiles_Body

Promise<{ series: object[]; }>

MastraClient.getMetricPercentiles


getMetricTimeSeries(params): Promise<{ series: object[]; }>

Returns metric values bucketed by time interval with optional grouping.

PostObservabilityMetricsTimeseries_Body

Promise<{ series: object[]; }>

MastraClient.getMetricTimeSeries


getObservabilityCapabilities(): Promise<{ capabilities: { deltaPolling: boolean; discovery: { entityNames: boolean; entityTypes: boolean; environments: boolean; metrics: boolean; serviceNames: boolean; tags: boolean; }; feedback: boolean; logs: boolean; metrics: boolean; threadQuery: boolean; traceQuery: boolean; traceQueryDiscovery: boolean; traceQueryRootDuration: boolean; traceQueryTenantScope: boolean; }; observabilityStorageType: string | null; }>

Returns which optional observability APIs the configured observability storage supports.

Promise<{ capabilities: { deltaPolling: boolean; discovery: { entityNames: boolean; entityTypes: boolean; environments: boolean; metrics: boolean; serviceNames: boolean; tags: boolean; }; feedback: boolean; logs: boolean; metrics: boolean; threadQuery: boolean; traceQuery: boolean; traceQueryDiscovery: boolean; traceQueryRootDuration: boolean; traceQueryTenantScope: boolean; }; observabilityStorageType: string | null; }>

MastraClient.getObservabilityCapabilities


getObservationalMemory(params): Promise<{ history?: object[]; record: { activeObservations: string; bufferedObservationChunks?: object[]; bufferedObservations?: string; bufferedReflection?: string; config: {[key: string]: unknown; }; createdAt: string; generationCount: number; id: string; isObserving: boolean; isReflecting: boolean; lastObservedAt?: string; metadata?: {[key: string]: unknown; }; observationTokenCount: number; originType: "initial" | "observation" | "reflection"; pendingMessageTokens: number; resourceId: string; scope: "thread" | "resource"; threadId: string | null; totalTokensObserved: number; updatedAt: string; } | null; }>

Gets observational memory data for a resource or thread

GetObservationalMemoryParams

Parameters containing agentId, resourceId, threadId, and optional request context

Promise<{ history?: object[]; record: { activeObservations: string; bufferedObservationChunks?: object[]; bufferedObservations?: string; bufferedReflection?: string; config: {[key: string]: unknown; }; createdAt: string; generationCount: number; id: string; isObserving: boolean; isReflecting: boolean; lastObservedAt?: string; metadata?: {[key: string]: unknown; }; observationTokenCount: number; originType: "initial" | "observation" | "reflection"; pendingMessageTokens: number; resourceId: string; scope: "thread" | "resource"; threadId: string | null; totalTokensObserved: number; updatedAt: string; } | null; }>

Promise containing the current OM record and history

MastraClient.getObservationalMemory


getPermissionPatterns(): Promise<{ patterns: string[]; }>

Retrieves the authoritative list of valid permission-pattern strings. Used by Studio to validate route→permission literals and gate the sidebar.

Promise<{ patterns: string[]; }>

Promise containing the permission patterns

MastraClient.getPermissionPatterns


getProcessor(processorId): Processor

Gets a processor instance by ID

string

ID of the processor to retrieve

Processor

Processor instance

MastraClient.getProcessor


getProcessorProvider(providerId): ProcessorProvider

Gets a processor provider instance by ID for further operations

string

ID of the processor provider

ProcessorProvider

ProcessorProvider instance

MastraClient.getProcessorProvider


getProcessorProviders(): Promise<GetProcessorProvidersResponse>

Lists all registered processor providers

Promise<GetProcessorProvidersResponse>

Promise containing list of processor provider info

MastraClient.getProcessorProviders


getSchedule(scheduleId): Promise<ScheduleResponse>

Gets a single schedule by ID.

string

Promise<ScheduleResponse>

MastraClient.getSchedule


getScoreAggregate(params): Promise<{ changePercent?: number | null; previousValue?: number | null; value: number | null; }>

Returns an aggregated score value with optional period-over-period comparison.

PostObservabilityScoresAggregate_Body

Promise<{ changePercent?: number | null; previousValue?: number | null; value: number | null; }>

MastraClient.getScoreAggregate


getScoreBreakdown(params): Promise<{ groups: object[]; }>

Returns score values grouped by specified dimensions.

PostObservabilityScoresBreakdown_Body

Promise<{ groups: object[]; }>

MastraClient.getScoreBreakdown


getScorePercentiles(params): Promise<{ series: object[]; }>

Returns percentile values for scores bucketed by time interval.

PostObservabilityScoresPercentiles_Body

Promise<{ series: object[]; }>

MastraClient.getScorePercentiles


getScorer(scorerId): Promise<GetScorerResponse>

Retrieves a scorer by ID

string

ID of the scorer to retrieve

Promise<GetScorerResponse>

Promise containing the scorer

MastraClient.getScorer


getScoreTimeSeries(params): Promise<{ series: object[]; }>

Returns score values bucketed by time interval with optional grouping.

PostObservabilityScoresTimeseries_Body

Promise<{ series: object[]; }>

MastraClient.getScoreTimeSeries


getServiceNames(): Promise<{ serviceNames: string[]; }>

Returns distinct service names from observability data.

Promise<{ serviceNames: string[]; }>

MastraClient.getServiceNames


getSpan(traceId, spanId): Promise<{ span: { attributes?: {[key: string]: unknown; } | null; createdAt: string; endedAt?: string | null; entityId?: string | null; entityName?: string | null; entityType?: Shared_Type_58 | null; entityVersionId?: string | null; environment?: string | null; error?: unknown; experimentId?: string | null; input?: unknown; isEvent: boolean; links?: unknown[] | null; metadata?: {[key: string]: unknown; } | null; name: string; organizationId?: string | null; output?: unknown; parentEntityId?: string | null; parentEntityName?: string | null; parentEntityType?: Shared_Type_58 | null; parentEntityVersionId?: string | null; parentSpanId?: string | null; requestContext?: {[key: string]: unknown; } | null; requestId?: string | null; resourceId?: string | null; rootEntityId?: string | null; rootEntityName?: string | null; rootEntityType?: Shared_Type_58 | null; rootEntityVersionId?: string | null; runId?: string | null; scope?: {[key: string]: unknown; } | null; serviceName?: string | null; sessionId?: string | null; source?: string | null; spanId: string; spanType: Shared_Type_57; startedAt: string; tags?: string[] | null; threadId?: string | null; traceId: string; updatedAt: string | null; userId?: string | null; }; }>

Retrieves a single span with full details by trace ID and span ID.

string

string

Promise<{ span: { attributes?: {[key: string]: unknown; } | null; createdAt: string; endedAt?: string | null; entityId?: string | null; entityName?: string | null; entityType?: Shared_Type_58 | null; entityVersionId?: string | null; environment?: string | null; error?: unknown; experimentId?: string | null; input?: unknown; isEvent: boolean; links?: unknown[] | null; metadata?: {[key: string]: unknown; } | null; name: string; organizationId?: string | null; output?: unknown; parentEntityId?: string | null; parentEntityName?: string | null; parentEntityType?: Shared_Type_58 | null; parentEntityVersionId?: string | null; parentSpanId?: string | null; requestContext?: {[key: string]: unknown; } | null; requestId?: string | null; resourceId?: string | null; rootEntityId?: string | null; rootEntityName?: string | null; rootEntityType?: Shared_Type_58 | null; rootEntityVersionId?: string | null; runId?: string | null; scope?: {[key: string]: unknown; } | null; serviceName?: string | null; sessionId?: string | null; source?: string | null; spanId: string; spanType: Shared_Type_57; startedAt: string; tags?: string[] | null; threadId?: string | null; traceId: string; updatedAt: string | null; userId?: string | null; }; }>

MastraClient.getSpan


getStoredAgent(storedAgentId): StoredAgent

Gets a stored agent instance by ID for further operations (details, update, delete)

string

ID of the stored agent to retrieve

StoredAgent

StoredAgent instance

MastraClient.getStoredAgent


getStoredMCPClient(storedMCPClientId): StoredMCPClient

Gets a stored MCP client instance by ID for further operations (details, update, delete)

string

ID of the stored MCP client

StoredMCPClient

StoredMCPClient instance

MastraClient.getStoredMCPClient


getStoredPromptBlock(storedPromptBlockId): StoredPromptBlock

Gets a stored prompt block instance by ID for further operations (details, update, delete)

string

ID of the stored prompt block to retrieve

StoredPromptBlock

StoredPromptBlock instance

MastraClient.getStoredPromptBlock


getStoredScorer(storedScorerId): StoredScorer

Gets a stored scorer definition instance by ID for further operations (details, update, delete)

string

ID of the stored scorer definition

StoredScorer

StoredScorer instance

MastraClient.getStoredScorer


getStoredSkill(storedSkillId): StoredSkill

Gets a stored skill instance by ID for further operations (details, update, delete)

string

ID of the stored skill

StoredSkill

StoredSkill instance

MastraClient.getStoredSkill


getStoredWorkspace(id): Promise<{ activeVersionId?: string; authorId?: string; autoSync?: boolean; createdAt: string; description?: string; filesystem?: { config: {[key: string]: unknown; }; provider: string; }; id: string; metadata?: {[key: string]: unknown; }; mounts?: {[key: string]: object; }; name: string; operationTimeout?: number; sandbox?: { config: {[key: string]: unknown; }; provider: string; }; search?: { autoIndexPaths?: string[]; bm25?: boolean | { b?: number; k1?: number; }; embedderConfig?: {[key: string]: unknown; }; embedderModel?: string; embedderProvider?: string; searchIndexName?: string; vectorConfig?: {[key: string]: unknown; }; vectorProvider?: string; }; skills?: string[]; status: string; tools?: { enabled?: boolean; requireApproval?: boolean; tools?: {[key: string]: object; }; }; updatedAt: string; }>

Gets a specific stored workspace by ID

string

The workspace ID

Promise<{ activeVersionId?: string; authorId?: string; autoSync?: boolean; createdAt: string; description?: string; filesystem?: { config: {[key: string]: unknown; }; provider: string; }; id: string; metadata?: {[key: string]: unknown; }; mounts?: {[key: string]: object; }; name: string; operationTimeout?: number; sandbox?: { config: {[key: string]: unknown; }; provider: string; }; search?: { autoIndexPaths?: string[]; bm25?: boolean | { b?: number; k1?: number; }; embedderConfig?: {[key: string]: unknown; }; embedderModel?: string; embedderProvider?: string; searchIndexName?: string; vectorConfig?: {[key: string]: unknown; }; vectorProvider?: string; }; skills?: string[]; status: string; tools?: { enabled?: boolean; requireApproval?: boolean; tools?: {[key: string]: object; }; }; updatedAt: string; }>

Promise containing the stored workspace

MastraClient.getStoredWorkspace


getSystemPackages(): Promise<{ cmsEnabled: boolean; editorSource?: "code" | "db"; editorSourceCapabilities?: { canOpenChangeRequest: boolean; canSave: boolean; provider?: { displayName: string; id: string; }; source: "code" | "db"; storage: "filesystem" | "database" | "source-provider" | "unavailable"; unavailableReason?: string; }; isDev: boolean; liveKitConnectionRouteEnabled: boolean; observabilityEnabled: boolean; observabilityRuntimeStrategy?: "realtime" | "batch-with-updates" | "insert-only" | "event-sourced"; observabilityStorageCapabilities?: { deltaPolling: boolean; discovery: { entityNames: boolean; entityTypes: boolean; environments: boolean; metrics: boolean; serviceNames: boolean; tags: boolean; }; feedback: boolean; logs: boolean; metrics: boolean; threadQuery: boolean; traceQuery: boolean; traceQueryDiscovery: boolean; traceQueryRootDuration: boolean; traceQueryTenantScope: boolean; }; observabilityStorageType?: string; packages: object[]; storageType?: string; }>

Retrieves installed Mastra packages and their versions

Promise<{ cmsEnabled: boolean; editorSource?: "code" | "db"; editorSourceCapabilities?: { canOpenChangeRequest: boolean; canSave: boolean; provider?: { displayName: string; id: string; }; source: "code" | "db"; storage: "filesystem" | "database" | "source-provider" | "unavailable"; unavailableReason?: string; }; isDev: boolean; liveKitConnectionRouteEnabled: boolean; observabilityEnabled: boolean; observabilityRuntimeStrategy?: "realtime" | "batch-with-updates" | "insert-only" | "event-sourced"; observabilityStorageCapabilities?: { deltaPolling: boolean; discovery: { entityNames: boolean; entityTypes: boolean; environments: boolean; metrics: boolean; serviceNames: boolean; tags: boolean; }; feedback: boolean; logs: boolean; metrics: boolean; threadQuery: boolean; traceQuery: boolean; traceQueryDiscovery: boolean; traceQueryRootDuration: boolean; traceQueryTenantScope: boolean; }; observabilityStorageType?: string; packages: object[]; storageType?: string; }>

Promise containing the list of installed Mastra packages

MastraClient.getSystemPackages


getTags(params?): Promise<{ tags: string[]; }>

Returns distinct tags with optional entity type filtering.

GetObservabilityDiscoveryEntityNames_QueryParams

Promise<{ tags: string[]; }>

MastraClient.getTags


getTool(toolId): Tool

Gets a tool instance by ID

string

ID of the tool to retrieve

Tool

Tool instance

MastraClient.getTool


getToolProvider(providerId): ToolProvider

Gets a tool provider instance by ID for further operations (listToolkits, listTools, getToolSchema)

string

ID of the tool provider

ToolProvider

ToolProvider instance

MastraClient.getToolProvider


getTrace(traceId): Promise<{ spans: object[]; traceId: string; }>

Retrieves a specific trace by ID.

string

Promise<{ spans: object[]; traceId: string; }>

MastraClient.getTrace


getTraceLight(traceId): Promise<{ spans: object[]; traceId: string; }>

Retrieves a lightweight trace by ID (timeline fields only, excludes heavy fields).

string

Promise<{ spans: object[]; traceId: string; }>

MastraClient.getTraceLight


getTraceQueryFields(params, options?): Promise<{ canonicalFields: object[]; observedFields: object[]; observedFieldsTruncated: boolean; }>

Returns canonical and observed fields available to the advanced trace-query grammar.

PostObservabilityTracesQueryFields_Body

AbortSignal

Promise<{ canonicalFields: object[]; observedFields: object[]; observedFieldsTruncated: boolean; }>

MastraClient.getTraceQueryFields


getTraceQueryValues(params, options?): Promise<{ values: object[]; valuesTruncated: boolean; }>

Returns bounded string suggestions for one eligible trace-query field.

PostObservabilityTracesQueryValues_Body

AbortSignal

Promise<{ values: object[]; valuesTruncated: boolean; }>

MastraClient.getTraceQueryValues


getTraces(params): Promise<LegacyGetTracesResponse>

Retrieves paginated list of traces with optional filtering. This is the legacy API preserved for backward compatibility.

LegacyTracesPaginatedArg

Parameters for pagination and filtering (legacy format)

Promise<LegacyGetTracesResponse>

Promise containing paginated traces and pagination info

Use listTraces instead for new features like ordering and more filters.

MastraClient.getTraces


getTraceTrajectory(traceId): Promise<Trajectory>

Extracts a structured trajectory from a trace’s spans.

string

Promise<Trajectory>

MastraClient.getTraceTrajectory


getVector(vectorName): Vector

Gets a vector instance by name

string

Name of the vector to retrieve

Vector

Vector instance

MastraClient.getVector


getWorkflow(workflowId): Workflow

Gets a workflow instance by ID

string

ID of the workflow to retrieve

Workflow

Workflow instance

MastraClient.getWorkflow


getWorkflowBuilderSettings(): Promise<{ enabled: boolean; modelPolicy?: { active: boolean; allowed?: ({ kind: "custom"; modelId?: string; provider: string; } | { modelId?: string; provider: string; })[]; default?: { kind: "custom"; modelId: string; provider: string; } | { modelId: string; provider: string; }; pickerVisible?: boolean; }; }>

Retrieves workflow builder settings for UI gating.

Promise<{ enabled: boolean; modelPolicy?: { active: boolean; allowed?: ({ kind: "custom"; modelId?: string; provider: string; } | { modelId?: string; provider: string; })[]; default?: { kind: "custom"; modelId: string; provider: string; } | { modelId: string; provider: string; }; pickerVisible?: boolean; }; }>

MastraClient.getWorkflowBuilderSettings


getWorkingMemory(agentId): Promise<unknown>

Retrieves the working memory for a specific thread (optionally resource-scoped).

ID of the agent.

string

RequestContext<unknown> | Record<string, any>

string

string

Promise<unknown>

Working memory for the specified thread or resource.

MastraClient.getWorkingMemory


getWorkspace(workspaceId): Workspace

Gets the workspace resource for filesystem, search, and skills operations

string

Workspace ID to target

Workspace

Workspace instance

MastraClient.getWorkspace


history(options): Promise<ListMemoryThreadMessagesResponse>

Fetch one page from Mastra’s native resource-scoped memory route.

string

number

number

AbortSignal

string

Promise<ListMemoryThreadMessagesResponse>


installBuilderRegistrySkill(registryId, body): Promise<{ filesWritten: number; name: string; storedSkillId: string; }>

Install a registry skill into the builder’s stored-skills DB. Returns 409 when a stored skill with the derived id already exists. Requires stored-skills:write permission.

string

string

GitHub repository owner

string

GitHub repository name

string

Skill name from the registry

"public" | "private"

Visibility for the new stored skill

Promise<{ filesWritten: number; name: string; storedSkillId: string; }>

MastraClient.installBuilderRegistrySkill


listAgentControllers(): Promise<object[]>

Lists the agent controllers hosted on the connected Mastra instance.

Promise<object[]>

Promise containing one record per agent controller, carrying its id

MastraClient.listAgentControllers


listAgents(requestContext?, partial?): Promise<Record<string, GetAgentResponse>>

Retrieves all available agents

RequestContext<unknown> | Record<string, any>

Optional request context to pass as query parameter

boolean

Promise<Record<string, GetAgentResponse>>

Promise containing map of agent IDs to agent details

MastraClient.listAgents


listAgentsModelProviders(): Promise<{ providers: object[]; }>

Promise<{ providers: object[]; }>

MastraClient.listAgentsModelProviders


listBackgroundTasks(params?): Promise<{ tasks: object[]; total: number; }>

Lists background tasks with optional filtering and pagination.

string

"createdAt" | "suspendedAt" | "startedAt" | "completedAt"

Date

"createdAt" | "suspendedAt" | "startedAt" | "completedAt"

"asc" | "desc"

number

number

string

string

"suspended" | "running" | "pending" | "completed" | "failed" | "cancelled" | "timed_out"

string

Date

string

string

Promise<{ tasks: object[]; total: number; }>

MastraClient.listBackgroundTasks


listBranches(params?): Promise<{ branches: object[]; delta?: { hasMore: boolean; limit: number; }; deltaCursor?: string; pagination?: { hasMore: boolean; page: number; perPage: number | false; total: number; }; }>

Retrieves a paginated list of trace branches with optional filtering and sorting. Each row is a branch-anchor span (AGENT_RUN, WORKFLOW_RUN, TOOL_CALL, etc.) including ones nested under a different root entity. Pairs with getBranch to expand a single branch into its subtree.

string

Omit<GetObservabilityBranches_QueryParams, "page" | "perPage" | "mode" | "limit" | "after" | "field" | "direction">

number

Maximum number of updates to return in one delta poll

"page" | "delta"

Pick<GetObservabilityBranches_QueryParams, "field" | "direction">

Pick<GetObservabilityBranches_QueryParams, "page" | "perPage">

Promise<{ branches: object[]; delta?: { hasMore: boolean; limit: number; }; deltaCursor?: string; pagination?: { hasMore: boolean; page: number; perPage: number | false; total: number; }; }>

MastraClient.listBranches


listBuilderRegistries(): Promise<{ registries: object[]; }>

Lists known skill registries surfaced by the Agent Builder config. Each entry reports whether the registry is enabled. Disabled or unknown registries return 404 from registry-scoped routes. Requires stored-skills:read permission.

Promise<{ registries: object[]; }>

MastraClient.listBuilderRegistries


listDatasetExperimentResults(datasetId, experimentId, options?): Promise<ListDatasetExperimentResultsResponse>

Lists results for a dataset experiment. tags restricts the list to results that have all of the given tags.

string

string

GetDatasetsDatasetIdExperimentsExperimentIdResults_QueryParams

Promise<ListDatasetExperimentResultsResponse>

MastraClient.listDatasetExperimentResults


listDatasetExperiments(datasetId, params?): Promise<{ experiments: object[]; pagination: { hasMore: boolean; page: number; perPage: number | false; total: number; }; }>

Lists experiments for a dataset

string

GetExperiments_QueryParams

Promise<{ experiments: object[]; pagination: { hasMore: boolean; page: number; perPage: number | false; total: number; }; }>

MastraClient.listDatasetExperiments


listDatasetItems(datasetId, params?): Promise<{ items: object[]; pagination: { hasMore: boolean; page: number; perPage: number | false; total: number; }; }>

Lists items in a dataset with optional pagination, search, and version filter

string

GetDatasetsDatasetIdItems_QueryParams

Promise<{ items: object[]; pagination: { hasMore: boolean; page: number; perPage: number | false; total: number; }; }>

MastraClient.listDatasetItems


listDatasets(params?): Promise<{ datasets: object[]; pagination: { hasMore: boolean; page: number; perPage: number | false; total: number; }; }>

Lists all datasets with optional pagination

{ direction: "ASC" | "DESC"; field: "name" | "createdAt" | "updatedAt"; }

"ASC" | "DESC"

"name" | "createdAt" | "updatedAt"

number

number

string[]

Only return datasets attached to at least one of these target IDs

"agent" | "workflow" | "scorer" | "processor"

Only return records attached to targets of this type

Promise<{ datasets: object[]; pagination: { hasMore: boolean; page: number; perPage: number | false; total: number; }; }>

MastraClient.listDatasets


listDatasetVersions(datasetId, pagination?): Promise<{ pagination: { hasMore: boolean; page: number; perPage: number | false; total: number; }; versions: object[]; }>

Lists versions for a dataset

string

GetScoresRunRunId_QueryParams

Promise<{ pagination: { hasMore: boolean; page: number; perPage: number | false; total: number; }; versions: object[]; }>

MastraClient.listDatasetVersions


listDynamicWorkflows(params?): Promise<{ total: number; workflows: object[]; }>

Lists dynamic workflow definitions, optionally filtered by status or author

Optional filters: status (‘active’ | ‘archived’) and authorId

string

Filter dynamic workflows by author identifier

"archived" | "active"

Filter dynamic workflows by status (defaults to active when omitted by the handler)

Promise<{ total: number; workflows: object[]; }>

Promise containing the matching definitions and a total count

MastraClient.listDynamicWorkflows


listEmbedders(): Promise<{ embedders: object[]; }>

Lists all available embedding models

Promise<{ embedders: object[]; }>

Promise containing list of available embedders

MastraClient.listEmbedders


listExperiments(params?): Promise<{ experiments: object[]; pagination: { hasMore: boolean; page: number; perPage: number | false; total: number; }; }>

Lists all experiments across all datasets

string

string

{ direction: "ASC" | "DESC"; field: "status" | "createdAt"; }

"ASC" | "DESC"

"status" | "createdAt"

number

number

string

Only return experiments run against this target ID

"agent" | "workflow" | "scorer" | "processor"

Only return records attached to targets of this type

number

string

Promise<{ experiments: object[]; pagination: { hasMore: boolean; page: number; perPage: number | false; total: number; }; }>

MastraClient.listExperiments


listFeedback(params?): Promise<{ delta?: { hasMore: boolean; limit: number; }; deltaCursor?: string; feedback: object[]; pagination?: { hasMore: boolean; page: number; perPage: number | false; total: number; }; }>

Retrieves a paginated list of feedback records.

string

Omit<GetObservabilityFeedback_QueryParams, "page" | "perPage" | "mode" | "limit" | "after" | "field" | "direction">

number

Maximum number of updates to return in one delta poll

"page" | "delta"

Pick<GetObservabilityFeedback_QueryParams, "field" | "direction">

Pick<GetObservabilityFeedback_QueryParams, "page" | "perPage">

Promise<{ delta?: { hasMore: boolean; limit: number; }; deltaCursor?: string; feedback: object[]; pagination?: { hasMore: boolean; page: number; perPage: number | false; total: number; }; }>

MastraClient.listFeedback


listLogs(params): Promise<{ hasMore: boolean; logs: object[]; page: number; perPage: number | false; total: number; }>

Retrieves logs

Parameters for filtering logs

string | string[]

Date

"error" | "debug" | "info" | "warn" | "silent"

number

number

Date

string

Promise<{ hasMore: boolean; logs: object[]; page: number; perPage: number | false; total: number; }>

Promise containing array of log messages

MastraClient.listLogs


listLogsVNext(params?): Promise<{ delta?: { hasMore: boolean; limit: number; }; deltaCursor?: string; logs: object[]; pagination?: { hasMore: boolean; page: number; perPage: number | false; total: number; }; }>

Retrieves a paginated list of observability logs.

string

Omit<GetObservabilityLogs_QueryParams, "page" | "perPage" | "mode" | "limit" | "after" | "field" | "direction">

number

Maximum number of updates to return in one delta poll

"page" | "delta"

Pick<GetObservabilityLogs_QueryParams, "field" | "direction">

Pick<GetObservabilityLogs_QueryParams, "page" | "perPage">

Promise<{ delta?: { hasMore: boolean; limit: number; }; deltaCursor?: string; logs: object[]; pagination?: { hasMore: boolean; page: number; perPage: number | false; total: number; }; }>

MastraClient.listLogsVNext


listLogTransports(): Promise<GetLogsTransports_Response>

List of all log transports

Promise<GetLogsTransports_Response>

Promise containing list of log transports

MastraClient.listLogTransports


listMemoryThreads(params?): Promise<{ hasMore: boolean; page: number; perPage: number | false; threads: object[]; total: number; }>

Lists memory threads with optional filtering by resourceId and/or metadata

ListMemoryThreadsParams

Parameters containing optional filters, pagination options, and request context

Promise<{ hasMore: boolean; page: number; perPage: number | false; threads: object[]; total: number; }>

Promise containing paginated array of memory threads with metadata

MastraClient.listMemoryThreads


listProcessors(requestContext?): Promise<Record<string, { agentIds: string[]; configurations: object[]; description?: string; id: string; isWorkflow: boolean; name?: string; phases: ("input" | "inputStep" | "outputStream" | "outputResult" | "outputStep" | "toolResult")[]; }>>

Retrieves all available processors

RequestContext<unknown> | Record<string, any>

Optional request context to pass as query parameter

Promise<Record<string, { agentIds: string[]; configurations: object[]; description?: string; id: string; isWorkflow: boolean; name?: string; phases: ("input" | "inputStep" | "outputStream" | "outputResult" | "outputStep" | "toolResult")[]; }>>

Promise containing map of processor IDs to processor details

MastraClient.listProcessors


listSchedules(params?): Promise<{ schedules: ({ agentId: string; attributes?: {[key: string]: string | number | boolean | null | undefined; }; createdAt: number; cron: string; id: string; ifActive?: { attributes?: {[key: string]: string | number | boolean | null | undefined; }; behavior?: "deliver" | "persist" | "discard"; }; ifIdle?: { attributes?: {[key: string]: string | number | boolean | null | undefined; }; behavior?: "persist" | "discard" | "wake"; streamOptions?: { requestContext?: {[key: …]: …; }; }; }; lastFireAt?: number; lastRun?: undefined; lastRunId?: string; metadata?: {[key: string]: unknown; }; name?: string; nextFireAt: number; prompt: string; providerOptions?: {[key: string]: unknown; }; resourceId?: string; signalType?: "state" | "user" | "reactive" | "notification" | "user-message" | "system-reminder"; status: "active" | "paused"; tagName?: string; threadId?: string; timezone?: string; updatedAt: number; workflowId?: undefined; } | { agentId?: undefined; createdAt: number; cron: string; id: string; initialState?: unknown; inputData?: unknown; lastFireAt?: number; lastRun?: { completedAt?: number; durationMs?: number; error?: string; startedAt?: number; status: "success" | "suspended" | "running" | "pending" | "failed" | "paused" | "tripwire" | "waiting" | "canceled" | "bailed" | "skipped"; }; lastRunId?: string; metadata?: {[key: string]: unknown; }; nextFireAt: number; requestContext?: {[key: string]: unknown; }; resourceId?: string; status: "active" | "paused"; timezone?: string; updatedAt: number; workflowId: string; })[]; }>

Lists schedules — agent schedules and workflow schedules — with optional filtering by agentId, workflowId, or status. Agent schedules can additionally be filtered by threadId, resourceId, or name.

string

string

string

"active" | "paused"

string

string

Promise<{ schedules: ({ agentId: string; attributes?: {[key: string]: string | number | boolean | null | undefined; }; createdAt: number; cron: string; id: string; ifActive?: { attributes?: {[key: string]: string | number | boolean | null | undefined; }; behavior?: "deliver" | "persist" | "discard"; }; ifIdle?: { attributes?: {[key: string]: string | number | boolean | null | undefined; }; behavior?: "persist" | "discard" | "wake"; streamOptions?: { requestContext?: {[key: …]: …; }; }; }; lastFireAt?: number; lastRun?: undefined; lastRunId?: string; metadata?: {[key: string]: unknown; }; name?: string; nextFireAt: number; prompt: string; providerOptions?: {[key: string]: unknown; }; resourceId?: string; signalType?: "state" | "user" | "reactive" | "notification" | "user-message" | "system-reminder"; status: "active" | "paused"; tagName?: string; threadId?: string; timezone?: string; updatedAt: number; workflowId?: undefined; } | { agentId?: undefined; createdAt: number; cron: string; id: string; initialState?: unknown; inputData?: unknown; lastFireAt?: number; lastRun?: { completedAt?: number; durationMs?: number; error?: string; startedAt?: number; status: "success" | "suspended" | "running" | "pending" | "failed" | "paused" | "tripwire" | "waiting" | "canceled" | "bailed" | "skipped"; }; lastRunId?: string; metadata?: {[key: string]: unknown; }; nextFireAt: number; requestContext?: {[key: string]: unknown; }; resourceId?: string; status: "active" | "paused"; timezone?: string; updatedAt: number; workflowId: string; })[]; }>

MastraClient.listSchedules


listScheduleTriggers(scheduleId, params?): Promise<{ triggers: object[]; }>

Lists trigger history for a schedule, ordered by actualFireAt descending.

string

number

number

number

Promise<{ triggers: object[]; }>

MastraClient.listScheduleTriggers


listScorers(requestContext?): Promise<{[key: string]: object; }>

Retrieves all available scorers

RequestContext<unknown> | Record<string, any>

Optional request context to pass as query parameter

Promise<{[key: string]: object; }>

Promise containing list of available scorers

MastraClient.listScorers


listScores(params?): Promise<{ delta?: { hasMore: boolean; limit: number; }; deltaCursor?: string; pagination?: { hasMore: boolean; page: number; perPage: number | false; total: number; }; scores: object[]; }>

Retrieves a paginated list of observability scores.

string

Omit<GetObservabilityScores_QueryParams, "page" | "perPage" | "mode" | "limit" | "after" | "field" | "direction">

number

Maximum number of updates to return in one delta poll

"page" | "delta"

Pick<GetObservabilityScores_QueryParams, "field" | "direction">

Pick<GetObservabilityScores_QueryParams, "page" | "perPage">

Promise<{ delta?: { hasMore: boolean; limit: number; }; deltaCursor?: string; pagination?: { hasMore: boolean; page: number; perPage: number | false; total: number; }; scores: object[]; }>

MastraClient.listScores


listScoresByEntityId(params): Promise<ListScoresResponse>

Retrieves scores by entity ID and type

Parameters containing entity ID, type, and pagination options

string

Unique identifier for the entity

string

Type of the entity (AGENT or WORKFLOW)

number

number

Promise<ListScoresResponse>

Promise containing scores and pagination info

MastraClient.listScoresByEntityId


listScoresByRunId(params): Promise<ListScoresResponse>

Retrieves scores by run ID

Parameters containing run ID and pagination options

number

number

string

Unique identifier for the run

Promise<ListScoresResponse>

Promise containing scores and pagination info

MastraClient.listScoresByRunId


listScoresByScorerId(params): Promise<ListScoresResponse>

string

string

number

number

string

Unique identifier for the scorer

Promise<ListScoresResponse>

MastraClient.listScoresByScorerId


listScoresBySpan(params): Promise<{ pagination: { hasMore: boolean; page: number; perPage: number | false; total: number; }; scores: object[]; }>

ListScoresBySpanParams

Promise<{ pagination: { hasMore: boolean; page: number; perPage: number | false; total: number; }; scores: object[]; }>

MastraClient.listScoresBySpan


listStoredAgents(params?): Promise<{ agents: object[]; hasMore: boolean; page: number; perPage: number | false; total: number; }>

Lists all stored agents with optional pagination

Optional pagination and ordering parameters

string

Filter agents by author identifier

string

When true, return only agents favorited by the caller (requires the favorites EE feature)

{[key: string]: unknown; }

Filter agents by metadata key-value pairs

{ direction?: "ASC" | "DESC"; field?: "createdAt" | "updatedAt"; }

"ASC" | "DESC"

"createdAt" | "updatedAt"

number

number

string

When set, treat the given subject (user/role) as the favoriting principal for favoritedOnly instead of the caller

"draft" | "published" | "archived"

Filter agents by status (defaults to published)

"public"

Filter to only public agents

Promise<{ agents: object[]; hasMore: boolean; page: number; perPage: number | false; total: number; }>

Promise containing paginated list of stored agents

MastraClient.listStoredAgents


listStoredMCPClients(params?): Promise<{ hasMore: boolean; mcpClients: object[]; page: number; perPage: number | false; total: number; }>

Lists all stored MCP clients with optional pagination

Optional pagination and ordering parameters

string

Filter MCP clients by author identifier

{[key: string]: unknown; }

Filter MCP clients by metadata key-value pairs

{ direction?: "ASC" | "DESC"; field?: "createdAt" | "updatedAt"; }

"ASC" | "DESC"

"createdAt" | "updatedAt"

number

number

"draft" | "published" | "archived"

Filter MCP clients by status (defaults to published)

Promise<{ hasMore: boolean; mcpClients: object[]; page: number; perPage: number | false; total: number; }>

Promise containing paginated list of stored MCP clients

MastraClient.listStoredMCPClients


listStoredPromptBlocks(params?): Promise<{ hasMore: boolean; page: number; perPage: number | false; promptBlocks: object[]; total: number; }>

Lists all stored prompt blocks with optional pagination

Optional pagination and ordering parameters

string

Filter prompt blocks by author identifier

{[key: string]: unknown; }

Filter prompt blocks by metadata key-value pairs

{ direction?: "ASC" | "DESC"; field?: "createdAt" | "updatedAt"; }

"ASC" | "DESC"

"createdAt" | "updatedAt"

number

number

"draft" | "published" | "archived"

Filter prompt blocks by status. When omitted, returns all prompt blocks regardless of status

Promise<{ hasMore: boolean; page: number; perPage: number | false; promptBlocks: object[]; total: number; }>

Promise containing paginated list of stored prompt blocks

MastraClient.listStoredPromptBlocks


listStoredScorers(params?): Promise<{ hasMore: boolean; page: number; perPage: number | false; scorerDefinitions: object[]; total: number; }>

Lists all stored scorer definitions with optional pagination

Optional pagination and ordering parameters

string

Filter scorers by author identifier

{[key: string]: unknown; }

Filter scorers by metadata key-value pairs

{ direction?: "ASC" | "DESC"; field?: "createdAt" | "updatedAt"; }

"ASC" | "DESC"

"createdAt" | "updatedAt"

number

number

"draft" | "published" | "archived"

Filter scorers by status (defaults to published)

Promise<{ hasMore: boolean; page: number; perPage: number | false; scorerDefinitions: object[]; total: number; }>

Promise containing paginated list of stored scorer definitions

MastraClient.listStoredScorers


listStoredSkills(params?): Promise<{ hasMore: boolean; page: number; perPage: number | false; skills: object[]; total: number; }>

Lists all stored skills with optional pagination

Optional pagination and ordering parameters

string

Filter skills by author identifier

string

When true, return only skills favorited by the caller (requires the favorites EE feature)

{[key: string]: unknown; }

Filter skills by metadata key-value pairs

{ direction?: "ASC" | "DESC"; field?: "createdAt" | "updatedAt"; }

"ASC" | "DESC"

"createdAt" | "updatedAt"

number

number

string

When set, treat the given subject (user/role) as the favoriting principal for favoritedOnly instead of the caller

"draft" | "published" | "archived"

Filter skills by status

"public"

Filter to only public skills

Promise<{ hasMore: boolean; page: number; perPage: number | false; skills: object[]; total: number; }>

Promise containing paginated list of stored skills

MastraClient.listStoredSkills


listStoredWorkspaces(params?): Promise<{ hasMore: boolean; page: number; perPage: number | false; total: number; workspaces: object[]; }>

Lists stored workspace configurations from the database

Optional filter and pagination parameters

string

Filter workspaces by author identifier

{[key: string]: unknown; }

Filter workspaces by metadata key-value pairs

{ direction?: "ASC" | "DESC"; field?: "createdAt" | "updatedAt"; }

"ASC" | "DESC"

"createdAt" | "updatedAt"

number

number

Promise<{ hasMore: boolean; page: number; perPage: number | false; total: number; workspaces: object[]; }>

Promise containing paginated list of stored workspaces

MastraClient.listStoredWorkspaces


listThreadMessages(threadId, opts?): Promise<ListMemoryThreadMessagesResponse>

Lists messages for a thread.

string

ID of the thread

ListMemoryThreadMessagesParams

Optional parameters including agentId, networkId, and requestContext

  • When agentId is provided, uses the agent’s memory
  • When networkId is provided, uses the network endpoint
  • When neither is provided, uses storage directly

Promise<ListMemoryThreadMessagesResponse>

Promise containing the thread messages

MastraClient.listThreadMessages


listToolProviders(): Promise<{ providers: object[]; }>

Lists all registered tool providers

Promise<{ providers: object[]; }>

Promise containing list of tool provider info

MastraClient.listToolProviders


listTools(requestContext?): Promise<Record<string, { description?: string; id: string; inputSchema?: string; outputSchema?: string; requestContextSchema?: string; requireApproval?: boolean; title?: string; }>>

Retrieves all available tools

RequestContext<unknown> | Record<string, any>

Optional request context to pass as query parameter

Promise<Record<string, { description?: string; id: string; inputSchema?: string; outputSchema?: string; requestContextSchema?: string; requireApproval?: boolean; title?: string; }>>

Promise containing map of tool IDs to tool details

MastraClient.listTools


listTraces(params?): Promise<{ delta?: { hasMore: boolean; limit: number; }; deltaCursor?: string; pagination?: { hasMore: boolean; page: number; perPage: number | false; total: number; }; spans: object[]; }>

Retrieves paginated list of traces with optional filtering and sorting. This is the new API with improved filtering options.

Parameters for pagination, filtering, and ordering

string

Omit<GetObservabilityTraces_QueryParams, "page" | "perPage" | "mode" | "limit" | "after" | "field" | "direction">

number

Maximum number of updates to return in one delta poll

"page" | "delta"

Pick<GetObservabilityTraces_QueryParams, "field" | "direction">

Pick<GetObservabilityTraces_QueryParams, "page" | "perPage">

Promise<{ delta?: { hasMore: boolean; limit: number; }; deltaCursor?: string; pagination?: { hasMore: boolean; page: number; perPage: number | false; total: number; }; spans: object[]; }>

Promise containing paginated traces and pagination info

MastraClient.listTraces


listTracesLight(params?): Promise<{ delta?: { hasMore: boolean; limit: number; }; deltaCursor?: string; pagination?: { hasMore: boolean; page: number; perPage: number | false; total: number; }; spans: object[]; }>

Retrieves paginated list of traces carrying only the fields a trace list renders. Same contract as listTraces, but rows omit the attributes/input/output blobs and carry a short inputPreview instead.

Parameters for pagination, filtering, and ordering

string

Omit<GetObservabilityTraces_QueryParams, "page" | "perPage" | "mode" | "limit" | "after" | "field" | "direction">

number

Maximum number of updates to return in one delta poll

"page" | "delta"

Pick<GetObservabilityTraces_QueryParams, "field" | "direction">

Pick<GetObservabilityTraces_QueryParams, "page" | "perPage">

Promise<{ delta?: { hasMore: boolean; limit: number; }; deltaCursor?: string; pagination?: { hasMore: boolean; page: number; perPage: number | false; total: number; }; spans: object[]; }>

Promise containing paginated lightweight traces and pagination info

MastraClient.listTracesLight


listVectors(): Promise<{ vectors: object[]; }>

Lists all available vector stores

Promise<{ vectors: object[]; }>

Promise containing list of available vector stores

MastraClient.listVectors


listWorkflowRunCounts(requestContext?): Promise<{[key: string]: object; }>

Retrieves per-workflow counts of running and suspended (awaiting resume) runs

RequestContext<unknown> | Record<string, any>

Optional request context to pass as query parameter

Promise<{[key: string]: object; }>

Promise containing map of workflow IDs to run counts

MastraClient.listWorkflowRunCounts


listWorkflows(requestContext?, partial?): Promise<Record<string, GetWorkflowResponse>>

Retrieves all available workflows

RequestContext<unknown> | Record<string, any>

Optional request context to pass as query parameter

boolean

Promise<Record<string, GetWorkflowResponse>>

Promise containing map of workflow IDs to workflow details

MastraClient.listWorkflows


listWorkspaces(): Promise<{ workspaces: object[]; }>

Lists all workspaces from both Mastra instance and agents

Promise<{ workspaces: object[]; }>

Promise containing array of workspace items

MastraClient.listWorkspaces


mlflowExperiment(signal?): Promise<{ url: string | null; }>

Resolve the configured MLflow experiment for the active viewer. The server returns a URL only when that viewer has effective CAN_MANAGE; inability to determine access resolves to null.

AbortSignal

Promise<{ url: string | null; }>


models(signal?): Promise<object[]>

Fetch the cached Model Serving endpoint catalogue from GET ${basePath}/models. Returns every endpoint the plugin publishes (server-cached for ~5 minutes); callers filter to chat-capable models for a picker.

AbortSignal

Promise<object[]>


observeAgentStream(params): Promise<MastraStreamResponse>

Reconnect to the cached event stream for one background agent run.

string

string

string

AbortSignal

string

Promise<MastraStreamResponse>


pauseSchedule(scheduleId): Promise<ScheduleResponse>

Pauses a schedule. The scheduler tick loop will skip paused schedules. Idempotent — pausing an already-paused schedule returns the current state unchanged. Pause status survives redeploys.

string

Promise<ScheduleResponse>

MastraClient.pauseSchedule


purgeDatasetItem(datasetId, itemId, tenancy?): Promise<{ success: boolean; }>

Permanently scrubs a dataset item’s data from all versions and linked experiment results

string

string

GetDatasetsDatasetId_QueryParams

Promise<{ success: boolean; }>

MastraClient.purgeDatasetItem


queryTraces(params): Promise<{ groups: object[]; page: { next: string | null; }; }>

Queries completed logical traces using recursive trace and related-record predicates. Grouped results remain supported but are deprecated. Use queryTraceThreads() to retrieve thread identities.

QueryTracesGroupedInput

Promise<{ groups: object[]; page: { next: string | null; }; }>

MastraClient.queryTraces

queryTraces(params): Promise<{ delta: { hasMore: boolean; limit: number; }; deltaCursor: string; traces: object[]; }>

Queries completed logical traces using recursive trace and related-record predicates. Grouped results remain supported but are deprecated. Use queryTraceThreads() to retrieve thread identities.

QueryTracesDeltaInput

Promise<{ delta: { hasMore: boolean; limit: number; }; deltaCursor: string; traces: object[]; }>

MastraClient.queryTraces

queryTraces(params): Promise<{ deltaCursor?: string; pagination: { hasMore: boolean; page: number; perPage: number | false; total: number; }; traces: object[]; }>

Queries completed logical traces using recursive trace and related-record predicates. Grouped results remain supported but are deprecated. Use queryTraceThreads() to retrieve thread identities.

QueryTracesPaginatedInput

Promise<{ deltaCursor?: string; pagination: { hasMore: boolean; page: number; perPage: number | false; total: number; }; traces: object[]; }>

MastraClient.queryTraces

queryTraces(params): Promise<{ page: { next: string | null; }; traces: object[]; }>

Queries completed logical traces using recursive trace and related-record predicates. Grouped results remain supported but are deprecated. Use queryTraceThreads() to retrieve thread identities.

QueryTracesKeysetInput

Promise<{ page: { next: string | null; }; traces: object[]; }>

MastraClient.queryTraces

queryTraces(params): Promise<TraceQueryResponse>

Queries completed logical traces using recursive trace and related-record predicates. Grouped results remain supported but are deprecated. Use queryTraceThreads() to retrieve thread identities.

QueryTracesInput

Promise<TraceQueryResponse>

MastraClient.queryTraces


queryTraceThreads(params): Promise<{ page: { next: string | null; }; threads: object[]; }>

Queries thread identities using eligible-trace and cross-trace predicates.

{ after?: string | null; limit?: number; }

string | null

number

{ timeRange: { from: string; to: string; }; where?: unknown; }

{ from: string; to: string; }

string

string

unknown

unknown

Promise<{ page: { next: string | null; }; threads: object[]; }>

MastraClient.queryTraceThreads


readMcpServerResource(serverId, uri): Promise<PostMcpServerIdResourcesRead_Response>

Reads the content of a resource from an MCP server. Used for fetching ui:// MCP App HTML content.

string

The ID of the MCP server.

string

The resource URI to read.

Promise<PostMcpServerIdResourcesRead_Response>

Promise containing the resource content.

MastraClient.readMcpServerResource


removeThread(threadId, options?): Promise<void>

Delete one native memory thread owned by the active resource.

string

string

AbortSignal

Promise<void>


renameThread(threadId, title, options?): Promise<void>

Rename one native memory thread owned by the active resource.

string

string

string

AbortSignal

Promise<void>


request<T>(path, options?): Promise<T>

Makes an HTTP request to the API with retries and exponential backoff

T

string

The API endpoint path (without prefix, e.g., ‘/agents’)

RequestOptions

Optional request configuration

Promise<T>

Promise containing the response data

MastraClient.request


resumeSchedule(scheduleId): Promise<ScheduleResponse>

Resumes a paused schedule. Recomputes nextFireAt from ‘now’ so a long-paused schedule does not fire a backlog. Idempotent — resuming an already-active schedule returns the current state unchanged.

string

Promise<ScheduleResponse>

MastraClient.resumeSchedule


runExperimentItem(params): Promise<{ result: { attempt?: number; comment?: string | null; completedAt: string; createdAt: string; error: { code?: string; message: string; stack?: string; } | null; expectedTrajectory?: unknown; experimentId: string; groundTruth: unknown; id: string; input: unknown; itemDatasetVersion: number | null; itemId: string; metadata?: {[key: string]: unknown; } | null; output: unknown; retryCount: number; startedAt: string; status?: "needs-review" | "reviewed" | "complete" | null; tags?: string[] | null; toolMockReport?: { failure?: { args: unknown; code: "TOOL_MOCK_MISMATCH" | "TOOL_MOCK_EXHAUSTED" | "TOOL_MOCK_NOT_DECLARED"; toolName: string; }; liveCalls: object[]; served: object[]; unconsumed: object[]; } | null; traceId: string | null; }; scores: object[]; }>

Executes the experiment’s target against one dataset item server-side, runs the resolved scorers, and upserts the result row keyed by (experimentId, itemId, attempt) — safe to retry.

RunExperimentItemParams

Promise<{ result: { attempt?: number; comment?: string | null; completedAt: string; createdAt: string; error: { code?: string; message: string; stack?: string; } | null; expectedTrajectory?: unknown; experimentId: string; groundTruth: unknown; id: string; input: unknown; itemDatasetVersion: number | null; itemId: string; metadata?: {[key: string]: unknown; } | null; output: unknown; retryCount: number; startedAt: string; status?: "needs-review" | "reviewed" | "complete" | null; tags?: string[] | null; toolMockReport?: { failure?: { args: unknown; code: "TOOL_MOCK_MISMATCH" | "TOOL_MOCK_EXHAUSTED" | "TOOL_MOCK_NOT_DECLARED"; toolName: string; }; liveCalls: object[]; served: object[]; unconsumed: object[]; } | null; traceId: string | null; }; scores: object[]; }>

MastraClient.runExperimentItem


runSchedule(scheduleId): Promise<{ claimId: string; scheduledFireAt: number; scheduleId: string; }>

Fires a schedule manually, out-of-band from the cron schedule. Behaves like a scheduled fire but does not advance nextFireAt. The returned claimId is the trigger row’s runId — look it up via listScheduleTriggers(scheduleId).

string

Promise<{ claimId: string; scheduledFireAt: number; scheduleId: string; }>

MastraClient.runSchedule


saveMessageToMemory(params): Promise<SaveMessageToMemoryResponse>

Saves messages to memory

SaveMessageToMemoryParams

Parameters containing messages to save and optional request context

Promise<SaveMessageToMemoryResponse>

Promise containing the saved messages

MastraClient.saveMessageToMemory


saveScore(params): Promise<SaveScoreResponse>

Saves a score

SaveScoreParams

Parameters containing the score data to save

Promise<SaveScoreResponse>

Promise containing the saved score

MastraClient.saveScore


score(params): Promise<{ message: string; status: string; traceCount: number; }>

Scores one or more traces using a specified scorer (fire-and-forget).

PostObservabilityTracesScore_Body

Promise<{ message: string; status: string; traceCount: number; }>

MastraClient.score


searchBuilderRegistry(registryId, params): Promise<{ count: number; query: string; searchType: string; skills: object[]; }>

Search a builder skill registry. The registry must be enabled or the server returns 404. Requires stored-skills:read permission.

string

number

string

Promise<{ count: number; query: string; searchType: string; skills: object[]; }>

MastraClient.searchBuilderRegistry


searchMemory(__namedParameters): Promise<MemorySearchResponse>

string

any

RequestContext<unknown> | Record<string, any>

string

string

string

Promise<MemorySearchResponse>

MastraClient.searchMemory


statement(id, signal?): Promise<{ columns: string[]; rowCount: number; rows: Record<string, unknown>[]; truncated: boolean; } | undefined>

Resolve a [data:<id>] marker from GET ${basePath}/embed/data/:id. Returns the same coerced rows the get_statement tool produced for the model. A 404 resolves to undefined.

string

AbortSignal

Promise<{ columns: string[]; rowCount: number; rows: Record<string, unknown>[]; truncated: boolean; } | undefined>


streamAgent(params): Promise<MastraStreamResponse>

Open a native AI SDK UI stream for one Mastra conversation turn. Routing headers and cancellation remain isolated to this call.

string

UIMessage<unknown, UIDataTypes, UITools>[]

string

"none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max"

MastraRequestContextSnapshot

string

AbortSignal

string

Promise<MastraStreamResponse>


streamBackgroundTasks(params?): Promise<ReadableStream<unknown>>

Opens an SSE stream of background task events (completed/failed). Returns a Response that can be consumed as a ReadableStream.

string

string

string

string

string

Promise<ReadableStream<unknown>>

MastraClient.streamBackgroundTasks


submitExperimentResult(params): Promise<{ attempt?: number; comment?: string | null; completedAt: string; createdAt: string; error: { code?: string; message: string; stack?: string; } | null; expectedTrajectory?: unknown; experimentId: string; groundTruth: unknown; id: string; input: unknown; itemDatasetVersion: number | null; itemId: string; metadata?: {[key: string]: unknown; } | null; output: unknown; retryCount: number; startedAt: string; status?: "needs-review" | "reviewed" | "complete" | null; tags?: string[] | null; toolMockReport?: { failure?: { args: unknown; code: "TOOL_MOCK_MISMATCH" | "TOOL_MOCK_EXHAUSTED" | "TOOL_MOCK_NOT_DECLARED"; toolName: string; }; liveCalls: object[]; served: object[]; unconsumed: object[]; } | null; traceId: string | null; }>

Submits (or re-submits) one item result for a target-less (ingestion) experiment. Upsert semantics on (experimentId, itemId, attempt) — safe to retry.

SubmitExperimentResultParams

Promise<{ attempt?: number; comment?: string | null; completedAt: string; createdAt: string; error: { code?: string; message: string; stack?: string; } | null; expectedTrajectory?: unknown; experimentId: string; groundTruth: unknown; id: string; input: unknown; itemDatasetVersion: number | null; itemId: string; metadata?: {[key: string]: unknown; } | null; output: unknown; retryCount: number; startedAt: string; status?: "needs-review" | "reviewed" | "complete" | null; tags?: string[] | null; toolMockReport?: { failure?: { args: unknown; code: "TOOL_MOCK_MISMATCH" | "TOOL_MOCK_EXHAUSTED" | "TOOL_MOCK_NOT_DECLARED"; toolName: string; }; liveCalls: object[]; served: object[]; unconsumed: object[]; } | null; traceId: string | null; }>

MastraClient.submitExperimentResult


suggestions(agentId?, signal?): Promise<string[]>

Fetch the curated starter questions for agentId’s Genie space from GET ${basePath}/suggestions. Empty when the agent has no Genie space (or it defines none).

string

AbortSignal

Promise<string[]>


suspendedRuns(agentId, threadId, signal?): Promise<{ runs: object[]; total: number; }>

Discover approval-gated runs persisted for a conversation.

string

string

AbortSignal

Promise<{ runs: object[]; total: number; }>


threads(options?): Promise<{ hasMore: boolean; page: number; perPage: number | false; threads: object[]; total: number; }>

List the caller’s conversations through Mastra’s native memory API.

string

number

number

AbortSignal

Promise<{ hasMore: boolean; page: number; perPage: number | false; threads: object[]; total: number; }>


triggerDatasetExperiment(params): Promise<{ completedAt: string | null; datasetVersion?: number; experimentId: string; failedCount: number; results: object[]; startedAt: string | null; status: "running" | "pending" | "completed" | "failed"; succeededCount: number; totalItems: number; }>

Triggers a new dataset experiment

TriggerDatasetExperimentParams

Promise<{ completedAt: string | null; datasetVersion?: number; experimentId: string; failedCount: number; results: object[]; startedAt: string | null; status: "running" | "pending" | "completed" | "failed"; succeededCount: number; totalItems: number; }>

MastraClient.triggerDatasetExperiment


updateDataset(params): Promise<{ createdAt: string; description?: string | null; groundTruthSchema?: {[key: string]: unknown; }; id: string; inputSchema?: {[key: string]: unknown; }; metadata?: {[key: string]: unknown; } | null; name: string; requestContextSchema?: {[key: string]: unknown; }; scorerIds?: string[] | null; tags?: string[] | null; targetIds?: string[] | null; targetType?: string | null; updatedAt: string; version: number; }>

Updates a dataset. Tenancy fields, when provided, scope the existence check on the server side so that a caller can only update datasets that belong to the given tenant.

UpdateDatasetParams

Promise<{ createdAt: string; description?: string | null; groundTruthSchema?: {[key: string]: unknown; }; id: string; inputSchema?: {[key: string]: unknown; }; metadata?: {[key: string]: unknown; } | null; name: string; requestContextSchema?: {[key: string]: unknown; }; scorerIds?: string[] | null; tags?: string[] | null; targetIds?: string[] | null; targetType?: string | null; updatedAt: string; version: number; }>

MastraClient.updateDataset


updateDatasetExperiment(params): Promise<{ agentVersion?: string | null; comparisonId?: string | null; completedAt: string | null; createdAt: string; datasetId: string | null; datasetVersion: number | null; description?: string; experimentSetId?: string | null; failedCount: number; id: string; metadata?: {[key: string]: unknown; }; name?: string; provenance?: { metadata?: {[key: string]: unknown; }; source?: string; sourceId?: string; sourceVersion?: string; } | null; runnerAttestation?: { invocationId: string; runnerId: string; runnerVersion?: string; } | null; scorerIds?: string[] | null; skippedCount: number; startedAt: string | null; status: "running" | "pending" | "completed" | "failed"; succeededCount: number; targetId: string | null; targetType: "agent" | "workflow" | "scorer" | "processor" | null; totalItems: number; trialIndex?: number | null; updatedAt: string; variantId?: string | null; }>

Updates a dataset experiment’s name, description or metadata

UpdateDatasetExperimentParams

Promise<{ agentVersion?: string | null; comparisonId?: string | null; completedAt: string | null; createdAt: string; datasetId: string | null; datasetVersion: number | null; description?: string; experimentSetId?: string | null; failedCount: number; id: string; metadata?: {[key: string]: unknown; }; name?: string; provenance?: { metadata?: {[key: string]: unknown; }; source?: string; sourceId?: string; sourceVersion?: string; } | null; runnerAttestation?: { invocationId: string; runnerId: string; runnerVersion?: string; } | null; scorerIds?: string[] | null; skippedCount: number; startedAt: string | null; status: "running" | "pending" | "completed" | "failed"; succeededCount: number; targetId: string | null; targetType: "agent" | "workflow" | "scorer" | "processor" | null; totalItems: number; trialIndex?: number | null; updatedAt: string; variantId?: string | null; }>

MastraClient.updateDatasetExperiment


updateDatasetExperimentResult(params): Promise<{ attempt?: number; comment?: string | null; completedAt: string; createdAt: string; error: { code?: string; message: string; stack?: string; } | null; expectedTrajectory?: unknown; experimentId: string; groundTruth: unknown; id: string; input: unknown; itemDatasetVersion: number | null; itemId: string; metadata?: {[key: string]: unknown; } | null; output: unknown; retryCount: number; startedAt: string; status?: "needs-review" | "reviewed" | "complete" | null; tags?: string[] | null; toolMockReport?: { failure?: { args: unknown; code: "TOOL_MOCK_MISMATCH" | "TOOL_MOCK_EXHAUSTED" | "TOOL_MOCK_NOT_DECLARED"; toolName: string; }; liveCalls: object[]; served: object[]; unconsumed: object[]; } | null; traceId: string | null; }>

Updates an experiment result’s status, tags, and/or comment

UpdateExperimentResultParams

Promise<{ attempt?: number; comment?: string | null; completedAt: string; createdAt: string; error: { code?: string; message: string; stack?: string; } | null; expectedTrajectory?: unknown; experimentId: string; groundTruth: unknown; id: string; input: unknown; itemDatasetVersion: number | null; itemId: string; metadata?: {[key: string]: unknown; } | null; output: unknown; retryCount: number; startedAt: string; status?: "needs-review" | "reviewed" | "complete" | null; tags?: string[] | null; toolMockReport?: { failure?: { args: unknown; code: "TOOL_MOCK_MISMATCH" | "TOOL_MOCK_EXHAUSTED" | "TOOL_MOCK_NOT_DECLARED"; toolName: string; }; liveCalls: object[]; served: object[]; unconsumed: object[]; } | null; traceId: string | null; }>

MastraClient.updateDatasetExperimentResult


updateDatasetItem(params): Promise<{ createdAt: string; datasetId: string; datasetVersion: number; expectedTrajectory?: unknown; externalId?: string | null; groundTruth?: unknown; id: string; input: unknown; metadata?: {[key: string]: unknown; } | null; requestContext?: {[key: string]: unknown; } | null; scorerIds?: string[] | null; source?: { referenceId?: string; type: "csv" | "json" | "trace" | "llm" | "experiment-result" | "candidate-screener"; } | null; toolMocks?: object[] | null; unmockedToolPolicy?: "allow" | "deny" | null; updatedAt: string; }>

Updates a dataset item

UpdateDatasetItemParams

Promise<{ createdAt: string; datasetId: string; datasetVersion: number; expectedTrajectory?: unknown; externalId?: string | null; groundTruth?: unknown; id: string; input: unknown; metadata?: {[key: string]: unknown; } | null; requestContext?: {[key: string]: unknown; } | null; scorerIds?: string[] | null; source?: { referenceId?: string; type: "csv" | "json" | "trace" | "llm" | "experiment-result" | "candidate-screener"; } | null; toolMocks?: object[] | null; unmockedToolPolicy?: "allow" | "deny" | null; updatedAt: string; }>

MastraClient.updateDatasetItem


updateExperimentResult(params): Promise<DatasetExperimentResult>

Updates the status, tags, and/or comment on an experiment result

UpdateExperimentResultParams

Promise<DatasetExperimentResult>

MastraClient.updateExperimentResult


updateFeedbackReviewStatus(params): Promise<{ comment?: string | null; entityId?: string | null; entityName?: string | null; entityType?: Shared_Type_58 | null; entityVersionId?: string | null; environment?: string | null; executionSource?: string | null; experimentId?: string | null; feedbackId?: string | null; feedbackSource?: string | null; feedbackType: string; feedbackUserId?: string | null; metadata?: {[key: string]: unknown; } | null; organizationId?: string | null; parentEntityId?: string | null; parentEntityName?: string | null; parentEntityType?: Shared_Type_58 | null; parentEntityVersionId?: string | null; requestId?: string | null; resourceId?: string | null; reviewStatus: "needs-review" | "reviewed"; rootEntityId?: string | null; rootEntityName?: string | null; rootEntityType?: Shared_Type_58 | null; rootEntityVersionId?: string | null; runId?: string | null; scope?: {[key: string]: unknown; } | null; serviceName?: string | null; sessionId?: string | null; source?: string | null; sourceId?: string | null; spanId?: string | null; tags?: string[] | null; threadId?: string | null; timestamp: string; traceId?: string | null; userId?: string | null; value: string | number; }>

Updates a feedback record’s review workflow status.

UpdateFeedbackReviewStatusArgs

Promise<{ comment?: string | null; entityId?: string | null; entityName?: string | null; entityType?: Shared_Type_58 | null; entityVersionId?: string | null; environment?: string | null; executionSource?: string | null; experimentId?: string | null; feedbackId?: string | null; feedbackSource?: string | null; feedbackType: string; feedbackUserId?: string | null; metadata?: {[key: string]: unknown; } | null; organizationId?: string | null; parentEntityId?: string | null; parentEntityName?: string | null; parentEntityType?: Shared_Type_58 | null; parentEntityVersionId?: string | null; requestId?: string | null; resourceId?: string | null; reviewStatus: "needs-review" | "reviewed"; rootEntityId?: string | null; rootEntityName?: string | null; rootEntityType?: Shared_Type_58 | null; rootEntityVersionId?: string | null; runId?: string | null; scope?: {[key: string]: unknown; } | null; serviceName?: string | null; sessionId?: string | null; source?: string | null; sourceId?: string | null; spanId?: string | null; tags?: string[] | null; threadId?: string | null; timestamp: string; traceId?: string | null; userId?: string | null; value: string | number; }>

MastraClient.updateFeedbackReviewStatus


updateSchedule(scheduleId, patch): Promise<ScheduleResponse>

Patches an existing schedule. Fields apply to the matching target type; agent-only fields on a workflow schedule are rejected. threadId / resourceId are immutable — to retarget, delete and recreate.

string

UpdateScheduleInput

Promise<ScheduleResponse>

MastraClient.updateSchedule


updateWorkingMemory(agentId): Promise<unknown>

Updates the working memory for a specific thread (optionally resource-scoped).

ID of the agent.

string

RequestContext<unknown> | Record<string, any>

string

string

string

Promise<unknown>

MastraClient.updateWorkingMemory


upsertDynamicWorkflow(params): Promise<{ dependencyIds?: string[]; id: string; ok: true; }>

Creates or replaces a dynamic workflow definition and live-registers it on the server. Optional dependencies lets helper workflows referenced by the root definition be saved in the same request; their ids are echoed back as dependencyIds.

The workflow definition (id, schemas, graph) plus optional helper dependencies

object[]

Helper workflow definitions this workflow nests. Saved with it as one unit — the whole set is validated together, hydrated in derived dependency order, and rejected together, so a failed save never leaves orphaned helpers behind. Each helper becomes an ordinary dynamic workflow in its own right.

string

({ agentId: string; description?: string; id: string; options?: { metadata?: {[key: string]: unknown; }; retries?: number; }; outputSchema?: {[key: string]: unknown; }; type: "agent"; } | { description?: string; id: string; options?: { metadata?: {[key: string]: unknown; }; retries?: number; }; toolId: string; type: "tool"; } | { description?: string; id: string; mapConfig: string; metadata?: {[key: string]: unknown; }; type: "mapping"; } | { description?: string; id: string; type: "workflow"; workflowId: string; } | { description?: string; id?: string; metadata?: {[key: string]: unknown; }; steps: ({ agentId: string; description?: string; id: string; options?: { metadata?: {[key: …]: …; }; retries?: number; }; outputSchema?: {[key: string]: unknown; }; type: "agent"; } | { description?: string; id: string; options?: { metadata?: {[key: …]: …; }; retries?: number; }; toolId: string; type: "tool"; } | { description?: string; id: string; mapConfig: string; metadata?: {[key: string]: unknown; }; type: "mapping"; } | { description?: string; id: string; type: "workflow"; workflowId: string; })[]; type: "parallel"; } | { description?: string; id?: string; metadata?: {[key: string]: unknown; }; opts?: { concurrency: number; }; step: { agentId: string; description?: string; id: string; options?: { metadata?: {[key: string]: unknown; }; retries?: number; }; outputSchema?: {[key: string]: unknown; }; type: "agent"; } | { description?: string; id: string; options?: { metadata?: {[key: string]: unknown; }; retries?: number; }; toolId: string; type: "tool"; } | { description?: string; id: string; type: "workflow"; workflowId: string; }; type: "foreach"; } | { description?: string; duration: number; id: string; metadata?: {[key: string]: unknown; }; type: "sleep"; } | { date: string; description?: string; id: string; metadata?: {[key: string]: unknown; }; type: "sleepUntil"; } | { description?: string; id?: string; metadata?: {[key: string]: unknown; }; predicates: ({ left: { path: string; } | { literal: string | number | boolean | null; }; op: "eq" | "ne" | "lt" | "lte" | "gt" | "gte"; right: { path: string; } | { literal: string | number | boolean | null; }; } | { op: "in" | "notIn"; set: (string | number | boolean | null)[]; value: { path: string; } | { literal: string | number | boolean | null; }; } | { op: "exists" | "notExists"; path: string; } | { op: "truthy" | "falsy"; value: { path: string; } | { literal: string | number | boolean | null; }; } | { args: ({ op: “eq” | “ne” | “lt” | “lte” | “gt” | “gte”; left: { path: string; } | { literal: string | number | boolean | null; }; right: { path: string; } | { literal: string | number | boolean | null; }; } | … 4 more … | { …; })[]; op: "and" | "or"; } | { arg: { op: “eq” | “ne” | “lt” | “lte” | “gt” | “gte”; left: { path: string; } | { literal: string | number | boolean | null; }; right: { path: string; } | { literal: string | number | boolean | null; }; } | … 4 more … | { …; }; op: "not"; })[]; steps: ({ agentId: string; description?: string; id: string; options?: { metadata?: {[key: …]: …; }; retries?: number; }; outputSchema?: {[key: string]: unknown; }; type: "agent"; } | { description?: string; id: string; options?: { metadata?: {[key: …]: …; }; retries?: number; }; toolId: string; type: "tool"; } | { description?: string; id: string; mapConfig: string; metadata?: {[key: string]: unknown; }; type: "mapping"; } | { description?: string; id: string; type: "workflow"; workflowId: string; })[]; type: "conditional"; } | { description?: string; id?: string; loopType: "dowhile" | "dountil"; metadata?: {[key: string]: unknown; }; predicate: { left: { path: string; } | { literal: string | number | boolean | null; }; op: "eq" | "ne" | "lt" | "lte" | "gt" | "gte"; right: { path: string; } | { literal: string | number | boolean | null; }; } | { op: "in" | "notIn"; set: (string | number | boolean | null)[]; value: { path: string; } | { literal: string | number | boolean | null; }; } | { op: "exists" | "notExists"; path: string; } | { op: "truthy" | "falsy"; value: { path: string; } | { literal: string | number | boolean | null; }; } | { args: { op: “eq” | “ne” | “lt” | “lte” | “gt” | “gte”; left: { path: string; } | { literal: string | number | boolean | null; }; right: { path: string; } | { literal: string | number | boolean | null; }; } | … 4 more … | { …; }[]; op: "and" | "or"; } | { arg: { op: “eq” | “ne” | “lt” | “lte” | “gt” | “gte”; left: { path: string; } | { literal: string | number | boolean | null; }; right: { path: string; } | { literal: string | number | boolean | null; }; } | … 4 more … | { …; }; op: "not"; }; step: { agentId: string; description?: string; id: string; options?: { metadata?: {[key: string]: unknown; }; retries?: number; }; outputSchema?: {[key: string]: unknown; }; type: "agent"; } | { description?: string; id: string; options?: { metadata?: {[key: string]: unknown; }; retries?: number; }; toolId: string; type: "tool"; } | { description?: string; id: string; mapConfig: string; metadata?: {[key: string]: unknown; }; type: "mapping"; } | { description?: string; id: string; type: "workflow"; workflowId: string; }; type: "loop"; })[]

Static workflow graph — ordered array of serialized step entries with all refs as ids.

string

Workflow id — kebab-case, descriptive

{[key: string]: unknown; }

JSON Schema (Draft 2020-12) for the workflow input

{[key: string]: unknown; }

{[key: string]: unknown; }

JSON Schema (Draft 2020-12) for the workflow output

{[key: string]: unknown; }

{[key: string]: unknown; }

Promise<{ dependencyIds?: string[]; id: string; ok: true; }>

Promise containing the persisted definition and any dependency ids

MastraClient.upsertDynamicWorkflow