@mastra/mcp-docs-server 0.0.0-studio-deploy-20260404184540 → 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/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 +27 -8
- 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 +16 -1
- 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 +7 -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 +8 -4
- 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 +9 -7
- package/.docs/models/providers/xiaomi-token-plan-cn.md +9 -7
- package/.docs/models/providers/xiaomi-token-plan-sgp.md +9 -7
- 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 +13 -5
- package/.docs/models/providers/zhipuai-coding-plan.md +11 -21
- package/.docs/models/providers/zhipuai.md +2 -1
- package/.docs/models/providers.md +8 -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/mastra-client.md +23 -0
- package/.docs/reference/client-js/observability.md +2 -2
- 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 +486 -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
|
@@ -13,25 +13,23 @@ const voice = new SarvamVoice()
|
|
|
13
13
|
// Or initialize with specific configuration
|
|
14
14
|
const voiceWithConfig = new SarvamVoice({
|
|
15
15
|
speechModel: {
|
|
16
|
-
model: 'bulbul:
|
|
16
|
+
model: 'bulbul:v3',
|
|
17
17
|
apiKey: process.env.SARVAM_API_KEY!,
|
|
18
18
|
language: 'en-IN',
|
|
19
19
|
properties: {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
enable_preprocessing: false,
|
|
25
|
-
eng_interpolation_wt: 123,
|
|
20
|
+
pace: 1.0,
|
|
21
|
+
temperature: 0.6,
|
|
22
|
+
speech_sample_rate: 24000,
|
|
23
|
+
output_audio_codec: 'wav',
|
|
26
24
|
},
|
|
27
25
|
},
|
|
28
26
|
listeningModel: {
|
|
29
|
-
model: 'saarika:v2',
|
|
27
|
+
model: 'saarika:v2.5',
|
|
30
28
|
apiKey: process.env.SARVAM_API_KEY!,
|
|
31
29
|
languageCode: 'en-IN',
|
|
32
30
|
filetype: 'wav',
|
|
33
31
|
},
|
|
34
|
-
speaker: '
|
|
32
|
+
speaker: 'shubh', // Default voice for bulbul:v3
|
|
35
33
|
})
|
|
36
34
|
|
|
37
35
|
// Convert text to speech
|
|
@@ -45,46 +43,52 @@ const text = await voice.listen(audioStream, {
|
|
|
45
43
|
|
|
46
44
|
### Sarvam API Docs -
|
|
47
45
|
|
|
48
|
-
<https://docs.sarvam.ai/api-reference-docs/
|
|
46
|
+
<https://docs.sarvam.ai/api-reference-docs/text-to-speech/convert>
|
|
49
47
|
|
|
50
48
|
## Configuration
|
|
51
49
|
|
|
52
50
|
### Constructor options
|
|
53
51
|
|
|
54
|
-
**speechModel** (`SarvamVoiceConfig`): Configuration for text-to-speech synthesis. (Default: `{ model: 'bulbul:
|
|
52
|
+
**speechModel** (`SarvamVoiceConfig`): Configuration for text-to-speech synthesis. (Default: `{ model: 'bulbul:v3', language: 'en-IN' }`)
|
|
55
53
|
|
|
56
54
|
**speechModel.apiKey** (`string`): Sarvam API key. Falls back to SARVAM\_API\_KEY environment variable.
|
|
57
55
|
|
|
58
|
-
**speechModel.model** (`SarvamTTSModel`): Specifies the model to use for text-to-speech conversion.
|
|
56
|
+
**speechModel.model** (`SarvamTTSModel`): Specifies the model to use for text-to-speech conversion. Available options: bulbul:v2, bulbul:v3, bulbul:v3-beta. bulbul:v3-beta is a beta variant of bulbul:v3 that shares the same speaker catalog. Note: bulbul:v1 has been deprecated by Sarvam and is no longer supported.
|
|
59
57
|
|
|
60
58
|
**speechModel.language** (`SarvamTTSLanguage`): Target language for speech synthesis. Available options: hi-IN, bn-IN, kn-IN, ml-IN, mr-IN, od-IN, pa-IN, ta-IN, te-IN, en-IN, gu-IN
|
|
61
59
|
|
|
62
60
|
**speechModel.properties** (`object`): Additional voice properties for customization.
|
|
63
61
|
|
|
64
|
-
**speechModel.properties.
|
|
62
|
+
**speechModel.properties.pace** (`number`): Controls the speed of the audio. Supported by both bulbul:v2 (range 0.3–3.0) and bulbul:v3 (range 0.5–2.0).
|
|
65
63
|
|
|
66
|
-
**speechModel.properties.
|
|
64
|
+
**speechModel.properties.temperature** (`number`): Sampling temperature that controls the randomness of the generated voice. bulbul:v3 only. Range: 0.01–2.0. Default: 0.6.
|
|
67
65
|
|
|
68
|
-
**speechModel.properties.
|
|
66
|
+
**speechModel.properties.dict\_id** (`string`): Pronunciation dictionary ID. bulbul:v3 only.
|
|
69
67
|
|
|
70
|
-
**speechModel.properties.
|
|
68
|
+
**speechModel.properties.pitch** (`number`): Controls the pitch of the audio. Lower values result in a deeper voice, while higher values make it sharper. bulbul:v2 only. Range: -0.75 to 0.75.
|
|
71
69
|
|
|
72
|
-
**speechModel.properties.
|
|
70
|
+
**speechModel.properties.loudness** (`number`): Controls the loudness of the audio. bulbul:v2 only. Range: 0.3 to 3.0.
|
|
73
71
|
|
|
74
|
-
**speechModel.properties.
|
|
72
|
+
**speechModel.properties.enable\_preprocessing** (`boolean`): Enables normalization of English words and numeric entities (numbers, dates, etc.). bulbul:v2 only. Default is false.
|
|
75
73
|
|
|
76
|
-
**
|
|
74
|
+
**speechModel.properties.speech\_sample\_rate** (`8000 | 16000 | 22050 | 24000 | 32000 | 44100 | 48000`): Audio sample rate in Hz.
|
|
77
75
|
|
|
78
|
-
**
|
|
76
|
+
**speechModel.properties.output\_audio\_codec** (`'mp3' | 'wav' | 'linear16' | 'mulaw' | 'alaw' | 'opus' | 'flac' | 'aac'`): Output audio codec.
|
|
77
|
+
|
|
78
|
+
**speaker** (`SarvamVoiceId`): The speaker to be used for the output audio. Defaults to 'shubh'. bulbul:v3 supports 39 voices (shubh, aditya, ritu, priya, neha, rahul, pooja, rohan, simran, kavya, amit, dev, ishita, shreya, ratan, varun, manan, sumit, roopa, kabir, aayan, ashutosh, advait, amelia, sophia, anand, tanya, tarun, sunny, mani, gokul, vijay, shruti, suhani, mohit, kavitha, rehan, soham, rupali). bulbul:v2 supports 7 voices (anushka, manisha, vidya, arya, abhilash, karun, hitesh). Speakers are not interchangeable between model versions. (Default: `'shubh'`)
|
|
79
|
+
|
|
80
|
+
**listeningModel** (`SarvamListenOptions`): Configuration for speech-to-text recognition. (Default: `{ model: 'saarika:v2.5', languageCode: 'unknown' }`)
|
|
79
81
|
|
|
80
82
|
**listeningModel.apiKey** (`string`): Sarvam API key. Falls back to SARVAM\_API\_KEY environment variable.
|
|
81
83
|
|
|
82
|
-
**listeningModel.model** (`SarvamSTTModel`): Specifies the model to use for speech-to-text conversion.
|
|
84
|
+
**listeningModel.model** (`SarvamSTTModel`): Specifies the model to use for speech-to-text conversion. Available options: saarika:v2.5 (transcription), saaras:v3 (multi-mode: transcribe/translate/verbatim/translit/codemix). Note: saarika:v1, saarika:v2, and saarika:flash have been deprecated by Sarvam.
|
|
83
85
|
|
|
84
|
-
**listeningModel.languageCode** (`SarvamSTTLanguage`):
|
|
86
|
+
**listeningModel.languageCode** (`SarvamSTTLanguage`): BCP-47 language code of the input audio. Optional for saarika:v2.5 and saaras:v3 (the API will detect the language automatically when 'unknown' is passed). Available options: unknown, hi-IN, bn-IN, kn-IN, ml-IN, mr-IN, od-IN, pa-IN, ta-IN, te-IN, en-IN, gu-IN.
|
|
85
87
|
|
|
86
88
|
**listeningModel.filetype** (`'mp3' | 'wav'`): Audio format of the input stream.
|
|
87
89
|
|
|
90
|
+
**listeningModel.mode** (`SarvamSTTMode`): Operation mode. Only valid when using the saaras:v3 model; ignored by saarika:v2.5. Available options: 'transcribe', 'translate', 'verbatim', 'translit', 'codemix'.
|
|
91
|
+
|
|
88
92
|
## Methods
|
|
89
93
|
|
|
90
94
|
### `speak()`
|
|
@@ -121,4 +125,6 @@ Returns: `Promise<Array<{voiceId: SarvamVoiceId}>>`
|
|
|
121
125
|
- If no API key is provided, the constructor will throw an error
|
|
122
126
|
- The service communicates with the Sarvam AI API at `https://api.sarvam.ai`
|
|
123
127
|
- Audio is returned as a stream containing binary audio data
|
|
124
|
-
- Speech recognition supports mp3 and wav audio formats
|
|
128
|
+
- Speech recognition supports mp3 and wav audio formats
|
|
129
|
+
- `bulbul:v1`, `saarika:v1`, `saarika:v2`, and `saarika:flash` have been deprecated by Sarvam and are no longer supported. Use `bulbul:v3` (or `bulbul:v2`) for TTS and `saarika:v2.5` (or `saaras:v3`) for STT.
|
|
130
|
+
- Speaker names are not interchangeable between `bulbul:v2` and `bulbul:v3` — each model version has its own speaker catalog.
|
|
@@ -90,7 +90,7 @@ await voice.connect()
|
|
|
90
90
|
|
|
91
91
|
## Related methods
|
|
92
92
|
|
|
93
|
-
- [voice.send()](https://mastra.ai/reference/voice/voice.send)
|
|
94
|
-
- [voice.answer()](https://mastra.ai/reference/voice/voice.answer)
|
|
95
|
-
- [voice.close()](https://mastra.ai/reference/voice/voice.close)
|
|
96
|
-
- [voice.on()](https://mastra.ai/reference/voice/voice.on)
|
|
93
|
+
- [voice.send()](https://mastra.ai/reference/voice/voice.send): Sends audio data to the voice provider
|
|
94
|
+
- [voice.answer()](https://mastra.ai/reference/voice/voice.answer): Triggers the voice provider to respond
|
|
95
|
+
- [voice.close()](https://mastra.ai/reference/voice/voice.close): Disconnects from the real-time service
|
|
96
|
+
- [voice.on()](https://mastra.ai/reference/voice/voice.on): Registers an event listener for voice events
|
|
@@ -165,6 +165,6 @@ await voice.listen(microphoneStream)
|
|
|
165
165
|
|
|
166
166
|
## Related methods
|
|
167
167
|
|
|
168
|
-
- [voice.speak()](https://mastra.ai/reference/voice/voice.speak)
|
|
169
|
-
- [voice.send()](https://mastra.ai/reference/voice/voice.send)
|
|
170
|
-
- [voice.on()](https://mastra.ai/reference/voice/voice.on)
|
|
168
|
+
- [voice.speak()](https://mastra.ai/reference/voice/voice.speak): Converts text to speech
|
|
169
|
+
- [voice.send()](https://mastra.ai/reference/voice/voice.send): Sends audio data to the voice provider in real-time
|
|
170
|
+
- [voice.on()](https://mastra.ai/reference/voice/voice.on): Registers an event listener for voice events
|
|
@@ -26,6 +26,8 @@ if (result.status === 'suspended') {
|
|
|
26
26
|
|
|
27
27
|
**retryCount** (`number`): Optional retry count for nested workflow execution
|
|
28
28
|
|
|
29
|
+
**forEachIndex** (`number`): Target a specific iteration of a suspended \`.foreach()\` step. Pass the zero-based index of the iteration you want to resume; other iterations remain suspended. Omit this field to resume all suspended iterations of the step with the same \`resumeData\`.
|
|
30
|
+
|
|
29
31
|
**tracingContext** (`TracingContext`): Tracing context for creating child spans and adding metadata. Automatically injected when using Mastra's tracing system.
|
|
30
32
|
|
|
31
33
|
**tracingContext.currentSpan** (`Span`): Current span for creating child spans and adding metadata. Use this to create custom child spans or update span attributes during execution.
|
|
@@ -67,6 +69,28 @@ if (result.status === 'suspended') {
|
|
|
67
69
|
|
|
68
70
|
> **Note:** When exactly one step is suspended, you can omit the `step` parameter and the workflow will automatically resume that step. For workflows with multiple suspended steps, you must explicitly specify which step to resume.
|
|
69
71
|
|
|
72
|
+
### Resuming a single [`.foreach()`](https://mastra.ai/reference/workflows/workflow-methods/foreach) iteration
|
|
73
|
+
|
|
74
|
+
When a [`.foreach()`](https://mastra.ai/reference/workflows/workflow-methods/foreach) step suspends across multiple iterations, use `forEachIndex` (zero-based) to resume one iteration at a time with different `resumeData`. Iterations not targeted by `forEachIndex` remain suspended until resumed.
|
|
75
|
+
|
|
76
|
+
```typescript
|
|
77
|
+
// Resume only the second iteration (index 1) with its own data
|
|
78
|
+
await run.resume({
|
|
79
|
+
step: 'approve',
|
|
80
|
+
resumeData: { ok: true },
|
|
81
|
+
forEachIndex: 1,
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
// Later, resume the first iteration with different data
|
|
85
|
+
await run.resume({
|
|
86
|
+
step: 'approve',
|
|
87
|
+
resumeData: { ok: false },
|
|
88
|
+
forEachIndex: 0,
|
|
89
|
+
})
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
If `forEachIndex` is omitted, every suspended iteration of the step is resumed with the same `resumeData`.
|
|
93
|
+
|
|
70
94
|
## Related
|
|
71
95
|
|
|
72
96
|
- [Workflows overview](https://mastra.ai/docs/workflows/overview)
|
|
@@ -68,6 +68,6 @@ if (result?.status === 'success') {
|
|
|
68
68
|
|
|
69
69
|
## Related
|
|
70
70
|
|
|
71
|
-
- [Run.start()](https://mastra.ai/reference/workflows/run-methods/start)
|
|
71
|
+
- [Run.start()](https://mastra.ai/reference/workflows/run-methods/start): Start a workflow and wait for completion
|
|
72
72
|
- [Workflows overview](https://mastra.ai/docs/workflows/overview)
|
|
73
73
|
- [Workflow.createRun()](https://mastra.ai/reference/workflows/workflow-methods/create-run)
|
|
@@ -26,6 +26,87 @@ const step1 = createStep({
|
|
|
26
26
|
})
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
+
## Define schemas
|
|
30
|
+
|
|
31
|
+
You can define the step's `inputSchema` and `outputSchema` with any library that supports [Standard JSON Schema](https://standardschema.dev/json-schema). This includes libraries like [Zod](https://zod.dev/), [Valibot](https://valibot.dev/), and [ArkType](https://arktype.io/).
|
|
32
|
+
|
|
33
|
+
**Zod**:
|
|
34
|
+
|
|
35
|
+
```typescript
|
|
36
|
+
import { createStep } from '@mastra/core/workflows'
|
|
37
|
+
import { z } from 'zod'
|
|
38
|
+
|
|
39
|
+
const step1 = createStep({
|
|
40
|
+
id: 'step-1',
|
|
41
|
+
inputSchema: z.object({
|
|
42
|
+
message: z.string(),
|
|
43
|
+
}),
|
|
44
|
+
outputSchema: z.object({
|
|
45
|
+
formatted: z.string(),
|
|
46
|
+
}),
|
|
47
|
+
execute: async ({ inputData }) => {
|
|
48
|
+
const { message } = inputData
|
|
49
|
+
|
|
50
|
+
return {
|
|
51
|
+
formatted: message.toUpperCase(),
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
})
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**Valibot**:
|
|
58
|
+
|
|
59
|
+
```typescript
|
|
60
|
+
import { createStep } from '@mastra/core/workflows'
|
|
61
|
+
import * as v from 'valibot'
|
|
62
|
+
import { toStandardJsonSchema } from '@valibot/to-json-schema'
|
|
63
|
+
|
|
64
|
+
const step1 = createStep({
|
|
65
|
+
id: 'step-1',
|
|
66
|
+
inputSchema: toStandardJsonSchema(
|
|
67
|
+
v.object({
|
|
68
|
+
message: v.string(),
|
|
69
|
+
}),
|
|
70
|
+
),
|
|
71
|
+
outputSchema: toStandardJsonSchema(
|
|
72
|
+
v.object({
|
|
73
|
+
formatted: v.string(),
|
|
74
|
+
}),
|
|
75
|
+
),
|
|
76
|
+
execute: async ({ inputData }) => {
|
|
77
|
+
const { message } = inputData
|
|
78
|
+
|
|
79
|
+
return {
|
|
80
|
+
formatted: message.toUpperCase(),
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
})
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
**ArkType**:
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
import { createStep } from '@mastra/core/workflows'
|
|
90
|
+
import { type } from 'arktype'
|
|
91
|
+
|
|
92
|
+
const step1 = createStep({
|
|
93
|
+
id: 'step-1',
|
|
94
|
+
inputSchema: type({
|
|
95
|
+
message: 'string',
|
|
96
|
+
}),
|
|
97
|
+
outputSchema: type({
|
|
98
|
+
formatted: 'string',
|
|
99
|
+
}),
|
|
100
|
+
execute: async ({ inputData }) => {
|
|
101
|
+
const { message } = inputData
|
|
102
|
+
|
|
103
|
+
return {
|
|
104
|
+
formatted: message.toUpperCase(),
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
})
|
|
108
|
+
```
|
|
109
|
+
|
|
29
110
|
## Creating steps from agents
|
|
30
111
|
|
|
31
112
|
You can create a step directly from an agent. The step will use the agent's name as its ID.
|
|
@@ -60,7 +141,7 @@ const agentStep = createStep(testAgent, {
|
|
|
60
141
|
|
|
61
142
|
### Agent step options
|
|
62
143
|
|
|
63
|
-
**structuredOutput** (`{ schema:
|
|
144
|
+
**structuredOutput** (`{ schema: StandardJSONSchemaV1 }`): When provided, the agent returns structured data matching this schema instead of plain text. The step's outputSchema is set to the provided schema.
|
|
64
145
|
|
|
65
146
|
**onFinish** (`(result: AgentResult) => void`): Callback invoked when the agent completes generation.
|
|
66
147
|
|
|
@@ -70,17 +151,17 @@ const agentStep = createStep(testAgent, {
|
|
|
70
151
|
|
|
71
152
|
**description** (`string`): Optional description of what the step does
|
|
72
153
|
|
|
73
|
-
**inputSchema** (`
|
|
154
|
+
**inputSchema** (`StandardJSONSchemaV1`): Standard JSON Schema defining the input structure
|
|
74
155
|
|
|
75
|
-
**outputSchema** (`
|
|
156
|
+
**outputSchema** (`StandardJSONSchemaV1`): Standard JSON Schema defining the output structure
|
|
76
157
|
|
|
77
|
-
**resumeSchema** (`
|
|
158
|
+
**resumeSchema** (`StandardJSONSchemaV1`): Optional Standard JSON Schema for resuming the step
|
|
78
159
|
|
|
79
|
-
**suspendSchema** (`
|
|
160
|
+
**suspendSchema** (`StandardJSONSchemaV1`): Optional Standard JSON Schema for suspending the step
|
|
80
161
|
|
|
81
|
-
**stateSchema** (`
|
|
162
|
+
**stateSchema** (`StandardJSONSchemaV1`): Optional Standard JSON Schema for the step state. Automatically injected when using Mastra's state system. The stateSchema must be a subset of the workflow's stateSchema. If not specified, type is 'any'.
|
|
82
163
|
|
|
83
|
-
**requestContextSchema** (`
|
|
164
|
+
**requestContextSchema** (`StandardJSONSchemaV1`): Standard JSON Schema for validating request context values. When provided, the context is validated before the step's execute() runs, failing the step if validation fails.
|
|
84
165
|
|
|
85
166
|
**execute** (`(params: ExecuteParams) => Promise<any>`): Async function containing step logic
|
|
86
167
|
|
|
@@ -113,6 +113,19 @@ Each progress event payload contains:
|
|
|
113
113
|
|
|
114
114
|
**iterationOutput** (`Record<string, any>`): Output of the iteration (present when iterationStatus is 'success')
|
|
115
115
|
|
|
116
|
+
### Resuming a single iteration
|
|
117
|
+
|
|
118
|
+
When a step inside `.foreach()` suspends, each iteration suspends independently. Pass `forEachIndex` to [`run.resume()`](https://mastra.ai/reference/workflows/run-methods/resume) to resume one iteration at a time with its own `resumeData`. Omitting `forEachIndex` resumes every suspended iteration with the same data.
|
|
119
|
+
|
|
120
|
+
```typescript
|
|
121
|
+
await run.resume({
|
|
122
|
+
step: 'approve',
|
|
123
|
+
resumeData: { ok: true },
|
|
124
|
+
forEachIndex: 1,
|
|
125
|
+
})
|
|
126
|
+
```
|
|
127
|
+
|
|
116
128
|
## Related
|
|
117
129
|
|
|
118
|
-
- [Looping with foreach](https://mastra.ai/docs/workflows/control-flow)
|
|
130
|
+
- [Looping with foreach](https://mastra.ai/docs/workflows/control-flow)
|
|
131
|
+
- [run.resume()](https://mastra.ai/reference/workflows/run-methods/resume)
|
|
@@ -19,17 +19,101 @@ export const workflow = createWorkflow({
|
|
|
19
19
|
})
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
+
## Define schemas
|
|
23
|
+
|
|
24
|
+
You can define the workflow's `inputSchema` and `outputSchema` with any library that supports [Standard JSON Schema](https://standardschema.dev/json-schema). This includes libraries like [Zod](https://zod.dev/), [Valibot](https://valibot.dev/), and [ArkType](https://arktype.io/).
|
|
25
|
+
|
|
26
|
+
**Zod**:
|
|
27
|
+
|
|
28
|
+
```typescript
|
|
29
|
+
import { createWorkflow, createStep } from "@mastra/core/workflows";
|
|
30
|
+
import { z } from "zod";
|
|
31
|
+
|
|
32
|
+
const step1 = createStep({...});
|
|
33
|
+
|
|
34
|
+
export const testWorkflow = createWorkflow({
|
|
35
|
+
id: "test-workflow",
|
|
36
|
+
inputSchema: z.object({
|
|
37
|
+
message: z.string()
|
|
38
|
+
}),
|
|
39
|
+
outputSchema: z.object({
|
|
40
|
+
output: z.string()
|
|
41
|
+
})
|
|
42
|
+
})
|
|
43
|
+
.then(step1)
|
|
44
|
+
.commit();
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
**Valibot**:
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
import { createWorkflow, createStep } from "@mastra/core/workflows";
|
|
51
|
+
import * as v from "valibot";
|
|
52
|
+
import { toStandardJsonSchema } from "@valibot/to-json-schema";
|
|
53
|
+
|
|
54
|
+
const step1 = createStep({...});
|
|
55
|
+
|
|
56
|
+
export const testWorkflow = createWorkflow({
|
|
57
|
+
id: "test-workflow",
|
|
58
|
+
inputSchema: toStandardJsonSchema(v.object({
|
|
59
|
+
message: v.string()
|
|
60
|
+
})),
|
|
61
|
+
outputSchema: toStandardJsonSchema(v.object({
|
|
62
|
+
output: v.string()
|
|
63
|
+
}))
|
|
64
|
+
})
|
|
65
|
+
.then(step1)
|
|
66
|
+
.commit();
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
**ArkType**:
|
|
70
|
+
|
|
71
|
+
```typescript
|
|
72
|
+
import { createWorkflow, createStep } from "@mastra/core/workflows";
|
|
73
|
+
import { type } from "arktype";
|
|
74
|
+
|
|
75
|
+
const step1 = createStep({...});
|
|
76
|
+
|
|
77
|
+
export const testWorkflow = createWorkflow({
|
|
78
|
+
id: "test-workflow",
|
|
79
|
+
inputSchema: type({
|
|
80
|
+
message: "string"
|
|
81
|
+
}),
|
|
82
|
+
outputSchema: type({
|
|
83
|
+
output: "string"
|
|
84
|
+
})
|
|
85
|
+
})
|
|
86
|
+
.then(step1)
|
|
87
|
+
.commit();
|
|
88
|
+
```
|
|
89
|
+
|
|
22
90
|
## Constructor parameters
|
|
23
91
|
|
|
24
92
|
**id** (`string`): Unique identifier for the workflow
|
|
25
93
|
|
|
26
|
-
**inputSchema** (`
|
|
94
|
+
**inputSchema** (`StandardJSONSchemaV1`): Standard JSON Schema defining the input structure for the workflow
|
|
95
|
+
|
|
96
|
+
**outputSchema** (`StandardJSONSchemaV1`): Standard JSON Schema defining the output structure for the workflow
|
|
97
|
+
|
|
98
|
+
**stateSchema** (`StandardJSONSchemaV1`): Optional Standard JSON Schema for the workflow state. Automatically injected when using Mastra's state system. If not specified, type is 'any'.
|
|
99
|
+
|
|
100
|
+
**requestContextSchema** (`StandardJSONSchemaV1`): Standard JSON Schema for validating request context values. When provided, the context is validated at the start of run.start(), throwing an error if validation fails.
|
|
101
|
+
|
|
102
|
+
**schedule** (`WorkflowScheduleConfig | WorkflowScheduleConfig[]`): Optional cron schedule for the workflow. Accepts a single config or an array of configs to fire on multiple cadences. Setting this auto-promotes the workflow to the evented execution engine. See the scheduled workflows guide for usage.
|
|
103
|
+
|
|
104
|
+
**schedule.id** (`string`): Stable identifier for the schedule. Required when passing an array of schedules. Defaults to the workflow id when passing a single schedule object.
|
|
105
|
+
|
|
106
|
+
**schedule.cron** (`string`): A 5-, 6-, or 7-part cron expression. Validated at workflow construction time.
|
|
107
|
+
|
|
108
|
+
**schedule.timezone** (`string`): IANA timezone, for example "America/New\_York". Defaults to the host's local timezone. Set this explicitly in production so fire times do not depend on server locale.
|
|
109
|
+
|
|
110
|
+
**schedule.inputData** (`TInput`): Payload passed as the workflow's input on every fire.
|
|
27
111
|
|
|
28
|
-
**
|
|
112
|
+
**schedule.initialState** (`TState`): Initial state for the run.
|
|
29
113
|
|
|
30
|
-
**
|
|
114
|
+
**schedule.requestContext** (`Record<string, unknown>`): Request context attached to the run.
|
|
31
115
|
|
|
32
|
-
**
|
|
116
|
+
**schedule.metadata** (`Record<string, unknown>`): Arbitrary metadata persisted alongside the schedule row.
|
|
33
117
|
|
|
34
118
|
**options** (`WorkflowOptions`): Optional options for the workflow
|
|
35
119
|
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
# AzureBlobFilesystem
|
|
2
|
+
|
|
3
|
+
Stores files in Azure Blob Storage containers.
|
|
4
|
+
|
|
5
|
+
> **Info:** For interface details, see [WorkspaceFilesystem Interface](https://mastra.ai/reference/workspace/filesystem).
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
**npm**:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @mastra/azure
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
**pnpm**:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pnpm add @mastra/azure
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
**Yarn**:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
yarn add @mastra/azure
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
**Bun**:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
bun add @mastra/azure
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Usage
|
|
34
|
+
|
|
35
|
+
Add an `AzureBlobFilesystem` to a workspace and assign it to an agent:
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
import { Agent } from '@mastra/core/agent'
|
|
39
|
+
import { Workspace } from '@mastra/core/workspace'
|
|
40
|
+
import { AzureBlobFilesystem } from '@mastra/azure/blob'
|
|
41
|
+
|
|
42
|
+
const workspace = new Workspace({
|
|
43
|
+
filesystem: new AzureBlobFilesystem({
|
|
44
|
+
container: 'my-container',
|
|
45
|
+
connectionString: process.env.AZURE_STORAGE_CONNECTION_STRING,
|
|
46
|
+
}),
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
const agent = new Agent({
|
|
50
|
+
name: 'file-agent',
|
|
51
|
+
model: 'anthropic/claude-opus-4-6',
|
|
52
|
+
workspace,
|
|
53
|
+
})
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Account key
|
|
57
|
+
|
|
58
|
+
Use an account name and account key when you do not want to pass a full connection string:
|
|
59
|
+
|
|
60
|
+
```typescript
|
|
61
|
+
import { AzureBlobFilesystem } from '@mastra/azure/blob'
|
|
62
|
+
|
|
63
|
+
const filesystem = new AzureBlobFilesystem({
|
|
64
|
+
container: 'my-container',
|
|
65
|
+
accountName: process.env.AZURE_STORAGE_ACCOUNT_NAME,
|
|
66
|
+
accountKey: process.env.AZURE_STORAGE_ACCOUNT_KEY,
|
|
67
|
+
})
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Shared access signature token
|
|
71
|
+
|
|
72
|
+
Use a shared access signature (SAS) token with either `accountName` or `endpoint`:
|
|
73
|
+
|
|
74
|
+
```typescript
|
|
75
|
+
import { AzureBlobFilesystem } from '@mastra/azure/blob'
|
|
76
|
+
|
|
77
|
+
const filesystem = new AzureBlobFilesystem({
|
|
78
|
+
container: 'my-container',
|
|
79
|
+
accountName: process.env.AZURE_STORAGE_ACCOUNT_NAME,
|
|
80
|
+
sasToken: process.env.AZURE_STORAGE_SAS_TOKEN,
|
|
81
|
+
})
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### DefaultAzureCredential
|
|
85
|
+
|
|
86
|
+
Use `DefaultAzureCredential` when your environment provides Azure identity credentials:
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
import { AzureBlobFilesystem } from '@mastra/azure/blob'
|
|
90
|
+
|
|
91
|
+
const filesystem = new AzureBlobFilesystem({
|
|
92
|
+
container: 'my-container',
|
|
93
|
+
accountName: process.env.AZURE_STORAGE_ACCOUNT_NAME,
|
|
94
|
+
useDefaultCredential: true,
|
|
95
|
+
})
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Install `@azure/identity` when you use `DefaultAzureCredential`:
|
|
99
|
+
|
|
100
|
+
**npm**:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
npm install @azure/identity
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
**pnpm**:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
pnpm add @azure/identity
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
**Yarn**:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
yarn add @azure/identity
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
**Bun**:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
bun add @azure/identity
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Constructor parameters
|
|
125
|
+
|
|
126
|
+
**container** (`string`): Azure Blob Storage container name
|
|
127
|
+
|
|
128
|
+
**connectionString** (`string`): Full Azure Storage connection string. Takes priority over other authentication options.
|
|
129
|
+
|
|
130
|
+
**accountName** (`string`): Azure Storage account name. Required unless you use connectionString or endpoint.
|
|
131
|
+
|
|
132
|
+
**accountKey** (`string`): Azure Storage account key.
|
|
133
|
+
|
|
134
|
+
**sasToken** (`string`): Shared access signature token. Requires accountName or endpoint.
|
|
135
|
+
|
|
136
|
+
**useDefaultCredential** (`boolean`): Use DefaultAzureCredential from @azure/identity. (Default: `false`)
|
|
137
|
+
|
|
138
|
+
**endpoint** (`string`): Custom Blob service endpoint URL. Used for local development with Azurite.
|
|
139
|
+
|
|
140
|
+
**prefix** (`string`): Optional prefix for all keys (acts like a subdirectory).
|
|
141
|
+
|
|
142
|
+
**id** (`string`): Unique identifier for this filesystem instance. (Default: `Auto-generated`)
|
|
143
|
+
|
|
144
|
+
**displayName** (`string`): Human-friendly display name for the UI.
|
|
145
|
+
|
|
146
|
+
**icon** (`FilesystemIcon`): Icon identifier for the UI.
|
|
147
|
+
|
|
148
|
+
**description** (`string`): Short description of this filesystem for the UI.
|
|
149
|
+
|
|
150
|
+
**readOnly** (`boolean`): When true, all write operations are blocked. (Default: `false`)
|
|
151
|
+
|
|
152
|
+
## Properties
|
|
153
|
+
|
|
154
|
+
**id** (`string`): Filesystem instance identifier.
|
|
155
|
+
|
|
156
|
+
**name** (`string`): Provider name ('AzureBlobFilesystem').
|
|
157
|
+
|
|
158
|
+
**provider** (`string`): Provider identifier ('azure-blob').
|
|
159
|
+
|
|
160
|
+
**readOnly** (`boolean | undefined`): Whether the filesystem is in read-only mode.
|
|
161
|
+
|
|
162
|
+
## Methods
|
|
163
|
+
|
|
164
|
+
AzureBlobFilesystem implements the [WorkspaceFilesystem interface](https://mastra.ai/reference/workspace/filesystem), providing all standard filesystem methods:
|
|
165
|
+
|
|
166
|
+
- `readFile(path, options?)` - Read file contents
|
|
167
|
+
- `writeFile(path, content, options?)` - Write content to a file
|
|
168
|
+
- `appendFile(path, content)` - Append content to a file
|
|
169
|
+
- `deleteFile(path, options?)` - Delete a file
|
|
170
|
+
- `copyFile(src, dest, options?)` - Copy a file
|
|
171
|
+
- `moveFile(src, dest, options?)` - Move or rename a file
|
|
172
|
+
- `mkdir(path, options?)` - Create a directory
|
|
173
|
+
- `rmdir(path, options?)` - Remove a directory
|
|
174
|
+
- `readdir(path, options?)` - List directory contents
|
|
175
|
+
- `exists(path)` - Check if a path exists
|
|
176
|
+
- `stat(path)` - Get file or directory metadata
|
|
177
|
+
|
|
178
|
+
### `init()`
|
|
179
|
+
|
|
180
|
+
Initialize the filesystem. Verifies container access and credentials.
|
|
181
|
+
|
|
182
|
+
```typescript
|
|
183
|
+
await filesystem.init()
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### `getInfo()`
|
|
187
|
+
|
|
188
|
+
Returns metadata about this filesystem instance.
|
|
189
|
+
|
|
190
|
+
```typescript
|
|
191
|
+
const info = filesystem.getInfo()
|
|
192
|
+
// { id: '...', name: 'AzureBlobFilesystem', provider: 'azure-blob', status: 'ready' }
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
### `getContainer()`
|
|
196
|
+
|
|
197
|
+
Returns the underlying Azure Blob Storage `ContainerClient`.
|
|
198
|
+
|
|
199
|
+
```typescript
|
|
200
|
+
const container = await filesystem.getContainer()
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### `getMountConfig()`
|
|
204
|
+
|
|
205
|
+
Returns the mount configuration for sandbox providers that support Azure Blob filesystem mounts.
|
|
206
|
+
|
|
207
|
+
```typescript
|
|
208
|
+
const config = filesystem.getMountConfig()
|
|
209
|
+
// { type: 'azure-blob', container: 'my-container', ... }
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
> **Note:** Azure Blob sandbox mounting depends on sandbox support for `azure-blob` mount configs. Use `filesystem` for direct workspace file operations when your sandbox provider does not support Azure Blob mounts.
|
|
213
|
+
|
|
214
|
+
## Related
|
|
215
|
+
|
|
216
|
+
- [WorkspaceFilesystem interface](https://mastra.ai/reference/workspace/filesystem)
|
|
217
|
+
- [S3Filesystem reference](https://mastra.ai/reference/workspace/s3-filesystem)
|
|
218
|
+
- [GCSFilesystem reference](https://mastra.ai/reference/workspace/gcs-filesystem)
|
|
219
|
+
- [Workspace overview](https://mastra.ai/docs/workspace/overview)
|