@mastra/mcp-docs-server 0.0.0-studio-deploy-20260404182525 → 0.0.0-studio-cli-20260504022012
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.docs/docs/agents/adding-voice.md +18 -17
- package/.docs/docs/agents/background-tasks.md +242 -0
- package/.docs/docs/agents/channels.md +2 -1
- package/.docs/docs/agents/overview.md +4 -0
- package/.docs/docs/agents/processors.md +177 -5
- package/.docs/docs/agents/structured-output.md +66 -1
- package/.docs/docs/agents/supervisor-agents.md +65 -0
- package/.docs/docs/agents/using-tools.md +73 -0
- package/.docs/docs/browser/agent-browser.md +78 -0
- package/.docs/docs/browser/browser-viewer.md +144 -0
- package/.docs/docs/browser/overview.md +168 -0
- package/.docs/docs/browser/stagehand.md +129 -0
- package/.docs/docs/deployment/cloud-providers.md +5 -1
- package/.docs/docs/deployment/mastra-server.md +4 -4
- package/.docs/docs/deployment/monorepo.md +3 -3
- package/.docs/docs/deployment/overview.md +11 -8
- package/.docs/docs/editor/overview.md +290 -0
- package/.docs/docs/editor/prompts.md +134 -0
- package/.docs/docs/editor/tools.md +152 -0
- package/.docs/docs/evals/custom-scorers.md +63 -3
- package/.docs/docs/evals/datasets/overview.md +1 -1
- package/.docs/docs/index.md +2 -2
- package/.docs/docs/mastra-platform/configuration.md +36 -0
- package/.docs/docs/mastra-platform/overview.md +78 -0
- package/.docs/docs/mcp/overview.md +17 -0
- package/.docs/docs/memory/memory-processors.md +3 -3
- package/.docs/docs/memory/message-history.md +8 -2
- package/.docs/docs/memory/observational-memory.md +65 -8
- package/.docs/docs/memory/storage.md +1 -2
- package/.docs/docs/memory/working-memory.md +2 -2
- package/.docs/docs/observability/logging.md +1 -1
- package/.docs/docs/observability/metrics/overview.md +2 -2
- package/.docs/docs/observability/overview.md +1 -1
- package/.docs/docs/observability/tracing/bridges/datadog.md +217 -0
- package/.docs/docs/observability/tracing/bridges/otel.md +2 -2
- package/.docs/docs/observability/tracing/exporters/arthur.md +163 -0
- package/.docs/docs/observability/tracing/exporters/cloud.md +135 -63
- package/.docs/docs/observability/tracing/exporters/datadog.md +3 -1
- package/.docs/docs/observability/tracing/exporters/default.md +5 -5
- package/.docs/docs/observability/tracing/exporters/laminar.md +22 -14
- package/.docs/docs/observability/tracing/exporters/langfuse.md +50 -33
- package/.docs/docs/observability/tracing/overview.md +87 -20
- package/.docs/docs/server/custom-adapters.md +5 -5
- package/.docs/docs/server/custom-api-routes.md +3 -3
- package/.docs/docs/server/mastra-client.md +2 -2
- package/.docs/docs/server/mastra-server.md +1 -1
- package/.docs/docs/server/middleware.md +46 -42
- package/.docs/docs/server/request-context.md +13 -2
- package/.docs/docs/server/server-adapters.md +91 -8
- package/.docs/docs/streaming/background-task-streaming.md +80 -0
- package/.docs/docs/streaming/overview.md +3 -0
- package/.docs/docs/studio/deployment.md +24 -6
- package/.docs/docs/studio/observability.md +1 -1
- package/.docs/docs/studio/overview.md +4 -4
- package/.docs/docs/voice/overview.md +74 -5
- package/.docs/docs/voice/speech-to-speech.md +45 -1
- package/.docs/docs/voice/speech-to-text.md +7 -7
- package/.docs/docs/voice/text-to-speech.md +10 -10
- package/.docs/docs/workflows/agents-and-tools.md +1 -1
- package/.docs/docs/workflows/overview.md +105 -4
- package/.docs/docs/workflows/scheduled-workflows.md +181 -0
- package/.docs/docs/workspace/filesystem.md +64 -6
- package/.docs/docs/workspace/lsp.md +76 -4
- package/.docs/docs/workspace/overview.md +62 -15
- package/.docs/docs/workspace/sandbox.md +3 -1
- package/.docs/docs/workspace/search.md +41 -2
- package/.docs/docs/workspace/skills.md +19 -19
- package/.docs/guides/agent-frameworks/ai-sdk.md +4 -4
- package/.docs/guides/build-your-ui/ai-sdk-ui.md +56 -9
- package/.docs/guides/build-your-ui/assistant-ui.md +1 -1
- package/.docs/guides/deployment/mastra-platform.md +191 -0
- package/.docs/guides/deployment/netlify.md +16 -1
- package/.docs/guides/getting-started/nestjs.md +238 -0
- package/.docs/guides/getting-started/next-js.md +0 -4
- package/.docs/guides/guide/code-review-bot.md +2 -2
- package/.docs/guides/guide/dev-assistant.md +4 -4
- package/.docs/{docs/mcp → guides/guide}/publishing-mcp-server.md +21 -1
- package/.docs/guides/guide/slack-assistant.md +191 -0
- package/.docs/guides/migrations/mastra-cloud.md +368 -0
- package/.docs/guides/migrations/upgrade-to-v1/tracing.md +1 -1
- package/.docs/models/embeddings.md +3 -3
- package/.docs/models/gateways/azure-openai.md +74 -35
- package/.docs/models/gateways/mastra.md +64 -0
- package/.docs/models/gateways/netlify.md +7 -3
- package/.docs/models/gateways/openrouter.md +28 -12
- package/.docs/models/gateways/vercel.md +22 -2
- package/.docs/models/gateways.md +1 -0
- package/.docs/models/index.md +43 -8
- package/.docs/models/providers/302ai.md +37 -4
- package/.docs/models/providers/abliteration-ai.md +71 -0
- package/.docs/models/providers/alibaba-cn.md +8 -2
- package/.docs/models/providers/alibaba-coding-plan-cn.md +3 -2
- package/.docs/models/providers/alibaba-coding-plan.md +3 -2
- package/.docs/models/providers/alibaba.md +8 -1
- package/.docs/models/providers/anthropic.md +18 -5
- package/.docs/models/providers/baseten.md +3 -1
- package/.docs/models/providers/berget.md +10 -12
- package/.docs/models/providers/chutes.md +4 -2
- package/.docs/models/providers/cloudflare-workers-ai.md +14 -48
- package/.docs/models/providers/cortecs.md +22 -2
- package/.docs/models/providers/deepinfra.md +8 -2
- package/.docs/models/providers/deepseek.md +6 -4
- package/.docs/models/providers/digitalocean.md +133 -0
- package/.docs/models/providers/fireworks-ai.md +6 -1
- package/.docs/models/providers/firmware.md +12 -10
- package/.docs/models/providers/friendli.md +6 -7
- package/.docs/models/providers/google.md +9 -3
- package/.docs/models/providers/helicone.md +1 -2
- package/.docs/models/providers/hpc-ai.md +73 -0
- package/.docs/models/providers/huggingface.md +6 -2
- package/.docs/models/providers/inception.md +9 -11
- package/.docs/models/providers/kilo.md +359 -339
- package/.docs/models/providers/kimi-for-coding.md +2 -1
- package/.docs/models/providers/llmgateway.md +67 -77
- package/.docs/models/providers/mistral.md +3 -2
- package/.docs/models/providers/mixlayer.md +75 -0
- package/.docs/models/providers/moonshotai-cn.md +3 -2
- package/.docs/models/providers/moonshotai.md +3 -2
- package/.docs/models/providers/nano-gpt.md +8 -2
- package/.docs/models/providers/neuralwatt.md +84 -0
- package/.docs/models/providers/novita-ai.md +19 -4
- package/.docs/models/providers/nvidia.md +8 -1
- package/.docs/models/providers/ollama-cloud.md +7 -2
- package/.docs/models/providers/openai.md +7 -2
- package/.docs/models/providers/opencode-go.md +21 -13
- package/.docs/models/providers/opencode.md +11 -4
- package/.docs/models/providers/ovhcloud.md +6 -8
- package/.docs/models/providers/poe.md +10 -15
- package/.docs/models/providers/regolo-ai.md +83 -0
- package/.docs/models/providers/siliconflow-cn.md +5 -2
- package/.docs/models/providers/siliconflow.md +6 -3
- package/.docs/models/providers/stepfun.md +8 -7
- package/.docs/models/providers/synthetic.md +5 -2
- package/.docs/models/providers/tencent-token-plan.md +71 -0
- package/.docs/models/providers/tencent-tokenhub.md +71 -0
- package/.docs/models/providers/togetherai.md +8 -7
- package/.docs/models/providers/vivgrid.md +7 -3
- package/.docs/models/providers/vultr.md +7 -6
- package/.docs/models/providers/wafer.ai.md +73 -0
- package/.docs/models/providers/wandb.md +3 -2
- package/.docs/models/providers/xai.md +6 -1
- package/.docs/models/providers/xiaomi-token-plan-ams.md +75 -0
- package/.docs/models/providers/xiaomi-token-plan-cn.md +75 -0
- package/.docs/models/providers/xiaomi-token-plan-sgp.md +75 -0
- package/.docs/models/providers/xiaomi.md +4 -2
- package/.docs/models/providers/zai-coding-plan.md +11 -19
- package/.docs/models/providers/zai.md +2 -1
- package/.docs/models/providers/zenmux.md +17 -6
- package/.docs/models/providers/zhipuai-coding-plan.md +11 -21
- package/.docs/models/providers/zhipuai.md +2 -1
- package/.docs/models/providers.md +11 -0
- package/.docs/reference/agents/agent.md +1 -1
- package/.docs/reference/agents/channels.md +3 -3
- package/.docs/reference/agents/generate.md +88 -6
- package/.docs/reference/agents/generateLegacy.md +1 -1
- package/.docs/reference/ai-sdk/chat-route.md +2 -0
- package/.docs/reference/ai-sdk/handle-chat-stream.md +19 -0
- package/.docs/reference/ai-sdk/handle-network-stream.md +2 -0
- package/.docs/reference/ai-sdk/network-route.md +2 -0
- package/.docs/reference/ai-sdk/to-ai-sdk-messages.md +95 -0
- package/.docs/reference/ai-sdk/to-ai-sdk-stream.md +15 -0
- package/.docs/reference/browser/agent-browser.md +375 -0
- package/.docs/reference/browser/browser-viewer.md +228 -0
- package/.docs/reference/browser/mastra-browser.md +286 -0
- package/.docs/reference/browser/stagehand-browser.md +286 -0
- package/.docs/reference/cli/mastra.md +703 -0
- package/.docs/reference/client-js/agents.md +166 -0
- package/.docs/reference/client-js/conversations.md +1 -1
- package/.docs/reference/client-js/mastra-client.md +23 -0
- package/.docs/reference/client-js/observability.md +2 -2
- package/.docs/reference/client-js/responses.md +1 -1
- package/.docs/reference/client-js/workflows.md +62 -1
- package/.docs/reference/configuration.md +67 -1
- package/.docs/reference/core/addGateway.md +5 -5
- package/.docs/reference/core/getEditor.md +35 -0
- package/.docs/reference/core/getGateway.md +5 -5
- package/.docs/reference/core/getGatewayById.md +5 -5
- package/.docs/reference/core/getMCPServer.md +2 -2
- package/.docs/reference/core/getMCPServerById.md +2 -2
- package/.docs/reference/core/getScorer.md +3 -3
- package/.docs/reference/core/getScorerById.md +3 -3
- package/.docs/reference/core/listGateways.md +5 -5
- package/.docs/reference/core/listMCPServers.md +2 -2
- package/.docs/reference/core/listScorers.md +3 -3
- package/.docs/reference/core/mastra-class.md +11 -1
- package/.docs/reference/core/mastra-model-gateway.md +5 -5
- package/.docs/reference/datasets/create.md +4 -4
- package/.docs/reference/datasets/startExperiment.md +28 -2
- package/.docs/reference/datasets/update.md +4 -4
- package/.docs/reference/deployer/cloudflare.md +14 -1
- package/.docs/reference/deployer/netlify.md +50 -2
- package/.docs/reference/editor/mastra-editor.md +168 -0
- package/.docs/reference/editor/tool-provider.md +85 -0
- package/.docs/reference/evals/context-precision.md +3 -3
- package/.docs/reference/evals/context-relevance.md +3 -3
- package/.docs/reference/evals/create-scorer.md +5 -3
- package/.docs/reference/evals/filter-run.md +117 -0
- package/.docs/reference/evals/mastra-scorer.md +4 -4
- package/.docs/reference/evals/noise-sensitivity.md +6 -6
- package/.docs/reference/evals/prompt-alignment.md +12 -12
- package/.docs/reference/evals/run-evals.md +6 -6
- package/.docs/reference/evals/scorer-utils.md +3 -3
- package/.docs/reference/evals/trajectory-accuracy.md +3 -3
- package/.docs/reference/harness/harness-class.md +152 -53
- package/.docs/reference/index.md +25 -0
- package/.docs/reference/logging/pino-logger.md +0 -2
- package/.docs/reference/mastra-platform/api.md +108 -0
- package/.docs/reference/memory/clone-utilities.md +4 -2
- package/.docs/reference/memory/cloneThread.md +4 -2
- package/.docs/reference/memory/observational-memory.md +4 -0
- package/.docs/reference/observability/metrics/automatic-metrics.md +3 -3
- package/.docs/reference/observability/tracing/bridges/datadog.md +211 -0
- package/.docs/reference/observability/tracing/bridges/otel.md +3 -3
- package/.docs/reference/observability/tracing/configuration.md +18 -11
- package/.docs/reference/observability/tracing/exporters/arthur.md +122 -0
- package/.docs/reference/observability/tracing/exporters/cloud-exporter.md +102 -21
- package/.docs/reference/observability/tracing/exporters/console-exporter.md +8 -8
- package/.docs/reference/observability/tracing/exporters/datadog.md +3 -1
- package/.docs/reference/observability/tracing/exporters/default-exporter.md +8 -8
- package/.docs/reference/observability/tracing/exporters/langfuse.md +25 -32
- package/.docs/reference/observability/tracing/exporters/otel.md +3 -3
- package/.docs/reference/observability/tracing/instances.md +7 -7
- package/.docs/reference/observability/tracing/interfaces.md +23 -6
- package/.docs/reference/observability/tracing/span-filtering.md +95 -0
- package/.docs/reference/observability/tracing/spans.md +6 -6
- package/.docs/reference/processors/prefill-error-handler.md +70 -0
- package/.docs/reference/processors/processor-interface.md +400 -40
- package/.docs/reference/processors/skill-search-processor.md +20 -1
- package/.docs/reference/processors/stream-error-retry-processor.md +54 -0
- package/.docs/reference/processors/tool-call-filter.md +23 -0
- package/.docs/reference/server/create-route.md +3 -3
- package/.docs/reference/server/express-adapter.md +4 -4
- package/.docs/reference/server/fastify-adapter.md +4 -4
- package/.docs/reference/server/hono-adapter.md +4 -4
- package/.docs/reference/server/koa-adapter.md +4 -4
- package/.docs/reference/server/mastra-server.md +3 -3
- package/.docs/reference/server/nestjs-adapter.md +169 -0
- package/.docs/reference/server/register-api-route.md +4 -4
- package/.docs/reference/server/routes.md +11 -10
- package/.docs/reference/storage/clickhouse.md +300 -0
- package/.docs/reference/storage/cloudflare-d1.md +42 -42
- package/.docs/reference/storage/composite.md +5 -3
- package/.docs/reference/storage/duckdb.md +150 -0
- package/.docs/reference/storage/overview.md +1 -1
- package/.docs/reference/storage/redis.md +266 -0
- package/.docs/reference/streaming/ChunkType.md +143 -3
- package/.docs/reference/streaming/agents/MastraModelOutput.md +2 -2
- package/.docs/reference/streaming/agents/stream.md +10 -2
- package/.docs/reference/streaming/agents/streamUntilIdle.md +94 -0
- package/.docs/reference/streaming/workflows/resumeStream.md +2 -0
- package/.docs/reference/templates/overview.md +88 -14
- package/.docs/reference/tools/create-tool.md +107 -5
- package/.docs/reference/tools/mcp-client.md +45 -0
- package/.docs/reference/tools/mcp-server.md +1 -3
- package/.docs/reference/tools/perplexity.md +155 -0
- package/.docs/reference/tools/tavily.md +307 -0
- package/.docs/reference/vectors/mongodb.md +0 -2
- package/.docs/reference/voice/aws-nova-sonic.md +247 -0
- package/.docs/reference/voice/cloudflare.md +3 -3
- package/.docs/reference/voice/sarvam.md +29 -23
- package/.docs/reference/voice/voice.connect.md +4 -4
- package/.docs/reference/voice/voice.listen.md +3 -3
- package/.docs/reference/workflows/run-methods/resume.md +24 -0
- package/.docs/reference/workflows/run-methods/startAsync.md +1 -1
- package/.docs/reference/workflows/step.md +88 -7
- package/.docs/reference/workflows/workflow-methods/foreach.md +14 -1
- package/.docs/reference/workflows/workflow.md +88 -4
- package/.docs/reference/workspace/azure-blob-filesystem.md +219 -0
- package/.docs/reference/workspace/docker-sandbox.md +196 -0
- package/.docs/reference/workspace/gcs-filesystem.md +1 -0
- package/.docs/reference/workspace/google-drive-filesystem.md +185 -0
- package/.docs/reference/workspace/modal-sandbox.md +168 -0
- package/.docs/reference/workspace/process-manager.md +1 -1
- package/.docs/reference/workspace/s3-filesystem.md +80 -5
- package/.docs/reference/workspace/vercel.md +1 -1
- package/.docs/reference/workspace/workspace-class.md +37 -6
- package/CHANGELOG.md +500 -4
- package/dist/stdio.js.map +1 -1
- package/dist/utils.d.ts +1 -4
- package/dist/utils.d.ts.map +1 -1
- package/package.json +11 -11
- package/.docs/docs/mastra-cloud/deployment.md +0 -77
- package/.docs/docs/mastra-cloud/observability.md +0 -38
- package/.docs/docs/mastra-cloud/overview.md +0 -23
- package/.docs/docs/mastra-cloud/setup.md +0 -42
|
@@ -151,6 +151,30 @@ for await (const part of uiMessageStream) {
|
|
|
151
151
|
}
|
|
152
152
|
```
|
|
153
153
|
|
|
154
|
+
### `streamUntilIdle()`
|
|
155
|
+
|
|
156
|
+
Stream a response and keep the stream open until every [background task](https://mastra.ai/docs/agents/background-tasks) dispatched during the run completes. The server re-enters the agentic loop on each task completion so the LLM can react to results in the same call. Requires background tasks to be [enabled on the Mastra instance](https://mastra.ai/reference/configuration) and a memory thread; otherwise the call falls through to a plain `stream()`.
|
|
157
|
+
|
|
158
|
+
```typescript
|
|
159
|
+
const response = await agent.streamUntilIdle('Research solana for me', {
|
|
160
|
+
memory: {
|
|
161
|
+
thread: 'thread-1',
|
|
162
|
+
resource: 'resource-1',
|
|
163
|
+
},
|
|
164
|
+
maxIdleMs: 5 * 60_000,
|
|
165
|
+
})
|
|
166
|
+
|
|
167
|
+
response.processDataStream({
|
|
168
|
+
onChunk: async chunk => {
|
|
169
|
+
if (chunk.type === 'background-task-completed') {
|
|
170
|
+
console.log('task complete:', chunk.payload.taskId)
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
})
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
The stream emits the same chunk types as `stream()`, plus `background-task-*` chunks for task lifecycle events. Visit [`Agent.streamUntilIdle()`](https://mastra.ai/reference/streaming/agents/streamUntilIdle) for the full server-side API and [background task chunks](https://mastra.ai/reference/streaming/ChunkType) for the payload shapes.
|
|
177
|
+
|
|
154
178
|
### `getTool()`
|
|
155
179
|
|
|
156
180
|
Retrieve information about a specific tool available to the agent:
|
|
@@ -217,6 +241,26 @@ response.processDataStream({
|
|
|
217
241
|
})
|
|
218
242
|
```
|
|
219
243
|
|
|
244
|
+
### `resumeStream()`
|
|
245
|
+
|
|
246
|
+
Resume a suspended agent stream with custom data. Use this to continue execution after a suspension point, such as a workflow suspend within an agent:
|
|
247
|
+
|
|
248
|
+
```typescript
|
|
249
|
+
const response = await agent.resumeStream(
|
|
250
|
+
{ approved: true, selectedOption: 'plan-b' },
|
|
251
|
+
{
|
|
252
|
+
runId: 'run-123',
|
|
253
|
+
toolCallId: 'tool-call-456', // optional
|
|
254
|
+
},
|
|
255
|
+
)
|
|
256
|
+
|
|
257
|
+
await response.processDataStream({
|
|
258
|
+
onChunk: chunk => {
|
|
259
|
+
console.log(chunk)
|
|
260
|
+
},
|
|
261
|
+
})
|
|
262
|
+
```
|
|
263
|
+
|
|
220
264
|
### `approveToolCallGenerate()`
|
|
221
265
|
|
|
222
266
|
Approve a pending tool call when using `generate()` (non-streaming). Returns the complete response:
|
|
@@ -439,4 +483,126 @@ Delete a stored agent:
|
|
|
439
483
|
```typescript
|
|
440
484
|
const result = await storedAgent.delete()
|
|
441
485
|
console.log(result.success) // true
|
|
486
|
+
```
|
|
487
|
+
|
|
488
|
+
## Version management
|
|
489
|
+
|
|
490
|
+
Both `Agent` (code-defined) and `StoredAgent` instances have methods for managing configuration versions. See the [Editor overview](https://mastra.ai/docs/editor/overview) for an introduction to version management.
|
|
491
|
+
|
|
492
|
+
### Getting an agent with a specific version
|
|
493
|
+
|
|
494
|
+
Pass a version identifier when getting an agent:
|
|
495
|
+
|
|
496
|
+
```typescript
|
|
497
|
+
// Load the published version (default)
|
|
498
|
+
const agent = mastraClient.getAgent('support-agent')
|
|
499
|
+
|
|
500
|
+
// Load the latest draft
|
|
501
|
+
const draftAgent = mastraClient.getAgent('support-agent', { status: 'draft' })
|
|
502
|
+
|
|
503
|
+
// Load a specific version
|
|
504
|
+
const versionedAgent = mastraClient.getAgent('support-agent', { versionId: 'abc-123' })
|
|
505
|
+
```
|
|
506
|
+
|
|
507
|
+
For stored agents, pass a status option to `details()`:
|
|
508
|
+
|
|
509
|
+
```typescript
|
|
510
|
+
const storedAgent = mastraClient.getStoredAgent('my-agent')
|
|
511
|
+
const draft = await storedAgent.details(undefined, { status: 'draft' })
|
|
512
|
+
```
|
|
513
|
+
|
|
514
|
+
### `listVersions()`
|
|
515
|
+
|
|
516
|
+
List all versions for an agent:
|
|
517
|
+
|
|
518
|
+
```typescript
|
|
519
|
+
const versions = await agent.listVersions()
|
|
520
|
+
console.log(versions.items) // Array of version snapshots
|
|
521
|
+
console.log(versions.total)
|
|
522
|
+
```
|
|
523
|
+
|
|
524
|
+
With pagination and sorting:
|
|
525
|
+
|
|
526
|
+
```typescript
|
|
527
|
+
const versions = await agent.listVersions({
|
|
528
|
+
page: 0,
|
|
529
|
+
perPage: 10,
|
|
530
|
+
orderBy: {
|
|
531
|
+
field: 'createdAt',
|
|
532
|
+
direction: 'DESC',
|
|
533
|
+
},
|
|
534
|
+
})
|
|
535
|
+
```
|
|
536
|
+
|
|
537
|
+
### `createVersion()`
|
|
538
|
+
|
|
539
|
+
Create a new version snapshot:
|
|
540
|
+
|
|
541
|
+
```typescript
|
|
542
|
+
const version = await agent.createVersion({
|
|
543
|
+
changeMessage: 'Updated tone to be more friendly',
|
|
544
|
+
})
|
|
545
|
+
```
|
|
546
|
+
|
|
547
|
+
### `getVersion()`
|
|
548
|
+
|
|
549
|
+
Get a specific version by ID:
|
|
550
|
+
|
|
551
|
+
```typescript
|
|
552
|
+
const version = await agent.getVersion('version-123')
|
|
553
|
+
console.log(version.versionNumber)
|
|
554
|
+
console.log(version.changedFields)
|
|
555
|
+
console.log(version.createdAt)
|
|
556
|
+
```
|
|
557
|
+
|
|
558
|
+
### `activateVersion()`
|
|
559
|
+
|
|
560
|
+
Set a version as the active published version:
|
|
561
|
+
|
|
562
|
+
```typescript
|
|
563
|
+
await agent.activateVersion('version-123')
|
|
564
|
+
```
|
|
565
|
+
|
|
566
|
+
### `restoreVersion()`
|
|
567
|
+
|
|
568
|
+
Restore a previous version by creating a new version with the same configuration:
|
|
569
|
+
|
|
570
|
+
```typescript
|
|
571
|
+
await agent.restoreVersion('version-456')
|
|
572
|
+
```
|
|
573
|
+
|
|
574
|
+
### `deleteVersion()`
|
|
575
|
+
|
|
576
|
+
Delete a version:
|
|
577
|
+
|
|
578
|
+
```typescript
|
|
579
|
+
await agent.deleteVersion('version-789')
|
|
580
|
+
```
|
|
581
|
+
|
|
582
|
+
### `compareVersions()`
|
|
583
|
+
|
|
584
|
+
Compare two versions and return their differences:
|
|
585
|
+
|
|
586
|
+
```typescript
|
|
587
|
+
const diff = await agent.compareVersions('version-123', 'version-456')
|
|
588
|
+
console.log(diff.changes) // Fields that changed between versions
|
|
589
|
+
```
|
|
590
|
+
|
|
591
|
+
### React SDK
|
|
592
|
+
|
|
593
|
+
In the React SDK, pass an `agentVersionId` through `requestContext` when using the `useChat` hook:
|
|
594
|
+
|
|
595
|
+
```typescript
|
|
596
|
+
import { useChat } from '@mastra/react'
|
|
597
|
+
|
|
598
|
+
function Chat() {
|
|
599
|
+
const { messages, input, handleInputChange, handleSubmit } = useChat({
|
|
600
|
+
agentId: 'support-agent',
|
|
601
|
+
requestContext: {
|
|
602
|
+
agentVersionId: 'abc-123',
|
|
603
|
+
},
|
|
604
|
+
})
|
|
605
|
+
|
|
606
|
+
// ... render chat UI
|
|
607
|
+
}
|
|
442
608
|
```
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# OpenAI Responses API Conversations
|
|
2
2
|
|
|
3
|
-
The OpenAI Responses API Conversations surface provides methods to create, retrieve, delete, and inspect thread-backed conversations in Mastra.
|
|
3
|
+
The OpenAI Responses API Conversations surface gives you the conversation-management side of Mastra Agents as a Responses API. It provides methods to create, retrieve, delete, and inspect thread-backed conversations in Mastra.
|
|
4
4
|
|
|
5
5
|
This API follows up on the [OpenAI Responses API](https://mastra.ai/reference/client-js/responses). Stored Responses calls return `conversation_id`, and in Mastra that value is the raw memory `threadId`. Use `client.conversations` when you want to work with that thread directly.
|
|
6
6
|
|
|
@@ -12,6 +12,29 @@ export const mastraClient = new MastraClient({
|
|
|
12
12
|
})
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
+
## `RequestContext`
|
|
16
|
+
|
|
17
|
+
When you use `RequestContext` with the client SDK, import it from `@mastra/client-js`.
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
import { MastraClient, RequestContext } from '@mastra/client-js'
|
|
21
|
+
|
|
22
|
+
const client = new MastraClient({
|
|
23
|
+
baseUrl: 'http://localhost:4111/',
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
const requestContext = new RequestContext()
|
|
27
|
+
requestContext.set('userId', 'user-123')
|
|
28
|
+
|
|
29
|
+
const agent = client.getAgent('support-agent')
|
|
30
|
+
|
|
31
|
+
const response = await agent.generate('Summarize this ticket', {
|
|
32
|
+
requestContext,
|
|
33
|
+
})
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
You can also pass `requestContext` as a `Record<string, any>`.
|
|
37
|
+
|
|
15
38
|
## Parameters
|
|
16
39
|
|
|
17
40
|
**baseUrl** (`string`): The base URL for the Mastra API. All requests will be sent relative to this URL.
|
|
@@ -68,5 +68,5 @@ const scores = await mastraClient.listScoresBySpan({
|
|
|
68
68
|
|
|
69
69
|
## Related
|
|
70
70
|
|
|
71
|
-
- [Agents API](https://mastra.ai/reference/client-js/agents)
|
|
72
|
-
- [Workflows API](https://mastra.ai/reference/client-js/workflows)
|
|
71
|
+
- [Agents API](https://mastra.ai/reference/client-js/agents): Learn about agent interactions that generate traces
|
|
72
|
+
- [Workflows API](https://mastra.ai/reference/client-js/workflows): Understand workflow execution monitoring
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# OpenAI Responses API
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This OpenAI-compatible, agent-backed interface lets you use Mastra Agents as a Responses API. It provides methods to create, retrieve, stream, and delete responses through Mastra agents.
|
|
4
4
|
|
|
5
5
|
These routes are agent-backed adapters over Mastra agents, memory, and storage. Use `agent_id` to select the Mastra agent that should handle the request. You can pass `model` to override the agent's configured model for a single request, or omit it to use the model already configured on the agent.
|
|
6
6
|
|
|
@@ -140,6 +140,18 @@ await run.resume({
|
|
|
140
140
|
})
|
|
141
141
|
```
|
|
142
142
|
|
|
143
|
+
When a [`.foreach()`](https://mastra.ai/reference/workflows/workflow-methods/foreach) step suspends across multiple iterations, pass `forEachIndex` (zero-based; `0` targets the first iteration) to resume one iteration at a time. Iterations you don't target remain suspended.
|
|
144
|
+
|
|
145
|
+
```typescript
|
|
146
|
+
await run.resume({
|
|
147
|
+
step: 'approve',
|
|
148
|
+
resumeData: { ok: true },
|
|
149
|
+
forEachIndex: 1, // resumes the second iteration
|
|
150
|
+
})
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
`forEachIndex` is also supported by `resumeAsync()` and `resumeStream()`.
|
|
154
|
+
|
|
143
155
|
### `cancel()`
|
|
144
156
|
|
|
145
157
|
Cancel a running workflow:
|
|
@@ -196,4 +208,53 @@ A workflow run result yields the following:
|
|
|
196
208
|
|
|
197
209
|
**eventTimestamp** (`Date`): The timestamp of the event
|
|
198
210
|
|
|
199
|
-
**payload** (`object`): Contains currentStep (id, status, output, payload) and workflowState (status, steps record)
|
|
211
|
+
**payload** (`object`): Contains currentStep (id, status, output, payload) and workflowState (status, steps record)
|
|
212
|
+
|
|
213
|
+
## Schedules
|
|
214
|
+
|
|
215
|
+
Schedules are declared in code via the `schedule` field on `createWorkflow`. The client SDK exposes read and operational methods for managing them at runtime. See [Scheduled workflows](https://mastra.ai/docs/workflows/scheduled-workflows).
|
|
216
|
+
|
|
217
|
+
### `listSchedules()`
|
|
218
|
+
|
|
219
|
+
List all schedules, optionally filtered by workflow id or status.
|
|
220
|
+
|
|
221
|
+
```typescript
|
|
222
|
+
const schedules = await mastraClient.listSchedules({
|
|
223
|
+
workflowId: 'daily-report',
|
|
224
|
+
status: 'active',
|
|
225
|
+
})
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
### `getSchedule()`
|
|
229
|
+
|
|
230
|
+
Fetch a single schedule by id.
|
|
231
|
+
|
|
232
|
+
```typescript
|
|
233
|
+
const schedule = await mastraClient.getSchedule('daily-report')
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### `pauseSchedule()`
|
|
237
|
+
|
|
238
|
+
Pause a schedule so the scheduler stops firing it. Returns the updated schedule. Idempotent.
|
|
239
|
+
|
|
240
|
+
```typescript
|
|
241
|
+
await mastraClient.pauseSchedule('daily-report')
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
### `resumeSchedule()`
|
|
245
|
+
|
|
246
|
+
Resume a paused schedule. The next fire time is recomputed from now, so a long-paused schedule does not fire a backlog. Returns the updated schedule. Idempotent.
|
|
247
|
+
|
|
248
|
+
```typescript
|
|
249
|
+
await mastraClient.resumeSchedule('daily-report')
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
### `listScheduleTriggers()`
|
|
253
|
+
|
|
254
|
+
List the trigger history for a schedule, including the joined run summary for each fire.
|
|
255
|
+
|
|
256
|
+
```typescript
|
|
257
|
+
const { triggers } = await mastraClient.listScheduleTriggers('daily-report', {
|
|
258
|
+
limit: 50,
|
|
259
|
+
})
|
|
260
|
+
```
|
|
@@ -36,6 +36,69 @@ export const mastra = new Mastra({
|
|
|
36
36
|
})
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
+
### backgroundTasks
|
|
40
|
+
|
|
41
|
+
**Type:** `BackgroundTaskManagerConfig`
|
|
42
|
+
|
|
43
|
+
Enables and configures the background task manager. When enabled, agents can dispatch long-running tool calls (including subagent invocations) to run asynchronously while the agentic loop continues. Tasks are persisted, so a configured `storage` backend is required.
|
|
44
|
+
|
|
45
|
+
Visit the [Background tasks documentation](https://mastra.ai/docs/agents/background-tasks) to learn more.
|
|
46
|
+
|
|
47
|
+
```typescript
|
|
48
|
+
import { Mastra } from '@mastra/core'
|
|
49
|
+
import { LibSQLStore } from '@mastra/libsql'
|
|
50
|
+
|
|
51
|
+
export const mastra = new Mastra({
|
|
52
|
+
storage: new LibSQLStore({
|
|
53
|
+
id: 'mastra-storage',
|
|
54
|
+
url: 'file:./mastra.db',
|
|
55
|
+
}),
|
|
56
|
+
backgroundTasks: {
|
|
57
|
+
enabled: true,
|
|
58
|
+
globalConcurrency: 10,
|
|
59
|
+
perAgentConcurrency: 5,
|
|
60
|
+
backpressure: 'queue',
|
|
61
|
+
defaultTimeoutMs: 300_000,
|
|
62
|
+
},
|
|
63
|
+
})
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
**enabled** (`boolean`): Whether background tasks are enabled. The manager only initializes when this is true and a storage backend is configured. (Default: `false`)
|
|
67
|
+
|
|
68
|
+
**globalConcurrency** (`number`): Maximum number of background tasks running concurrently across all agents. (Default: `10`)
|
|
69
|
+
|
|
70
|
+
**perAgentConcurrency** (`number`): Maximum number of background tasks running concurrently for a single agent. (Default: `5`)
|
|
71
|
+
|
|
72
|
+
**backpressure** (`'queue' | 'reject' | 'fallback-sync'`): Behavior when a concurrency limit is reached. 'queue' waits for a slot, 'reject' throws on enqueue, 'fallback-sync' runs the tool synchronously in the agentic loop instead. (Default: `'queue'`)
|
|
73
|
+
|
|
74
|
+
**defaultTimeoutMs** (`number`): Default per-task timeout in milliseconds. Can be overridden per-tool or per-call. (Default: `300000`)
|
|
75
|
+
|
|
76
|
+
**defaultRetries** (`RetryConfig`): Default retry policy applied to tasks that fail.
|
|
77
|
+
|
|
78
|
+
**defaultRetries.maxRetries** (`number`): Maximum retry attempts before the task is marked failed.
|
|
79
|
+
|
|
80
|
+
**defaultRetries.retryDelayMs** (`number`): Delay between retries in milliseconds.
|
|
81
|
+
|
|
82
|
+
**defaultRetries.backoffMultiplier** (`number`): Multiplier applied to retryDelayMs on each subsequent attempt.
|
|
83
|
+
|
|
84
|
+
**defaultRetries.maxRetryDelayMs** (`number`): Upper bound on the retry delay regardless of backoff.
|
|
85
|
+
|
|
86
|
+
**defaultRetries.retryableErrors** (`(error: Error) => boolean`): Predicate that decides whether a given error should be retried. Default: retry all errors.
|
|
87
|
+
|
|
88
|
+
**cleanup** (`CleanupConfig`): Controls how long task records are kept and how often the cleanup process runs.
|
|
89
|
+
|
|
90
|
+
**cleanup.completedTtlMs** (`number`): How long to keep completed task records, in milliseconds. Default: 1 hour.
|
|
91
|
+
|
|
92
|
+
**cleanup.failedTtlMs** (`number`): How long to keep failed task records, in milliseconds. Default: 24 hours.
|
|
93
|
+
|
|
94
|
+
**cleanup.cleanupIntervalMs** (`number`): How often the cleanup process runs, in milliseconds. Default: 1 minute.
|
|
95
|
+
|
|
96
|
+
**waitTimeoutMs** (`number`): How long the agentic loop waits for a background task to complete before moving on. If a task has not finished within this time, the loop proceeds without setting isContinued. Default: undefined (do not wait). Can be overridden per-agent or per-tool.
|
|
97
|
+
|
|
98
|
+
**onTaskComplete** (`(task: BackgroundTask) => void | Promise<void>`): Global callback invoked when any background task completes successfully. Fires in addition to per-tool and per-agent callbacks.
|
|
99
|
+
|
|
100
|
+
**onTaskFailed** (`(task: BackgroundTask) => void | Promise<void>`): Global callback invoked when any background task fails. Fires in addition to per-tool and per-agent callbacks.
|
|
101
|
+
|
|
39
102
|
### deployer
|
|
40
103
|
|
|
41
104
|
**Type:** `MastraDeployer`
|
|
@@ -442,7 +505,7 @@ const mastra = new Mastra({
|
|
|
442
505
|
|
|
443
506
|
When `mastra build` is run, Mastra bundles your project into the `.mastra/output` directory. This option controls which packages are excluded from the bundle (marked as "external") and installed separately through a package manager. This is useful when the internal Mastra bundler ([Rollup](https://rollupjs.org/configuration-options/#external)) has trouble bundling certain packages.
|
|
444
507
|
|
|
445
|
-
By default, `mastra build` sets this option to `true`.
|
|
508
|
+
By default, `mastra build` sets this option to `true`.
|
|
446
509
|
|
|
447
510
|
Here's an overview of what the different values mean:
|
|
448
511
|
|
|
@@ -544,11 +607,14 @@ export const mastra = new Mastra({
|
|
|
544
607
|
server: {
|
|
545
608
|
auth: new MastraJwtAuth({
|
|
546
609
|
secret: process.env.MASTRA_JWT_SECRET,
|
|
610
|
+
mapUserToResourceId: user => user.id,
|
|
547
611
|
}),
|
|
548
612
|
},
|
|
549
613
|
})
|
|
550
614
|
```
|
|
551
615
|
|
|
616
|
+
The `mapUserToResourceId` callback maps the authenticated user to a resource ID for memory/thread scoping. When provided, it's called after successful authentication and the returned value is set on the request context as `MASTRA_RESOURCE_ID_KEY`. See [Authorization (User Isolation)](https://mastra.ai/docs/server/middleware) for details.
|
|
617
|
+
|
|
552
618
|
### server.bodySizeLimit
|
|
553
619
|
|
|
554
620
|
**Type:** `number`\
|
|
@@ -35,8 +35,8 @@ Void. The gateway is added to the internal registry.
|
|
|
35
35
|
|
|
36
36
|
## Related
|
|
37
37
|
|
|
38
|
-
- [Mastra.getGateway()](https://mastra.ai/reference/core/getGateway)
|
|
39
|
-
- [Mastra.getGatewayById()](https://mastra.ai/reference/core/getGatewayById)
|
|
40
|
-
- [Mastra.listGateways()](https://mastra.ai/reference/core/listGateways)
|
|
41
|
-
- [MastraModelGateway](https://mastra.ai/reference/core/mastra-model-gateway)
|
|
42
|
-
- [Custom Gateways Guide](https://mastra.ai/models/gateways/custom-gateways)
|
|
38
|
+
- [Mastra.getGateway()](https://mastra.ai/reference/core/getGateway): Get gateway by registration key
|
|
39
|
+
- [Mastra.getGatewayById()](https://mastra.ai/reference/core/getGatewayById): Get gateway by ID
|
|
40
|
+
- [Mastra.listGateways()](https://mastra.ai/reference/core/listGateways): List all gateways
|
|
41
|
+
- [MastraModelGateway](https://mastra.ai/reference/core/mastra-model-gateway): Gateway base class
|
|
42
|
+
- [Custom Gateways Guide](https://mastra.ai/models/gateways/custom-gateways): Creating custom gateways
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Mastra.getEditor()
|
|
2
|
+
|
|
3
|
+
The `.getEditor()` method is used to retrieve the editor instance that has been configured on the Mastra instance. The editor exposes CRUD namespaces for managing stored agents, prompt blocks, MCP clients, scorers, skills, and workspaces programmatically.
|
|
4
|
+
|
|
5
|
+
## Usage example
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { Mastra } from '@mastra/core'
|
|
9
|
+
import { MastraEditor } from '@mastra/editor'
|
|
10
|
+
|
|
11
|
+
const mastra = new Mastra({
|
|
12
|
+
editor: new MastraEditor(),
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
const editor = mastra.getEditor()
|
|
16
|
+
|
|
17
|
+
const agent = await editor?.agent.create({
|
|
18
|
+
id: 'support-agent',
|
|
19
|
+
name: 'Support Agent',
|
|
20
|
+
instructions: 'Help customers with their questions.',
|
|
21
|
+
})
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Parameters
|
|
25
|
+
|
|
26
|
+
This method doesn't accept any parameters.
|
|
27
|
+
|
|
28
|
+
## Returns
|
|
29
|
+
|
|
30
|
+
**editor** (`MastraEditor | undefined`): The configured editor instance, or undefined if no editor has been configured.
|
|
31
|
+
|
|
32
|
+
## Related
|
|
33
|
+
|
|
34
|
+
- [Editor overview](https://mastra.ai/docs/editor/overview)
|
|
35
|
+
- [MastraEditor reference](https://mastra.ai/reference/editor/mastra-editor)
|
|
@@ -31,8 +31,8 @@ Throws an error if no gateway is found with the specified key.
|
|
|
31
31
|
|
|
32
32
|
## Related
|
|
33
33
|
|
|
34
|
-
- [Mastra.getGatewayById()](https://mastra.ai/reference/core/getGatewayById)
|
|
35
|
-
- [Mastra.listGateways()](https://mastra.ai/reference/core/listGateways)
|
|
36
|
-
- [Mastra.addGateway()](https://mastra.ai/reference/core/addGateway)
|
|
37
|
-
- [MastraModelGateway](https://mastra.ai/reference/core/mastra-model-gateway)
|
|
38
|
-
- [Custom Gateways Guide](https://mastra.ai/models/gateways/custom-gateways)
|
|
34
|
+
- [Mastra.getGatewayById()](https://mastra.ai/reference/core/getGatewayById): Get gateway by ID
|
|
35
|
+
- [Mastra.listGateways()](https://mastra.ai/reference/core/listGateways): List all gateways
|
|
36
|
+
- [Mastra.addGateway()](https://mastra.ai/reference/core/addGateway): Add a gateway
|
|
37
|
+
- [MastraModelGateway](https://mastra.ai/reference/core/mastra-model-gateway): Gateway base class
|
|
38
|
+
- [Custom Gateways Guide](https://mastra.ai/models/gateways/custom-gateways): Creating custom gateways
|
|
@@ -34,8 +34,8 @@ console.log(gateway.name) // 'My Custom Gateway'
|
|
|
34
34
|
|
|
35
35
|
## Related
|
|
36
36
|
|
|
37
|
-
- [Mastra.getGateway()](https://mastra.ai/reference/core/getGateway)
|
|
38
|
-
- [Mastra.listGateways()](https://mastra.ai/reference/core/listGateways)
|
|
39
|
-
- [Mastra.addGateway()](https://mastra.ai/reference/core/addGateway)
|
|
40
|
-
- [MastraModelGateway](https://mastra.ai/reference/core/mastra-model-gateway)
|
|
41
|
-
- [Custom Gateways Guide](https://mastra.ai/models/gateways/custom-gateways)
|
|
37
|
+
- [Mastra.getGateway()](https://mastra.ai/reference/core/getGateway): Get gateway by registration key
|
|
38
|
+
- [Mastra.listGateways()](https://mastra.ai/reference/core/listGateways): List all gateways
|
|
39
|
+
- [Mastra.addGateway()](https://mastra.ai/reference/core/addGateway): Add a gateway
|
|
40
|
+
- [MastraModelGateway](https://mastra.ai/reference/core/mastra-model-gateway): Gateway base class
|
|
41
|
+
- [Custom Gateways Guide](https://mastra.ai/models/gateways/custom-gateways): Creating custom gateways
|
|
@@ -38,8 +38,8 @@ const serverById = mastra.getMCPServerById('my-mcp-server')
|
|
|
38
38
|
|
|
39
39
|
## Related methods
|
|
40
40
|
|
|
41
|
-
- [Mastra.getMCPServerById()](https://mastra.ai/reference/core/getMCPServerById)
|
|
42
|
-
- [Mastra.listMCPServers()](https://mastra.ai/reference/core/listMCPServers)
|
|
41
|
+
- [Mastra.getMCPServerById()](https://mastra.ai/reference/core/getMCPServerById): Retrieve an MCP server by its intrinsic `id` property
|
|
42
|
+
- [Mastra.listMCPServers()](https://mastra.ai/reference/core/listMCPServers): List all registered MCP servers
|
|
43
43
|
|
|
44
44
|
## See also
|
|
45
45
|
|
|
@@ -46,8 +46,8 @@ const serverByKey = mastra.getMCPServer('customKey')
|
|
|
46
46
|
|
|
47
47
|
## Related methods
|
|
48
48
|
|
|
49
|
-
- [Mastra.getMCPServer()](https://mastra.ai/reference/core/getMCPServer)
|
|
50
|
-
- [Mastra.listMCPServers()](https://mastra.ai/reference/core/listMCPServers)
|
|
49
|
+
- [Mastra.getMCPServer()](https://mastra.ai/reference/core/getMCPServer): Retrieve an MCP server by its registry key
|
|
50
|
+
- [Mastra.listMCPServers()](https://mastra.ai/reference/core/listMCPServers): List all registered MCP servers
|
|
51
51
|
|
|
52
52
|
## See also
|
|
53
53
|
|
|
@@ -49,6 +49,6 @@ try {
|
|
|
49
49
|
|
|
50
50
|
## Related
|
|
51
51
|
|
|
52
|
-
- [listScorers()](https://mastra.ai/reference/core/listScorers)
|
|
53
|
-
- [getScorerById()](https://mastra.ai/reference/core/getScorerById)
|
|
54
|
-
- [Custom Scorers](https://mastra.ai/docs/evals/custom-scorers)
|
|
52
|
+
- [listScorers()](https://mastra.ai/reference/core/listScorers): Get all registered scorers
|
|
53
|
+
- [getScorerById()](https://mastra.ai/reference/core/getScorerById): Get a scorer by its id property
|
|
54
|
+
- [Custom Scorers](https://mastra.ai/docs/evals/custom-scorers): Learn how to create custom scorers
|
|
@@ -49,6 +49,6 @@ try {
|
|
|
49
49
|
|
|
50
50
|
## Related
|
|
51
51
|
|
|
52
|
-
- [getScorer()](https://mastra.ai/reference/core/getScorer)
|
|
53
|
-
- [listScorers()](https://mastra.ai/reference/core/listScorers)
|
|
54
|
-
- [createScorer()](https://mastra.ai/reference/evals/create-scorer)
|
|
52
|
+
- [getScorer()](https://mastra.ai/reference/core/getScorer): Get a scorer by its registration key
|
|
53
|
+
- [listScorers()](https://mastra.ai/reference/core/listScorers): Get all registered scorers
|
|
54
|
+
- [createScorer()](https://mastra.ai/reference/evals/create-scorer): Learn how to create scorers with ids
|
|
@@ -33,8 +33,8 @@ None.
|
|
|
33
33
|
|
|
34
34
|
## Related
|
|
35
35
|
|
|
36
|
-
- [Mastra.getGateway()](https://mastra.ai/reference/core/getGateway)
|
|
37
|
-
- [Mastra.getGatewayById()](https://mastra.ai/reference/core/getGatewayById)
|
|
38
|
-
- [Mastra.addGateway()](https://mastra.ai/reference/core/addGateway)
|
|
39
|
-
- [MastraModelGateway](https://mastra.ai/reference/core/mastra-model-gateway)
|
|
40
|
-
- [Custom Gateways Guide](https://mastra.ai/models/gateways/custom-gateways)
|
|
36
|
+
- [Mastra.getGateway()](https://mastra.ai/reference/core/getGateway): Get gateway by registration key
|
|
37
|
+
- [Mastra.getGatewayById()](https://mastra.ai/reference/core/getGatewayById): Get gateway by ID
|
|
38
|
+
- [Mastra.addGateway()](https://mastra.ai/reference/core/addGateway): Add a gateway
|
|
39
|
+
- [MastraModelGateway](https://mastra.ai/reference/core/mastra-model-gateway): Gateway base class
|
|
40
|
+
- [Custom Gateways Guide](https://mastra.ai/models/gateways/custom-gateways): Creating custom gateways
|
|
@@ -46,8 +46,8 @@ This method doesn't accept any parameters.
|
|
|
46
46
|
|
|
47
47
|
## Related methods
|
|
48
48
|
|
|
49
|
-
- [Mastra.getMCPServer()](https://mastra.ai/reference/core/getMCPServer)
|
|
50
|
-
- [Mastra.getMCPServerById()](https://mastra.ai/reference/core/getMCPServerById)
|
|
49
|
+
- [Mastra.getMCPServer()](https://mastra.ai/reference/core/getMCPServer): Retrieve an MCP server by its registry key
|
|
50
|
+
- [Mastra.getMCPServerById()](https://mastra.ai/reference/core/getMCPServerById): Retrieve an MCP server by its intrinsic `id` property
|
|
51
51
|
|
|
52
52
|
## See also
|
|
53
53
|
|
|
@@ -24,6 +24,6 @@ This method takes no parameters.
|
|
|
24
24
|
|
|
25
25
|
## Related
|
|
26
26
|
|
|
27
|
-
- [getScorer()](https://mastra.ai/reference/core/getScorer)
|
|
28
|
-
- [getScorerById()](https://mastra.ai/reference/core/getScorerById)
|
|
29
|
-
- [Scorers Overview](https://mastra.ai/docs/evals/overview)
|
|
27
|
+
- [getScorer()](https://mastra.ai/reference/core/getScorer): Get a specific scorer by key
|
|
28
|
+
- [getScorerById()](https://mastra.ai/reference/core/getScorerById): Get a scorer by its id property
|
|
29
|
+
- [Scorers Overview](https://mastra.ai/docs/evals/overview): Learn about creating and using scorers
|
|
@@ -49,6 +49,8 @@ Visit the [Configuration reference](https://mastra.ai/reference/configuration) f
|
|
|
49
49
|
|
|
50
50
|
**observability** (`ObservabilityEntrypoint`): Observability configuration for tracing and monitoring
|
|
51
51
|
|
|
52
|
+
**environment** (`string`): Deployment environment name (e.g. \`production\`, \`staging\`, \`development\`). When set, automatically attached to all observability signals so they can be filtered by environment without passing \`tracingOptions.metadata.environment\` on each call. Falls back to \`process.env.NODE\_ENV\` when unset; left undefined if neither is set. Per-call \`tracingOptions.metadata.environment\` always takes precedence.
|
|
53
|
+
|
|
52
54
|
**deployer** (`MastraDeployer`): An instance of a MastraDeployer for managing deployments.
|
|
53
55
|
|
|
54
56
|
**server** (`ServerConfig`): Server configuration including port, host, timeout, API routes, middleware, CORS settings, and build options for Swagger UI, API request logging, and OpenAPI docs.
|
|
@@ -63,4 +65,12 @@ Visit the [Configuration reference](https://mastra.ai/reference/configuration) f
|
|
|
63
65
|
|
|
64
66
|
**gateways** (`Record<string, MastraModelGateway>`): Custom model gateways to register for accessing AI models through alternative providers or private deployments. Structured as a key-value pair, with keys being the registry key (used for getGateway()) and values being gateway instances. (Default: `{}`)
|
|
65
67
|
|
|
66
|
-
**memory** (`Record<string, MastraMemory>`): Memory instances to register. These can be referenced by stored agents and resolved at runtime. Structured as a key-value pair, with keys being the registry key and values being memory instances. (Default: `{}`)
|
|
68
|
+
**memory** (`Record<string, MastraMemory>`): Memory instances to register. These can be referenced by stored agents and resolved at runtime. Structured as a key-value pair, with keys being the registry key and values being memory instances. (Default: `{}`)
|
|
69
|
+
|
|
70
|
+
**versions** (`VersionOverrides`): Global version overrides for sub-agent delegation. When a supervisor agent delegates to a sub-agent, these overrides determine which stored version of that sub-agent to use instead of the code-defined default. Requires the editor package to be configured. See \[Sub-agent versioning]\(/docs/editor/overview#sub-agent-versioning) for details.
|
|
71
|
+
|
|
72
|
+
**versions.agents** (`Record<string, VersionSelector>`): A map of agent IDs to their version selectors. Each selector can target a specific version by ID or by publication status.
|
|
73
|
+
|
|
74
|
+
**versions.agents.versionId** (`string`): The ID of a specific version to use.
|
|
75
|
+
|
|
76
|
+
**versions.agents.status** (`'draft' | 'published'`): Select the latest version with this publication status.
|
|
@@ -148,8 +148,8 @@ Examples:
|
|
|
148
148
|
|
|
149
149
|
## Related
|
|
150
150
|
|
|
151
|
-
- [Custom Gateways Guide](https://mastra.ai/models/gateways/custom-gateways)
|
|
152
|
-
- [Mastra.addGateway()](https://mastra.ai/reference/core/addGateway)
|
|
153
|
-
- [Mastra.getGateway()](https://mastra.ai/reference/core/getGateway)
|
|
154
|
-
- [Mastra.getGatewayById()](https://mastra.ai/reference/core/getGatewayById)
|
|
155
|
-
- [Mastra.listGateways()](https://mastra.ai/reference/core/listGateways)
|
|
151
|
+
- [Custom Gateways Guide](https://mastra.ai/models/gateways/custom-gateways): Complete guide to creating custom gateways
|
|
152
|
+
- [Mastra.addGateway()](https://mastra.ai/reference/core/addGateway): Add a gateway to Mastra
|
|
153
|
+
- [Mastra.getGateway()](https://mastra.ai/reference/core/getGateway): Get gateway by registration key
|
|
154
|
+
- [Mastra.getGatewayById()](https://mastra.ai/reference/core/getGatewayById): Get gateway by ID
|
|
155
|
+
- [Mastra.listGateways()](https://mastra.ai/reference/core/listGateways): List all gateways
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
**Added in:** `@mastra/core@1.4.0`
|
|
4
4
|
|
|
5
|
-
Creates a new dataset.
|
|
5
|
+
Creates a new dataset. Use Standard JSON Schema (Zod, Valibot, ArkType, etc.) for defining schemas.
|
|
6
6
|
|
|
7
7
|
## Usage example
|
|
8
8
|
|
|
@@ -21,7 +21,7 @@ const dataset = await mastra.datasets.create({
|
|
|
21
21
|
metadata: { team: 'ml' },
|
|
22
22
|
})
|
|
23
23
|
|
|
24
|
-
// Create with Zod
|
|
24
|
+
// Create with Zod schema (library that supports Standard JSON Schema)
|
|
25
25
|
const typedDataset = await mastra.datasets.create({
|
|
26
26
|
name: 'Typed QA set',
|
|
27
27
|
inputSchema: z.object({
|
|
@@ -40,9 +40,9 @@ const typedDataset = await mastra.datasets.create({
|
|
|
40
40
|
|
|
41
41
|
**description** (`string`): Description of the dataset.
|
|
42
42
|
|
|
43
|
-
**inputSchema** (`
|
|
43
|
+
**inputSchema** (`StandardJSONSchemaV1`): Standard JSON Schema for item inputs.
|
|
44
44
|
|
|
45
|
-
**groundTruthSchema** (`
|
|
45
|
+
**groundTruthSchema** (`StandardJSONSchemaV1`): Standard JSON Schema for item ground truths.
|
|
46
46
|
|
|
47
47
|
**metadata** (`Record<string, unknown>`): Arbitrary metadata.
|
|
48
48
|
|