@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
|
@@ -234,7 +234,18 @@ export const weatherTool = createTool({
|
|
|
234
234
|
|
|
235
235
|
## Reserved keys
|
|
236
236
|
|
|
237
|
-
Mastra reserves special context keys for security purposes. When set
|
|
237
|
+
Mastra reserves special context keys for security purposes. When set, these keys take precedence over client-provided values. The server automatically validates ownership and returns 403 errors when users attempt to access resources they don't own.
|
|
238
|
+
|
|
239
|
+
The easiest way to set `MASTRA_RESOURCE_ID_KEY` is via the `mapUserToResourceId` callback in auth config:
|
|
240
|
+
|
|
241
|
+
```typescript
|
|
242
|
+
auth: {
|
|
243
|
+
authenticateToken: async token => verifyToken(token),
|
|
244
|
+
mapUserToResourceId: user => user.id,
|
|
245
|
+
}
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
You can also set these keys manually in middleware:
|
|
238
249
|
|
|
239
250
|
```typescript
|
|
240
251
|
import { MASTRA_RESOURCE_ID_KEY, MASTRA_THREAD_ID_KEY } from '@mastra/core/request-context'
|
|
@@ -297,7 +308,7 @@ for (const [key, value] of ctx.entries()) {
|
|
|
297
308
|
|
|
298
309
|
## Schema validation
|
|
299
310
|
|
|
300
|
-
Use `requestContextSchema` to define a
|
|
311
|
+
Use `requestContextSchema` to define a [Standard JSON Schema](https://standardschema.dev/json-schema) ([Zod](https://zod.dev/), [Valibot](https://valibot.dev/), [ArkType](https://arktype.io/), etc.) that validates request context values at runtime. This catches missing or invalid context values early, provides clear error messages, and gives you type inference within your component.
|
|
301
312
|
|
|
302
313
|
### Agent schema validation
|
|
303
314
|
|
|
@@ -20,6 +20,7 @@ Mastra currently provides these official server adapters:
|
|
|
20
20
|
- [@mastra/hono](https://mastra.ai/reference/server/hono-adapter)
|
|
21
21
|
- [@mastra/fastify](https://mastra.ai/reference/server/fastify-adapter)
|
|
22
22
|
- [@mastra/koa](https://mastra.ai/reference/server/koa-adapter)
|
|
23
|
+
- [@mastra/nestjs](https://mastra.ai/reference/server/nestjs-adapter)
|
|
23
24
|
|
|
24
25
|
You can build your own adapter, read [custom adapters](https://mastra.ai/docs/server/custom-adapters) for details.
|
|
25
26
|
|
|
@@ -71,7 +72,7 @@ pnpm add @mastra/express@latest
|
|
|
71
72
|
yarn add @mastra/express@latest
|
|
72
73
|
```
|
|
73
74
|
|
|
74
|
-
**
|
|
75
|
+
**NestJS**:
|
|
75
76
|
|
|
76
77
|
```bash
|
|
77
78
|
bun add @mastra/express@latest
|
|
@@ -227,6 +228,56 @@ yarn add @mastra/koa@latest
|
|
|
227
228
|
bun add @mastra/koa@latest
|
|
228
229
|
```
|
|
229
230
|
|
|
231
|
+
**Tab 21**:
|
|
232
|
+
|
|
233
|
+
**npm**:
|
|
234
|
+
|
|
235
|
+
```bash
|
|
236
|
+
npm install @mastra/nestjs@latest
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
**pnpm**:
|
|
240
|
+
|
|
241
|
+
```bash
|
|
242
|
+
pnpm add @mastra/nestjs@latest
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
**Yarn**:
|
|
246
|
+
|
|
247
|
+
```bash
|
|
248
|
+
yarn add @mastra/nestjs@latest
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
**Bun**:
|
|
252
|
+
|
|
253
|
+
```bash
|
|
254
|
+
bun add @mastra/nestjs@latest
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
**Tab 22**:
|
|
258
|
+
|
|
259
|
+
```bash
|
|
260
|
+
npm install @mastra/nestjs@latest
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
**Tab 23**:
|
|
264
|
+
|
|
265
|
+
```bash
|
|
266
|
+
pnpm add @mastra/nestjs@latest
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
**Tab 24**:
|
|
270
|
+
|
|
271
|
+
```bash
|
|
272
|
+
yarn add @mastra/nestjs@latest
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
**Tab 25**:
|
|
276
|
+
|
|
277
|
+
```bash
|
|
278
|
+
bun add @mastra/nestjs@latest
|
|
279
|
+
```
|
|
280
|
+
|
|
230
281
|
## Configuration
|
|
231
282
|
|
|
232
283
|
Initialize your app as usual, then create a `MastraServer` by passing in the `app` and your main `mastra` instance from `src/mastra/index.ts`. Calling `init()` automatically registers Mastra middleware and all available endpoints. You can continue adding your own routes as normal, either before or after `init()`, and they’ll run alongside Mastra’s endpoints.
|
|
@@ -336,6 +387,37 @@ app.listen(port, () => {
|
|
|
336
387
|
|
|
337
388
|
> **Info:** See the [Koa Adapter](https://mastra.ai/reference/server/koa-adapter) documentation for full configuration options.
|
|
338
389
|
|
|
390
|
+
**NestJS**:
|
|
391
|
+
|
|
392
|
+
```typescript
|
|
393
|
+
import { Module } from '@nestjs/common'
|
|
394
|
+
import { MastraModule } from '@mastra/nestjs'
|
|
395
|
+
import { mastra } from './mastra'
|
|
396
|
+
|
|
397
|
+
@Module({
|
|
398
|
+
imports: [
|
|
399
|
+
MastraModule.register({
|
|
400
|
+
mastra,
|
|
401
|
+
}),
|
|
402
|
+
],
|
|
403
|
+
})
|
|
404
|
+
export class AppModule {}
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
```typescript
|
|
408
|
+
import { NestFactory } from '@nestjs/core'
|
|
409
|
+
import { AppModule } from './app.module'
|
|
410
|
+
|
|
411
|
+
async function bootstrap() {
|
|
412
|
+
const app = await NestFactory.create(AppModule)
|
|
413
|
+
await app.listen(3000)
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
bootstrap()
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
> **Info:** See the [NestJS Adapter](https://mastra.ai/reference/server/nestjs-adapter) documentation for full configuration options.
|
|
420
|
+
|
|
339
421
|
## Initialization flow
|
|
340
422
|
|
|
341
423
|
Calling `init()` runs three steps in order. Understanding this flow helps when you need to insert your own middleware at specific points.
|
|
@@ -553,10 +635,11 @@ See [MCP](https://mastra.ai/docs/mcp/overview) for configuration details and how
|
|
|
553
635
|
|
|
554
636
|
## Related
|
|
555
637
|
|
|
556
|
-
- [Hono Adapter](https://mastra.ai/reference/server/hono-adapter)
|
|
557
|
-
- [Express Adapter](https://mastra.ai/reference/server/express-adapter)
|
|
558
|
-
- [
|
|
559
|
-
- [
|
|
560
|
-
- [
|
|
561
|
-
- [
|
|
562
|
-
- [
|
|
638
|
+
- [Hono Adapter](https://mastra.ai/reference/server/hono-adapter) - Hono-specific setup
|
|
639
|
+
- [Express Adapter](https://mastra.ai/reference/server/express-adapter) - Express-specific setup
|
|
640
|
+
- [NestJS Adapter](https://mastra.ai/reference/server/nestjs-adapter) - NestJS-specific setup
|
|
641
|
+
- [Custom Adapters](https://mastra.ai/docs/server/custom-adapters) - Building adapters for other frameworks
|
|
642
|
+
- [Server Configuration](https://mastra.ai/docs/server/mastra-server) - Using `mastra build` instead
|
|
643
|
+
- [Authentication](https://mastra.ai/docs/server/auth) - Configuring auth for your server
|
|
644
|
+
- [MastraServer Reference](https://mastra.ai/reference/server/mastra-server) - Full API reference
|
|
645
|
+
- [createRoute() Reference](https://mastra.ai/reference/server/create-route) - Creating type-safe custom routes
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# Background task streaming
|
|
2
|
+
|
|
3
|
+
**Added in:** `@mastra/core@1.29.0`
|
|
4
|
+
|
|
5
|
+
`mastra.backgroundTaskManager.stream()` returns a `ReadableStream` of [background task](https://mastra.ai/docs/agents/background-tasks) lifecycle events. Use it to monitor running tasks across the system, for example to drive a status dashboard, surface progress in your own UI, or pipe events into an SSE response.
|
|
6
|
+
|
|
7
|
+
The stream emits the same chunk types that appear inside `Agent.streamUntilIdle()` (`background-task-running`, `background-task-output`, `background-task-completed`, `background-task-failed`, `background-task-cancelled`). See [background task chunks](https://mastra.ai/reference/streaming/ChunkType) for the full payload shapes.
|
|
8
|
+
|
|
9
|
+
> **Note:** Background tasks must be [enabled on the Mastra instance](https://mastra.ai/reference/configuration) before `backgroundTaskManager` is available. When disabled, `mastra.backgroundTaskManager` is `undefined`.
|
|
10
|
+
|
|
11
|
+
## Subscribe to all task events
|
|
12
|
+
|
|
13
|
+
Calling `stream()` with no filter returns a stream of every task event in the system. On connection, the stream emits a snapshot of all currently running tasks, then forwards live events as they happen.
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
const bgManager = mastra.backgroundTaskManager
|
|
17
|
+
if (!bgManager) throw new Error('Background tasks are not enabled')
|
|
18
|
+
|
|
19
|
+
const controller = new AbortController()
|
|
20
|
+
const stream = bgManager.stream({ abortSignal: controller.signal })
|
|
21
|
+
|
|
22
|
+
for await (const chunk of stream) {
|
|
23
|
+
switch (chunk.type) {
|
|
24
|
+
case 'background-task-running':
|
|
25
|
+
console.log('started', chunk.payload.taskId, chunk.payload.toolName)
|
|
26
|
+
break
|
|
27
|
+
case 'background-task-completed':
|
|
28
|
+
console.log('done', chunk.payload.taskId, chunk.payload.result)
|
|
29
|
+
break
|
|
30
|
+
case 'background-task-failed':
|
|
31
|
+
console.error('failed', chunk.payload.taskId, chunk.payload.error)
|
|
32
|
+
break
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
The stream stays open until the caller's `AbortSignal` fires. Always pass an `abortSignal` so you can disconnect cleanly.
|
|
38
|
+
|
|
39
|
+
## Filter the stream
|
|
40
|
+
|
|
41
|
+
Pass any combination of filter options to narrow the events you receive. Filters apply to both the initial snapshot and the live event subscription.
|
|
42
|
+
|
|
43
|
+
```typescript
|
|
44
|
+
const stream = bgManager.stream({
|
|
45
|
+
agentId: 'researcher',
|
|
46
|
+
threadId: 't1',
|
|
47
|
+
resourceId: 'u1',
|
|
48
|
+
abortSignal: controller.signal,
|
|
49
|
+
})
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
| Filter | Description |
|
|
53
|
+
| ------------- | --------------------------------------------------- |
|
|
54
|
+
| `agentId` | Only events from tasks dispatched by this agent |
|
|
55
|
+
| `runId` | Only events from this specific agent run |
|
|
56
|
+
| `threadId` | Only events from tasks scoped to this memory thread |
|
|
57
|
+
| `resourceId` | Only events from tasks scoped to this resource |
|
|
58
|
+
| `taskId` | Only events for a single task |
|
|
59
|
+
| `abortSignal` | Closes the stream when the signal aborts |
|
|
60
|
+
|
|
61
|
+
## Look up task state directly
|
|
62
|
+
|
|
63
|
+
For one-off lookups instead of a live stream, use `getTask` and `listTasks`:
|
|
64
|
+
|
|
65
|
+
```typescript
|
|
66
|
+
const task = await mastra.backgroundTaskManager?.getTask(taskId)
|
|
67
|
+
const { tasks, total } = await mastra.backgroundTaskManager?.listTasks({
|
|
68
|
+
status: 'running',
|
|
69
|
+
agentId: 'researcher',
|
|
70
|
+
})
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
These read from storage rather than the pubsub stream, so they're suitable for paginated lists and detail views.
|
|
74
|
+
|
|
75
|
+
## Related
|
|
76
|
+
|
|
77
|
+
- [Background tasks](https://mastra.ai/docs/agents/background-tasks)
|
|
78
|
+
- [`Agent.streamUntilIdle()` reference](https://mastra.ai/reference/streaming/agents/streamUntilIdle)
|
|
79
|
+
- [Background task chunks](https://mastra.ai/reference/streaming/ChunkType)
|
|
80
|
+
- [backgroundTasks configuration reference](https://mastra.ai/reference/configuration)
|
|
@@ -29,6 +29,8 @@ for await (const chunk of stream.textStream) {
|
|
|
29
29
|
|
|
30
30
|
> **Info:** Visit [Agent.stream()](https://mastra.ai/reference/streaming/agents/stream) for more information.
|
|
31
31
|
|
|
32
|
+
> **Tip:** For agents that dispatch [background tasks](https://mastra.ai/docs/agents/background-tasks), use [`Agent.streamUntilIdle()`](https://mastra.ai/reference/streaming/agents/streamUntilIdle) to keep the stream open until those tasks complete and the agent has had a chance to respond to their results.
|
|
33
|
+
|
|
32
34
|
### Output from `Agent.stream()`
|
|
33
35
|
|
|
34
36
|
The output streams the generated response from the agent.
|
|
@@ -129,5 +131,6 @@ A workflow stream provides access to various response properties:
|
|
|
129
131
|
## Related
|
|
130
132
|
|
|
131
133
|
- [Streaming events](https://mastra.ai/docs/streaming/events)
|
|
134
|
+
- [Background tasks](https://mastra.ai/docs/agents/background-tasks)
|
|
132
135
|
- [Using Agents](https://mastra.ai/docs/agents/overview)
|
|
133
136
|
- [Workflows overview](https://mastra.ai/docs/workflows/overview)
|
|
@@ -4,8 +4,8 @@ Studio is a React-based Single Page Application (SPA) that runs in the browser a
|
|
|
4
4
|
|
|
5
5
|
You can deploy Studio in two primary ways:
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
7
|
+
- The Mastra platform provides a hosted Studio for you and allows you to share access with your team via link
|
|
8
|
+
- Self-host Studio on your own infrastructure, either alongside your Mastra server or separately as a standalone SPA
|
|
9
9
|
|
|
10
10
|
On this page you'll learn how to deploy Studio on your own infrastructure. As the finer details of deployment can vary widely based on your needs and setup, we'll cover the general principles and options available to you.
|
|
11
11
|
|
|
@@ -49,15 +49,33 @@ mastra studio
|
|
|
49
49
|
|
|
50
50
|
Open [localhost:3000](http://localhost:3000) in your browser to see the Studio UI. By default, it will attempt to connect to a Mastra server running at `http://localhost:4111`. If it doesn't find one there, you'll see a form where you can enter your Mastra instance URL and API prefix.
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
The command uses Node's built-in `http` module and [`serve-handler`](https://www.npmjs.com/package/serve-handler) to serve the static files.
|
|
53
|
+
|
|
54
|
+
> **Note:** If you're hosting Studio under a subpath (for example `/agents` behind Nginx), set `MASTRA_STUDIO_BASE_PATH` before starting Studio:
|
|
55
|
+
>
|
|
56
|
+
> ```bash
|
|
57
|
+
> MASTRA_STUDIO_BASE_PATH=/agents mastra studio
|
|
58
|
+
> ```
|
|
59
|
+
>
|
|
60
|
+
> This updates the HTML base URL and static asset routing so the standalone Studio works correctly under that subpath.
|
|
61
|
+
|
|
62
|
+
## Mastra platform
|
|
63
|
+
|
|
64
|
+
The [Mastra platform](https://mastra.ai/docs/mastra-platform/overview) allows you to deploy your Studio to the cloud. Run a single CLI command, and the platform handles provisioning, deployment, and hosting.
|
|
65
|
+
|
|
66
|
+
Run the following command:
|
|
53
67
|
|
|
54
68
|
```bash
|
|
55
|
-
|
|
69
|
+
mastra studio deploy
|
|
56
70
|
```
|
|
57
71
|
|
|
58
|
-
|
|
72
|
+
> **Note:** See the [CLI reference](https://mastra.ai/reference/cli/mastra) for the full list of flags and CI/CD usage.
|
|
59
73
|
|
|
60
|
-
|
|
74
|
+
This builds your project (compiling `src/mastra/` into `.mastra/output`), packages it as an artifact ZIP, uploads it, and deploys it to a cloud sandbox.
|
|
75
|
+
|
|
76
|
+
If this is your first deploy, the CLI will prompt you to create a new project or select an existing one. The `.mastra-project.json` file is written automatically.
|
|
77
|
+
|
|
78
|
+
A deploy transitions through **queued → uploading → starting → running** (or **failed** if something goes wrong). If a sandbox is already running for your project, the platform hot-updates it in place with no downtime. Otherwise it creates a fresh sandbox. Your instance URL is assigned per project slug and remains stable across deploys. Environment variables from `.env`, `.env.local`, and `.env.production` are included automatically.
|
|
61
79
|
|
|
62
80
|
## Running a server
|
|
63
81
|
|
|
@@ -87,7 +87,7 @@ export const mastra = new Mastra({
|
|
|
87
87
|
serviceName: 'mastra',
|
|
88
88
|
exporters: [
|
|
89
89
|
new DefaultExporter(), // Persists traces to storage for Mastra Studio
|
|
90
|
-
new CloudExporter(), // Sends
|
|
90
|
+
new CloudExporter(), // Sends observability data to hosted Mastra Studio (if MASTRA_CLOUD_ACCESS_TOKEN is set)
|
|
91
91
|
],
|
|
92
92
|
spanOutputProcessors: [
|
|
93
93
|
new SensitiveDataFilter(), // Redacts sensitive data like passwords, tokens, keys
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
# Studio
|
|
2
2
|
|
|
3
|
-
Studio provides an interactive UI for building, testing, and managing your agents, workflows, and tools. Run it locally during development, or [deploy it](https://mastra.ai/docs/studio/deployment) to production so your team can manage agents, monitor performance, and gain insights through built-in observability.
|
|
4
|
-
|
|
5
|
-
Add [authentication](https://mastra.ai/docs/studio/auth) to protect your deployed Studio with login screens, role-based access control, and permission-based UI rendering so you can control what each team member can see and do. You can also [create a project in Mastra Cloud](https://mastra.ai/docs/mastra-cloud/setup) for a hosted option.
|
|
3
|
+
Studio provides an interactive UI for building, testing, and managing your agents, workflows, and tools. Run it locally during development, add [authentication](https://mastra.ai/docs/studio/auth), or [deploy it](https://mastra.ai/docs/studio/deployment) to production so your team can manage agents, monitor performance, and gain insights through built-in observability.
|
|
6
4
|
|
|
7
5
|
[YouTube video player](https://www.youtube-nocookie.com/embed/ojGu6Bi4wYk)
|
|
8
6
|
|
|
@@ -39,7 +37,7 @@ Once the server is running, you can:
|
|
|
39
37
|
- Open the Studio UI at [http://localhost:4111](http://localhost:4111/) to interact with your agents, workflows, and tools.
|
|
40
38
|
- Visit <http://localhost:4111/swagger-ui> to discover and interact with the underlying REST API.
|
|
41
39
|
|
|
42
|
-
|
|
40
|
+
While Studio is running, you can edit your [agents](https://mastra.ai/docs/agents/overview), [workflows](https://mastra.ai/docs/workflows/overview), and other parts of your Mastra application in real time.
|
|
43
41
|
|
|
44
42
|
## Primitives
|
|
45
43
|
|
|
@@ -49,6 +47,8 @@ Chat with your agent directly, dynamically switch [models](https://mastra.ai/mod
|
|
|
49
47
|
|
|
50
48
|
When you interact with your agent, you can follow each step of its reasoning, view tool call outputs, and [observe](#observability) traces and logs to see how responses are generated. You can also attach [scorers](#scorers) to measure and compare response quality over time.
|
|
51
49
|
|
|
50
|
+
Use [Editor](https://mastra.ai/docs/editor/overview) to let non-technical team members iterate on agents, version every change, and run experiments without redeploying.
|
|
51
|
+
|
|
52
52
|
### Workflows
|
|
53
53
|
|
|
54
54
|
Visualize your workflow as a graph and run it step by step with a custom input. During execution, the interface updates in real time to show the active step and the path taken.
|
|
@@ -265,7 +265,7 @@ const { text } = await voiceAgent.generate('What color is the sky?')
|
|
|
265
265
|
|
|
266
266
|
// Convert text to speech to an Audio Stream
|
|
267
267
|
const audioStream = await voiceAgent.voice.speak(text, {
|
|
268
|
-
speaker: '
|
|
268
|
+
speaker: 'shubh', // Optional: specify a bulbul:v3 speaker
|
|
269
269
|
})
|
|
270
270
|
|
|
271
271
|
playAudio(audioStream)
|
|
@@ -588,6 +588,49 @@ await voiceAgent.voice.send(micStream)
|
|
|
588
588
|
|
|
589
589
|
Visit the [Google Gemini Live Reference](https://mastra.ai/reference/voice/google-gemini-live) for more information on the Google Gemini Live voice provider.
|
|
590
590
|
|
|
591
|
+
**AWS Nova Sonic**:
|
|
592
|
+
|
|
593
|
+
```typescript
|
|
594
|
+
import { Agent } from '@mastra/core/agent'
|
|
595
|
+
import { playAudio, getMicrophoneStream } from '@mastra/node-audio'
|
|
596
|
+
import { NovaSonicVoice } from '@mastra/voice-aws-nova-sonic'
|
|
597
|
+
|
|
598
|
+
const voiceAgent = new Agent({
|
|
599
|
+
id: 'voice-agent',
|
|
600
|
+
name: 'Voice Agent',
|
|
601
|
+
instructions: 'You are a voice assistant that can help users with their tasks.',
|
|
602
|
+
model: 'openai/gpt-5.4',
|
|
603
|
+
voice: new NovaSonicVoice({
|
|
604
|
+
region: 'us-east-1',
|
|
605
|
+
speaker: 'matthew',
|
|
606
|
+
// Static credentials are optional. The default AWS credential
|
|
607
|
+
// provider chain is used when none are passed.
|
|
608
|
+
}),
|
|
609
|
+
})
|
|
610
|
+
|
|
611
|
+
// Connect before using speak/send
|
|
612
|
+
await voiceAgent.voice.connect()
|
|
613
|
+
|
|
614
|
+
// Listen for assistant audio (Int16Array PCM)
|
|
615
|
+
voiceAgent.voice.on('speaking', ({ audioData }) => {
|
|
616
|
+
if (audioData) playAudio(audioData)
|
|
617
|
+
})
|
|
618
|
+
|
|
619
|
+
// Listen for transcribed text
|
|
620
|
+
voiceAgent.voice.on('writing', ({ text, role }) => {
|
|
621
|
+
console.log(`${role}: ${text}`)
|
|
622
|
+
})
|
|
623
|
+
|
|
624
|
+
// Initiate the conversation
|
|
625
|
+
await voiceAgent.voice.speak('How can I help you today?')
|
|
626
|
+
|
|
627
|
+
// Send continuous audio from the microphone
|
|
628
|
+
const micStream = getMicrophoneStream()
|
|
629
|
+
await voiceAgent.voice.send(micStream)
|
|
630
|
+
```
|
|
631
|
+
|
|
632
|
+
Visit the [AWS Nova Sonic Reference](https://mastra.ai/reference/voice/aws-nova-sonic) for more information on the AWS Nova Sonic voice provider.
|
|
633
|
+
|
|
591
634
|
## Voice configuration
|
|
592
635
|
|
|
593
636
|
Each voice provider can be configured with different models and options. Below are the detailed configuration options for all supported providers:
|
|
@@ -760,12 +803,15 @@ Visit the [Speechify Voice Reference](https://mastra.ai/reference/voice/speechif
|
|
|
760
803
|
// Sarvam Voice Configuration
|
|
761
804
|
const voice = new SarvamVoice({
|
|
762
805
|
speechModel: {
|
|
763
|
-
|
|
806
|
+
model: 'bulbul:v3', // TTS model (bulbul:v2 or bulbul:v3)
|
|
764
807
|
apiKey: process.env.SARVAM_API_KEY,
|
|
765
|
-
language: 'en-IN', //
|
|
766
|
-
style: 'conversational', // Style setting
|
|
808
|
+
language: 'en-IN', // BCP-47 language code
|
|
767
809
|
},
|
|
768
|
-
|
|
810
|
+
listeningModel: {
|
|
811
|
+
model: 'saarika:v2.5', // STT model (saarika:v2.5 or saaras:v3)
|
|
812
|
+
apiKey: process.env.SARVAM_API_KEY,
|
|
813
|
+
},
|
|
814
|
+
speaker: 'shubh', // Default bulbul:v3 speaker
|
|
769
815
|
})
|
|
770
816
|
```
|
|
771
817
|
|
|
@@ -825,6 +871,28 @@ const voice = new GeminiLiveVoice({
|
|
|
825
871
|
|
|
826
872
|
Visit the [Google Gemini Live Reference](https://mastra.ai/reference/voice/google-gemini-live) for more information on the Google Gemini Live voice provider.
|
|
827
873
|
|
|
874
|
+
**AWS Nova Sonic**:
|
|
875
|
+
|
|
876
|
+
```typescript
|
|
877
|
+
// AWS Nova Sonic Voice Configuration
|
|
878
|
+
const voice = new NovaSonicVoice({
|
|
879
|
+
region: 'us-east-1',
|
|
880
|
+
speaker: 'matthew',
|
|
881
|
+
sessionConfig: {
|
|
882
|
+
inferenceConfiguration: {
|
|
883
|
+
temperature: 0.7,
|
|
884
|
+
maxTokens: 1024,
|
|
885
|
+
},
|
|
886
|
+
turnDetectionConfiguration: {
|
|
887
|
+
endpointingSensitivity: 'MEDIUM',
|
|
888
|
+
},
|
|
889
|
+
},
|
|
890
|
+
// AWS Nova Sonic is a realtime bidirectional API without separate speech and listening models
|
|
891
|
+
})
|
|
892
|
+
```
|
|
893
|
+
|
|
894
|
+
Visit the [AWS Nova Sonic Reference](https://mastra.ai/reference/voice/aws-nova-sonic) for more information on the AWS Nova Sonic voice provider.
|
|
895
|
+
|
|
828
896
|
**AI SDK**:
|
|
829
897
|
|
|
830
898
|
```typescript
|
|
@@ -954,6 +1022,7 @@ For more information on the CompositeVoice, refer to the [CompositeVoice Referen
|
|
|
954
1022
|
- [Azure Voice](https://mastra.ai/reference/voice/azure)
|
|
955
1023
|
- [Google Voice](https://mastra.ai/reference/voice/google)
|
|
956
1024
|
- [Google Gemini Live Voice](https://mastra.ai/reference/voice/google-gemini-live)
|
|
1025
|
+
- [AWS Nova Sonic Voice](https://mastra.ai/reference/voice/aws-nova-sonic)
|
|
957
1026
|
- [Deepgram Voice](https://mastra.ai/reference/voice/deepgram)
|
|
958
1027
|
- [PlayAI Voice](https://mastra.ai/reference/voice/playai)
|
|
959
1028
|
- [Voice Examples](https://github.com/mastra-ai/voice-examples)
|
|
@@ -99,4 +99,48 @@ await agent.voice.send(micStream)
|
|
|
99
99
|
Note:
|
|
100
100
|
|
|
101
101
|
- Live API requires `GOOGLE_API_KEY`. Vertex AI requires project/location and service account credentials.
|
|
102
|
-
- Events: `speaker` (audio stream), `writing` (text), `turnComplete`, `usage`, and `error`.
|
|
102
|
+
- Events: `speaker` (audio stream), `writing` (text), `turnComplete`, `usage`, and `error`.
|
|
103
|
+
|
|
104
|
+
## AWS Nova Sonic (Realtime)
|
|
105
|
+
|
|
106
|
+
```typescript
|
|
107
|
+
import { Agent } from '@mastra/core/agent'
|
|
108
|
+
import { NovaSonicVoice } from '@mastra/voice-aws-nova-sonic'
|
|
109
|
+
import { playAudio, getMicrophoneStream } from '@mastra/node-audio'
|
|
110
|
+
|
|
111
|
+
const agent = new Agent({
|
|
112
|
+
id: 'agent',
|
|
113
|
+
name: 'Nova Sonic Agent',
|
|
114
|
+
instructions: 'You are a helpful assistant with real-time voice capabilities.',
|
|
115
|
+
// Model used for text generation; voice provider handles realtime audio
|
|
116
|
+
model: 'openai/gpt-5.4',
|
|
117
|
+
voice: new NovaSonicVoice({
|
|
118
|
+
region: 'us-east-1',
|
|
119
|
+
speaker: 'matthew',
|
|
120
|
+
// Static credentials are optional. The default AWS credential provider
|
|
121
|
+
// chain is used when none are passed.
|
|
122
|
+
}),
|
|
123
|
+
})
|
|
124
|
+
|
|
125
|
+
await agent.voice.connect()
|
|
126
|
+
|
|
127
|
+
// Assistant audio is emitted as 16-bit PCM on the `speaking` event
|
|
128
|
+
agent.voice.on('speaking', ({ audioData }) => {
|
|
129
|
+
if (audioData) playAudio(audioData)
|
|
130
|
+
})
|
|
131
|
+
|
|
132
|
+
agent.voice.on('writing', ({ role, text }) => {
|
|
133
|
+
console.log(`${role}: ${text}`)
|
|
134
|
+
})
|
|
135
|
+
|
|
136
|
+
await agent.voice.speak('How can I help you today?')
|
|
137
|
+
|
|
138
|
+
const micStream = getMicrophoneStream()
|
|
139
|
+
await agent.voice.send(micStream)
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Note:
|
|
143
|
+
|
|
144
|
+
- Available regions: `us-east-1`, `us-west-2`, and `ap-northeast-1`.
|
|
145
|
+
- Authenticates through the standard AWS credential provider chain. Pass `credentials` to override.
|
|
146
|
+
- Events: `speaking` (Int16Array audio), `writing` (text with `generationStage`), `toolCall`, `interrupt`, `turnComplete`, `usage`, `session`, and `error`.
|
|
@@ -28,13 +28,13 @@ const voice = new OpenAIVoice()
|
|
|
28
28
|
|
|
29
29
|
Mastra supports several Speech-to-Text providers, each with their own capabilities and strengths:
|
|
30
30
|
|
|
31
|
-
- [**OpenAI**](https://mastra.ai/reference/voice/openai)
|
|
32
|
-
- [**Azure**](https://mastra.ai/reference/voice/azure)
|
|
33
|
-
- [**ElevenLabs**](https://mastra.ai/reference/voice/elevenlabs)
|
|
34
|
-
- [**Google**](https://mastra.ai/reference/voice/google)
|
|
35
|
-
- [**Cloudflare**](https://mastra.ai/reference/voice/cloudflare)
|
|
36
|
-
- [**Deepgram**](https://mastra.ai/reference/voice/deepgram)
|
|
37
|
-
- [**Sarvam**](https://mastra.ai/reference/voice/sarvam)
|
|
31
|
+
- [**OpenAI**](https://mastra.ai/reference/voice/openai): High-accuracy transcription with Whisper models
|
|
32
|
+
- [**Azure**](https://mastra.ai/reference/voice/azure): Microsoft's speech recognition with enterprise-grade reliability
|
|
33
|
+
- [**ElevenLabs**](https://mastra.ai/reference/voice/elevenlabs): Advanced speech recognition with support for multiple languages
|
|
34
|
+
- [**Google**](https://mastra.ai/reference/voice/google): Google's speech recognition with extensive language support
|
|
35
|
+
- [**Cloudflare**](https://mastra.ai/reference/voice/cloudflare): Edge-optimized speech recognition for low-latency applications
|
|
36
|
+
- [**Deepgram**](https://mastra.ai/reference/voice/deepgram): AI-powered speech recognition with high accuracy for various accents
|
|
37
|
+
- [**Sarvam**](https://mastra.ai/reference/voice/sarvam): Specialized in Indic languages and accents
|
|
38
38
|
|
|
39
39
|
Each provider is implemented as a separate package that you can install as needed:
|
|
40
40
|
|
|
@@ -33,16 +33,16 @@ const voice = new OpenAIVoice()
|
|
|
33
33
|
|
|
34
34
|
Mastra supports a wide range of Text-to-Speech providers, each with their own unique capabilities and voice options. You can choose the provider that best suits your application's needs:
|
|
35
35
|
|
|
36
|
-
- [**OpenAI**](https://mastra.ai/reference/voice/openai)
|
|
37
|
-
- [**Azure**](https://mastra.ai/reference/voice/azure)
|
|
38
|
-
- [**ElevenLabs**](https://mastra.ai/reference/voice/elevenlabs)
|
|
39
|
-
- [**PlayAI**](https://mastra.ai/reference/voice/playai)
|
|
40
|
-
- [**Google**](https://mastra.ai/reference/voice/google)
|
|
41
|
-
- [**Cloudflare**](https://mastra.ai/reference/voice/cloudflare)
|
|
42
|
-
- [**Deepgram**](https://mastra.ai/reference/voice/deepgram)
|
|
43
|
-
- [**Speechify**](https://mastra.ai/reference/voice/speechify)
|
|
44
|
-
- [**Sarvam**](https://mastra.ai/reference/voice/sarvam)
|
|
45
|
-
- [**Murf**](https://mastra.ai/reference/voice/murf)
|
|
36
|
+
- [**OpenAI**](https://mastra.ai/reference/voice/openai): High-quality voices with natural intonation and expression
|
|
37
|
+
- [**Azure**](https://mastra.ai/reference/voice/azure): Microsoft's speech service with a wide range of voices and languages
|
|
38
|
+
- [**ElevenLabs**](https://mastra.ai/reference/voice/elevenlabs): Ultra-realistic voices with emotion and fine-grained control
|
|
39
|
+
- [**PlayAI**](https://mastra.ai/reference/voice/playai): Specialized in natural-sounding voices with various styles
|
|
40
|
+
- [**Google**](https://mastra.ai/reference/voice/google): Google's speech synthesis with multilingual support
|
|
41
|
+
- [**Cloudflare**](https://mastra.ai/reference/voice/cloudflare): Edge-optimized speech synthesis for low-latency applications
|
|
42
|
+
- [**Deepgram**](https://mastra.ai/reference/voice/deepgram): AI-powered speech technology with high accuracy
|
|
43
|
+
- [**Speechify**](https://mastra.ai/reference/voice/speechify): Text-to-speech optimized for readability and accessibility
|
|
44
|
+
- [**Sarvam**](https://mastra.ai/reference/voice/sarvam): Specialized in Indic languages and accents
|
|
45
|
+
- [**Murf**](https://mastra.ai/reference/voice/murf): Studio-quality voice overs with customizable parameters
|
|
46
46
|
|
|
47
47
|
Each provider is implemented as a separate package that you can install as needed:
|
|
48
48
|
|
|
@@ -104,7 +104,7 @@ export const testWorkflow = createWorkflow({})
|
|
|
104
104
|
.commit()
|
|
105
105
|
```
|
|
106
106
|
|
|
107
|
-
The `structuredOutput.schema` option accepts any
|
|
107
|
+
The `structuredOutput.schema` option accepts any Standard JSON Schema. The agent will generate output conforming to this schema, and the step's `outputSchema` will be automatically set to match.
|
|
108
108
|
|
|
109
109
|
> **Info:** Visit [Structured Output](https://mastra.ai/docs/agents/structured-output) for more options like error handling strategies and streaming with structured output.
|
|
110
110
|
|