@mastra/mcp-docs-server 1.2.11-alpha.6 → 1.2.12-alpha.0
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/using-tools.md +25 -0
- package/.docs/guides/build-your-ui/ai-sdk-ui.md +5 -5
- package/.docs/guides/build-your-ui/copilotkit/generative-ui.md +8 -8
- package/.docs/guides/build-your-ui/copilotkit/overview.md +2 -2
- package/.docs/guides/build-your-ui/openui.md +1 -1
- package/.docs/guides/concepts/multi-agent-systems.md +5 -5
- package/.docs/guides/concepts/streaming.md +9 -9
- package/.docs/guides/deployment/amazon-ec2.md +1 -1
- package/.docs/guides/deployment/aws-lambda.md +1 -1
- package/.docs/guides/deployment/azure-app-services.md +1 -1
- package/.docs/guides/deployment/cloudflare.md +1 -1
- package/.docs/guides/deployment/inngest.md +6 -6
- package/.docs/guides/deployment/temporal.md +1 -1
- package/.docs/guides/deployment/vercel.md +1 -1
- package/.docs/guides/getting-started/astro.md +1 -1
- package/.docs/guides/getting-started/electron.md +1 -1
- package/.docs/guides/getting-started/nestjs.md +5 -5
- package/.docs/guides/getting-started/vite-react.md +1 -1
- package/.docs/guides/guide/chef-michel.md +1 -1
- package/.docs/guides/guide/code-review-bot.md +1 -1
- package/.docs/guides/guide/coding-agent.md +4 -4
- package/.docs/guides/guide/dev-assistant.md +1 -1
- package/.docs/guides/guide/docs-manager.md +3 -3
- package/.docs/guides/guide/github-actions-pr-description.md +4 -4
- package/.docs/guides/guide/research-assistant.md +3 -3
- package/.docs/guides/guide/research-coordinator.md +3 -3
- package/.docs/guides/guide/slack-assistant.md +1 -1
- package/.docs/guides/guide/stock-agent.md +1 -1
- package/.docs/guides/index.md +1 -1
- package/.docs/guides/migrations/ai-sdk-v4-to-v5.md +1 -1
- package/.docs/guides/migrations/mastra-cloud.md +6 -6
- package/.docs/guides/migrations/network-to-supervisor.md +9 -9
- package/.docs/guides/migrations/upgrade-to-v1/agent.md +5 -5
- package/.docs/guides/migrations/upgrade-to-v1/cli.md +1 -1
- package/.docs/guides/migrations/upgrade-to-v1/client.md +3 -3
- package/.docs/guides/migrations/upgrade-to-v1/evals.md +2 -2
- package/.docs/guides/migrations/upgrade-to-v1/memory.md +1 -1
- package/.docs/guides/migrations/upgrade-to-v1/overview.md +3 -3
- package/.docs/guides/migrations/upgrade-to-v1/processors.md +1 -1
- package/.docs/guides/migrations/upgrade-to-v1/storage.md +11 -11
- package/.docs/guides/migrations/upgrade-to-v1/tools.md +3 -3
- package/.docs/guides/migrations/upgrade-to-v1/tracing.md +2 -2
- package/.docs/guides/migrations/upgrade-to-v1/voice.md +1 -1
- package/.docs/guides/migrations/upgrade-to-v1/workflows.md +1 -1
- package/.docs/models/environment-variables.md +1 -0
- package/.docs/models/gateways/vercel.md +1 -2
- package/.docs/models/index.md +1 -1
- package/.docs/models/providers/aiand.md +1 -3
- package/.docs/models/providers/berget.md +2 -1
- package/.docs/models/providers/hyper.md +7 -7
- package/.docs/models/providers/modal.md +73 -0
- package/.docs/models/providers/xpersona.md +12 -2
- package/.docs/models/providers.md +1 -0
- package/.docs/reference/acp/acp-agent.md +3 -3
- package/.docs/reference/acp/create-acp-tool.md +2 -2
- package/.docs/reference/agent-controller/agent-controller-class.md +36 -36
- package/.docs/reference/agent-controller/session.md +6 -6
- package/.docs/reference/agents/agent.md +7 -7
- package/.docs/reference/agents/channels.md +3 -3
- package/.docs/reference/agents/durable-agent.md +3 -3
- package/.docs/reference/agents/generate.md +3 -3
- package/.docs/reference/agents/getDefaultOptions.md +1 -1
- package/.docs/reference/agents/getDefaultStreamOptions.md +1 -1
- package/.docs/reference/agents/listScorers.md +1 -1
- package/.docs/reference/agents/listSkills.md +1 -1
- package/.docs/reference/agents/listSuspendedRuns.md +2 -2
- package/.docs/reference/ai-sdk/chat-route.md +1 -1
- package/.docs/reference/ai-sdk/network-route.md +1 -1
- package/.docs/reference/ai-sdk/to-ai-sdk-messages.md +1 -1
- package/.docs/reference/ai-sdk/to-ai-sdk-v4-messages.md +1 -1
- package/.docs/reference/ai-sdk/to-ai-sdk-v5-messages.md +1 -1
- package/.docs/reference/ai-sdk/workflow-route.md +1 -1
- package/.docs/reference/ai-sdk/workflow-snapshot-to-stream.md +2 -2
- package/.docs/reference/auth/auth0.md +1 -1
- package/.docs/reference/auth/fga.md +2 -2
- package/.docs/reference/auth/google.md +2 -2
- package/.docs/reference/auth/okta.md +1 -1
- package/.docs/reference/auth/workos.md +2 -2
- package/.docs/reference/browser/agent-browser.md +2 -2
- package/.docs/reference/browser/browser-viewer.md +3 -3
- package/.docs/reference/browser/mastra-browser.md +3 -3
- package/.docs/reference/browser/stagehand-browser.md +4 -4
- package/.docs/reference/channels/slack-provider.md +2 -2
- package/.docs/reference/cli/create-mastra.md +1 -1
- package/.docs/reference/cli/mastra.md +23 -23
- package/.docs/reference/client-js/agents.md +9 -9
- package/.docs/reference/client-js/memory.md +2 -2
- package/.docs/reference/client-js/workflows.md +1 -1
- package/.docs/reference/coding-agent/build-base-prompt.md +2 -2
- package/.docs/reference/coding-agent/create-coding-agent.md +2 -2
- package/.docs/reference/configuration.md +6 -6
- package/.docs/reference/core/getMCPServer.md +1 -1
- package/.docs/reference/core/getScorer.md +1 -1
- package/.docs/reference/datasets/addItem.md +1 -1
- package/.docs/reference/datasets/listItems.md +1 -1
- package/.docs/reference/deployer/netlify.md +4 -4
- package/.docs/reference/deployer/vercel.md +7 -7
- package/.docs/reference/editor/agent-builder/agent-builder-options.md +4 -4
- package/.docs/reference/editor/agent-builder/builder-agent-defaults.md +6 -6
- package/.docs/reference/editor/agent-builder/builder-models.md +3 -3
- package/.docs/reference/editor/blob-store-provider.md +1 -1
- package/.docs/reference/editor/browser-provider.md +3 -3
- package/.docs/reference/editor/filesystem-provider.md +4 -4
- package/.docs/reference/editor/mastra-editor.md +5 -5
- package/.docs/reference/editor/processor-provider.md +3 -3
- package/.docs/reference/editor/sandbox-provider.md +4 -4
- package/.docs/reference/editor/storage-browser-ref.md +6 -6
- package/.docs/reference/editor/storage-workspace-ref.md +4 -4
- package/.docs/reference/editor/tool-provider.md +1 -1
- package/.docs/reference/evals/answer-relevancy.md +4 -4
- package/.docs/reference/evals/bias.md +3 -3
- package/.docs/reference/evals/checks.md +3 -3
- package/.docs/reference/evals/completeness.md +5 -5
- package/.docs/reference/evals/content-similarity.md +5 -5
- package/.docs/reference/evals/context-precision.md +2 -2
- package/.docs/reference/evals/context-recall.md +8 -8
- package/.docs/reference/evals/context-relevance.md +4 -4
- package/.docs/reference/evals/create-scorer.md +1 -1
- package/.docs/reference/evals/faithfulness.md +3 -3
- package/.docs/reference/evals/filter-run.md +2 -2
- package/.docs/reference/evals/hallucination.md +6 -6
- package/.docs/reference/evals/keyword-coverage.md +6 -6
- package/.docs/reference/evals/mastra-scorer.md +9 -3
- package/.docs/reference/evals/noise-sensitivity.md +5 -5
- package/.docs/reference/evals/prompt-alignment.md +5 -5
- package/.docs/reference/evals/rubric.md +1 -1
- package/.docs/reference/evals/run-evals.md +3 -3
- package/.docs/reference/evals/scorer-utils.md +4 -4
- package/.docs/reference/evals/textual-difference.md +4 -4
- package/.docs/reference/evals/tool-call-accuracy.md +1 -1
- package/.docs/reference/evals/toxicity.md +4 -4
- package/.docs/reference/evals/trajectory-accuracy.md +10 -10
- package/.docs/reference/file-based-agents/instructions.md +2 -2
- package/.docs/reference/file-based-agents/logger.md +1 -1
- package/.docs/reference/file-based-agents/observability.md +1 -1
- package/.docs/reference/file-based-agents/processors.md +1 -1
- package/.docs/reference/file-based-agents/skills.md +1 -1
- package/.docs/reference/file-based-agents/storage.md +1 -1
- package/.docs/reference/file-based-agents/studio.md +1 -1
- package/.docs/reference/file-based-agents/subagents.md +1 -1
- package/.docs/reference/file-based-agents/tools.md +1 -1
- package/.docs/reference/file-based-agents/workspace.md +1 -1
- package/.docs/reference/logging/pino-logger.md +3 -3
- package/.docs/reference/memory/clone-utilities.md +1 -1
- package/.docs/reference/memory/cloneThread.md +3 -3
- package/.docs/reference/memory/listThreads.md +1 -1
- package/.docs/reference/memory/memory-class.md +1 -1
- package/.docs/reference/memory/observational-memory.md +11 -11
- package/.docs/reference/memory/recall.md +2 -2
- package/.docs/reference/memory/serialized-memory-config.md +4 -4
- package/.docs/reference/memory/summarizeConversation.md +3 -3
- package/.docs/reference/memory/summarizeThread.md +3 -3
- package/.docs/reference/observability/feedback.md +1 -1
- package/.docs/reference/observability/metrics/automatic-metrics.md +7 -7
- package/.docs/reference/observability/tracing/bridges/datadog.md +2 -2
- package/.docs/reference/observability/tracing/exporters/cloud-exporter.md +3 -3
- package/.docs/reference/observability/tracing/exporters/default-exporter.md +1 -1
- package/.docs/reference/observability/tracing/exporters/mastra-platform-exporter.md +4 -4
- package/.docs/reference/observability/tracing/exporters/mastra-storage-exporter.md +1 -1
- package/.docs/reference/observability/tracing/interfaces.md +1 -1
- package/.docs/reference/observability/tracing/processors/sensitive-data-filter.md +1 -1
- package/.docs/reference/observability/tracing/span-filtering.md +1 -1
- package/.docs/reference/processors/cost-guard-processor.md +1 -1
- package/.docs/reference/processors/pii-detector.md +1 -1
- package/.docs/reference/processors/processor-interface.md +12 -12
- package/.docs/reference/processors/prompt-injection-detector.md +1 -1
- package/.docs/reference/processors/provider-history-compat.md +1 -1
- package/.docs/reference/processors/regex-filter-processor.md +1 -1
- package/.docs/reference/processors/response-cache.md +8 -8
- package/.docs/reference/processors/system-prompt-scrubber.md +1 -1
- package/.docs/reference/processors/token-limiter-processor.md +1 -1
- package/.docs/reference/processors/tool-search-processor.md +7 -7
- package/.docs/reference/processors/unicode-normalizer.md +1 -1
- package/.docs/reference/project-structure.md +1 -1
- package/.docs/reference/pubsub/base.md +4 -4
- package/.docs/reference/pubsub/google-cloud-pubsub.md +2 -2
- package/.docs/reference/pubsub/lease-provider.md +4 -4
- package/.docs/reference/pubsub/redis-streams.md +1 -1
- package/.docs/reference/pubsub/unix-socket-pubsub.md +1 -1
- package/.docs/reference/rag/chunk.md +5 -5
- package/.docs/reference/rag/database-config.md +2 -2
- package/.docs/reference/rag/metadata-filters.md +2 -2
- package/.docs/reference/schedules/overview.md +1 -1
- package/.docs/reference/server/register-api-route.md +1 -1
- package/.docs/reference/server/routes.md +1 -1
- package/.docs/reference/signals/signal-provider.md +8 -8
- package/.docs/reference/storage/clickhouse.md +4 -4
- package/.docs/reference/storage/cloudflare-d1.md +4 -4
- package/.docs/reference/storage/convex.md +4 -4
- package/.docs/reference/storage/dsql.md +2 -2
- package/.docs/reference/storage/dynamodb.md +7 -7
- package/.docs/reference/storage/lance.md +1 -1
- package/.docs/reference/storage/mongodb.md +1 -1
- package/.docs/reference/storage/mssql.md +1 -1
- package/.docs/reference/storage/postgresql.md +1 -1
- package/.docs/reference/storage/retention.md +33 -33
- package/.docs/reference/storage/spanner.md +8 -8
- package/.docs/reference/streaming/ChunkType.md +2 -2
- package/.docs/reference/streaming/agents/MastraModelOutput.md +1 -1
- package/.docs/reference/streaming/agents/stream.md +1 -1
- package/.docs/reference/streaming/agents/streamUntilIdle.md +2 -2
- package/.docs/reference/streaming/workflows/observeStream.md +1 -1
- package/.docs/reference/streaming/workflows/resumeStream.md +1 -1
- package/.docs/reference/streaming/workflows/stream.md +1 -1
- package/.docs/reference/streaming/workflows/timeTravelStream.md +2 -2
- package/.docs/reference/templates/overview.md +1 -1
- package/.docs/reference/tools/brightdata.md +1 -1
- package/.docs/reference/tools/create-tool.md +1 -1
- package/.docs/reference/tools/graph-rag-tool.md +1 -1
- package/.docs/reference/tools/mcp-client.md +13 -13
- package/.docs/reference/tools/mcp-server.md +20 -20
- package/.docs/reference/tools/submit-plan-tool.md +1 -1
- package/.docs/reference/tools/tavily.md +1 -1
- package/.docs/reference/tools/vector-query-tool.md +4 -4
- package/.docs/reference/vectors/astra.md +1 -1
- package/.docs/reference/vectors/chroma.md +2 -2
- package/.docs/reference/vectors/convex.md +2 -2
- package/.docs/reference/vectors/couchbase.md +4 -4
- package/.docs/reference/vectors/libsql.md +1 -1
- package/.docs/reference/vectors/mongodb.md +1 -1
- package/.docs/reference/vectors/pg.md +4 -4
- package/.docs/reference/vectors/qdrant.md +2 -2
- package/.docs/reference/vectors/s3vectors.md +4 -4
- package/.docs/reference/vectors/turbopuffer.md +1 -1
- package/.docs/reference/voice/aws-nova-sonic.md +1 -1
- package/.docs/reference/voice/azure.md +1 -1
- package/.docs/reference/voice/google-gemini-live.md +4 -4
- package/.docs/reference/voice/inworld-realtime.md +7 -7
- package/.docs/reference/voice/livekit.md +13 -13
- package/.docs/reference/voice/mistral.md +1 -1
- package/.docs/reference/voice/openai-realtime.md +1 -1
- package/.docs/reference/voice/sarvam.md +1 -1
- package/.docs/reference/voice/voice.addTools.md +1 -1
- package/.docs/reference/voice/voice.events.md +1 -1
- package/.docs/reference/voice/voice.getSpeakers.md +2 -2
- package/.docs/reference/voice/voice.on.md +2 -2
- package/.docs/reference/voice/xai-realtime.md +2 -2
- package/.docs/reference/workflows/run-methods/cancel.md +1 -1
- package/.docs/reference/workflows/run-methods/startAsync.md +1 -1
- package/.docs/reference/workflows/run-methods/timeTravel.md +1 -1
- package/.docs/reference/workflows/workflow-methods/foreach.md +1 -1
- package/.docs/reference/workflows/workflow-methods/sleep.md +1 -1
- package/.docs/reference/workflows/workflow-state-reader.md +2 -2
- package/.docs/reference/workspace/apple-container-sandbox.md +2 -2
- package/.docs/reference/workspace/daytona-sandbox.md +3 -3
- package/.docs/reference/workspace/docker-sandbox.md +2 -2
- package/.docs/reference/workspace/e2b-sandbox.md +2 -2
- package/.docs/reference/workspace/files-sdk-filesystem.md +3 -3
- package/.docs/reference/workspace/google-drive-filesystem.md +4 -4
- package/.docs/reference/workspace/local-filesystem.md +2 -2
- package/.docs/reference/workspace/local-sandbox.md +2 -2
- package/.docs/reference/workspace/modal-sandbox.md +1 -1
- package/.docs/reference/workspace/platform-filesystem.md +3 -3
- package/.docs/reference/workspace/platform-sandbox.md +2 -2
- package/.docs/reference/workspace/process-manager.md +1 -1
- package/.docs/reference/workspace/railway-sandbox.md +4 -4
- package/.docs/reference/workspace/s3-filesystem.md +1 -1
- package/.docs/reference/workspace/sandbox.md +1 -1
- package/.docs/reference/workspace/vercel-sandbox.md +1 -1
- package/.docs/reference/workspace/workspace-class.md +10 -10
- package/CHANGELOG.md +14 -0
- package/package.json +6 -6
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
A built-in, agent-agnostic tool that submits an implementation plan for user review. The agent writes a plan to a markdown file and passes the file path to this tool. The tool suspends the run until the user approves or rejects the plan.
|
|
6
6
|
|
|
7
|
-
The tool pauses through the native [tool suspension](https://mastra.ai/docs/agents/agent-approval) primitive: it calls `suspend({ path })`, which makes the agent emit a `tool-call-suspended` event. The host reads the plan file
|
|
7
|
+
The tool pauses through the native [tool suspension](https://mastra.ai/docs/agents/agent-approval) primitive: it calls `suspend({ path })`, which makes the agent emit a `tool-call-suspended` event. The host reads the plan file and presents it to the user. It then resumes with an approval or rejection.
|
|
8
8
|
|
|
9
9
|
When executed outside an agent run (no `suspend` available), the tool returns a readable fallback string containing the file path.
|
|
10
10
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Tavily tools
|
|
4
4
|
|
|
5
|
-
The `@mastra/tavily` package wraps the [Tavily](https://app.tavily.com) API as Mastra-compatible tools. It exposes factory functions for search, extract, crawl, and map
|
|
5
|
+
The `@mastra/tavily` package wraps the [Tavily](https://app.tavily.com) API as Mastra-compatible tools. It exposes factory functions for search, extract, crawl, and map. Each function returns a tool created with [`createTool()`](https://mastra.ai/reference/tools/create-tool) that includes full Zod input/output schemas.
|
|
6
6
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# createVectorQueryTool()
|
|
4
4
|
|
|
5
|
-
The `createVectorQueryTool()` function creates a tool for semantic search over vector stores. It supports filtering, reranking, database-specific configurations, and integrates with
|
|
5
|
+
The `createVectorQueryTool()` function creates a tool for semantic search over vector stores. It supports filtering, reranking, database-specific configurations, and integrates with vector store backends.
|
|
6
6
|
|
|
7
7
|
## Basic usage
|
|
8
8
|
|
|
@@ -69,7 +69,7 @@ const queryTool = createVectorQueryTool({
|
|
|
69
69
|
|
|
70
70
|
**databaseConfig.chroma.whereDocument** (`Record<string, any>`): Document content filtering conditions
|
|
71
71
|
|
|
72
|
-
**providerOptions** (`Record<string, Record<string, any>>`): Provider-specific options for the embedding model (e.g., outputDimensionality).
|
|
72
|
+
**providerOptions** (`Record<string, Record<string, any>>`): Provider-specific options for the embedding model (e.g., outputDimensionality). Only works with AI SDK EmbeddingModelV2 models. For V1 models, configure options when creating the model itself.
|
|
73
73
|
|
|
74
74
|
**vectorStore** (`MastraVector | VectorStoreResolver`): Direct vector store instance or a resolver function for dynamic selection. Use a function for multi-tenant applications where the vector store is selected based on request context. When provided, vectorStoreName becomes optional.
|
|
75
75
|
|
|
@@ -182,7 +182,7 @@ This example shows how to customize the tool description for a specific use case
|
|
|
182
182
|
|
|
183
183
|
## Database-specific configuration examples
|
|
184
184
|
|
|
185
|
-
The `databaseConfig` parameter allows you to
|
|
185
|
+
The `databaseConfig` parameter allows you to use features and optimizations specific to each vector database. These configurations are automatically applied during query execution.
|
|
186
186
|
|
|
187
187
|
**Pinecone**:
|
|
188
188
|
|
|
@@ -475,7 +475,7 @@ const result = await vectorQueryTool.execute(
|
|
|
475
475
|
)
|
|
476
476
|
```
|
|
477
477
|
|
|
478
|
-
This pattern is similar to how `Agent.memory` supports
|
|
478
|
+
This pattern is similar to how `Agent.memory` supports runtime-defined configuration and enables:
|
|
479
479
|
|
|
480
480
|
- **Schema isolation**: Each tenant's data in separate PostgreSQL schemas
|
|
481
481
|
- **Database isolation**: Route to different database instances per tenant
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Astra vector store
|
|
4
4
|
|
|
5
|
-
The AstraVector class provides vector search using [DataStax Astra DB](https://www.datastax.com/products/datastax-astra), a cloud-native, serverless database built on Apache Cassandra. It provides vector search capabilities with enterprise-grade
|
|
5
|
+
The AstraVector class provides vector search using [DataStax Astra DB](https://www.datastax.com/products/datastax-astra), a cloud-native, serverless database built on Apache Cassandra. It provides vector search capabilities with enterprise-grade capacity and high availability.
|
|
6
6
|
|
|
7
7
|
## Constructor options
|
|
8
8
|
|
|
@@ -8,7 +8,7 @@ The ChromaVector class provides vector search using [Chroma](https://docs.trychr
|
|
|
8
8
|
>
|
|
9
9
|
> **Chroma Cloud**
|
|
10
10
|
>
|
|
11
|
-
> Chroma Cloud powers serverless vector and full-text search. It's extremely fast, cost-effective,
|
|
11
|
+
> Chroma Cloud powers serverless vector and full-text search. It's extremely fast, cost-effective, high-capacity, and painless. Create a DB and try it out in under 30 seconds with $5 of free credits.
|
|
12
12
|
>
|
|
13
13
|
> [Get started with Chroma Cloud](https://trychroma.com/signup)
|
|
14
14
|
|
|
@@ -197,7 +197,7 @@ await vectorStore.updateVector({
|
|
|
197
197
|
|
|
198
198
|
### `deleteVectors()`
|
|
199
199
|
|
|
200
|
-
Delete multiple vectors by IDs or by metadata filter.
|
|
200
|
+
Delete multiple vectors by IDs or by metadata filter. The method supports bulk deletion and source-based vector management. Either `ids` or `filter` must be provided, but not both.
|
|
201
201
|
|
|
202
202
|
**indexName** (`string`): Name of the index containing the vectors to delete
|
|
203
203
|
|
|
@@ -351,7 +351,7 @@ interface QueryResult {
|
|
|
351
351
|
|
|
352
352
|
## Metadata filtering
|
|
353
353
|
|
|
354
|
-
`ConvexVector` supports metadata filtering with
|
|
354
|
+
`ConvexVector` supports metadata filtering with operators. These filters are applied by the adapter after vectors are loaded from Convex.
|
|
355
355
|
|
|
356
356
|
```typescript
|
|
357
357
|
// Simple equality
|
|
@@ -415,7 +415,7 @@ Vector similarity search is performed with cosine similarity in the Mastra adapt
|
|
|
415
415
|
- Filters must target fields listed in the Convex vector index `filterFields`.
|
|
416
416
|
- Use one dedicated table per Mastra vector index to avoid cross-index results.
|
|
417
417
|
|
|
418
|
-
Use an external vector database when you need
|
|
418
|
+
Use an external vector database when you need runtime-defined index creation at runtime, metadata-only queries, complex filter operators, filter-based bulk updates or deletes, or result limits above Convex's native vector search cap.
|
|
419
419
|
|
|
420
420
|
## Related
|
|
421
421
|
|
|
@@ -75,7 +75,7 @@ const store = new CouchbaseVector({
|
|
|
75
75
|
|
|
76
76
|
Creates a new vector index in Couchbase.
|
|
77
77
|
|
|
78
|
-
> **Note:** Index creation is asynchronous. After calling `createIndex`, allow time (typically 1
|
|
78
|
+
> **Note:** Index creation is asynchronous. After calling `createIndex`, allow time (typically 1 to 5 seconds for small datasets, longer for large ones) before querying. For production, implement polling to check index status rather than using fixed delays.
|
|
79
79
|
|
|
80
80
|
**indexName** (`string`): Name of the index to create
|
|
81
81
|
|
|
@@ -145,7 +145,7 @@ Returns: `Promise<string[]>`
|
|
|
145
145
|
|
|
146
146
|
### `updateVector()`
|
|
147
147
|
|
|
148
|
-
Updates a specific vector entry by its ID with new vector data and/or metadata.
|
|
148
|
+
Updates a specific vector entry by its ID with new vector data and/or metadata. Filter-based updates aren't yet implemented for Couchbase.
|
|
149
149
|
|
|
150
150
|
**indexName** (`string`): Name of the index containing the vector
|
|
151
151
|
|
|
@@ -163,7 +163,7 @@ Deletes a single vector by its ID from the index.
|
|
|
163
163
|
|
|
164
164
|
### `deleteVectors()`
|
|
165
165
|
|
|
166
|
-
Deletes multiple vectors by their IDs.
|
|
166
|
+
Deletes multiple vectors by their IDs. Filter-based deletion isn't yet implemented for Couchbase.
|
|
167
167
|
|
|
168
168
|
**indexName** (`string`): Name of the index containing the vectors to delete
|
|
169
169
|
|
|
@@ -221,7 +221,7 @@ try {
|
|
|
221
221
|
|
|
222
222
|
- Index creation delays may impact immediate querying after creation.
|
|
223
223
|
- No hard enforcement of vector dimension at ingest time (dimension mismatches will error at query time).
|
|
224
|
-
- Vector insertion and index updates are eventually consistent
|
|
224
|
+
- Vector insertion and index updates are eventually consistent. Strong consistency isn't guaranteed immediately after writes.
|
|
225
225
|
|
|
226
226
|
## Related
|
|
227
227
|
|
|
@@ -85,7 +85,7 @@ const results = await store.query({
|
|
|
85
85
|
|
|
86
86
|
### `createIndex()`
|
|
87
87
|
|
|
88
|
-
Creates a new vector collection. The index name must start with a letter or underscore and can only contain letters, numbers, and
|
|
88
|
+
Creates a new vector collection. The index name must start with a letter or underscore and can only contain letters, numbers, and underscore characters. The dimension must be a positive integer.
|
|
89
89
|
|
|
90
90
|
**indexName** (`string`): Name of the index to create
|
|
91
91
|
|
|
@@ -559,7 +559,7 @@ export const mongodbVoyageAgent = new Agent({
|
|
|
559
559
|
})
|
|
560
560
|
```
|
|
561
561
|
|
|
562
|
-
For
|
|
562
|
+
For detailed VoyageAI embedding examples including specialized models, multimodal embeddings, and retrieval optimization, see the [VoyageAI embeddings documentation](https://mastra.ai/models/embeddings).
|
|
563
563
|
|
|
564
564
|
## Related
|
|
565
565
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# PG vector store
|
|
4
4
|
|
|
5
|
-
The PgVector class provides vector search using [PostgreSQL](https://www.postgresql.org/) with [pgvector](https://github.com/pgvector/pgvector) extension. It provides
|
|
5
|
+
The PgVector class provides vector search using [PostgreSQL](https://www.postgresql.org/) with [pgvector](https://github.com/pgvector/pgvector) extension. It provides reliable vector similarity search capabilities within your existing PostgreSQL database.
|
|
6
6
|
|
|
7
7
|
## Constructor options
|
|
8
8
|
|
|
@@ -110,13 +110,13 @@ const vectorStore = new PgVector({
|
|
|
110
110
|
|
|
111
111
|
#### Memory Requirements
|
|
112
112
|
|
|
113
|
-
HNSW indexes require
|
|
113
|
+
HNSW indexes require substantial shared memory during construction. For 100K vectors:
|
|
114
114
|
|
|
115
115
|
- Small dimensions (64d): \~60MB with default settings
|
|
116
116
|
- Medium dimensions (256d): \~180MB with default settings
|
|
117
117
|
- Large dimensions (384d+): \~250MB+ with default settings
|
|
118
118
|
|
|
119
|
-
Higher M values or efConstruction values will increase memory requirements
|
|
119
|
+
Higher M values or efConstruction values will increase memory requirements substantially. Adjust your system's shared memory limits if needed.
|
|
120
120
|
|
|
121
121
|
### `upsert()`
|
|
122
122
|
|
|
@@ -340,7 +340,7 @@ The system automatically detects configuration changes and only rebuilds indexes
|
|
|
340
340
|
- Regularly evaluate your index configuration to ensure optimal performance.
|
|
341
341
|
- Adjust parameters like `lists` and `m` based on dataset size and query requirements.
|
|
342
342
|
- **Monitor index performance** using `describeIndex()` to track usage
|
|
343
|
-
- Rebuild indexes periodically to maintain efficiency, especially after
|
|
343
|
+
- Rebuild indexes periodically to maintain efficiency, especially after substantial data changes
|
|
344
344
|
|
|
345
345
|
## Direct pool access
|
|
346
346
|
|
|
@@ -86,7 +86,7 @@ await store.upsert({
|
|
|
86
86
|
|
|
87
87
|
#### Named Vectors
|
|
88
88
|
|
|
89
|
-
Qdrant supports [
|
|
89
|
+
Qdrant supports [multiple vectors per collection](https://qdrant.tech/documentation/concepts/vectors/#named-vectors), with a name assigned to each vector field. Use the `using` parameter to select the vector field to query:
|
|
90
90
|
|
|
91
91
|
```typescript
|
|
92
92
|
const results = await store.query({
|
|
@@ -131,7 +131,7 @@ Update a single vector by ID or by metadata filter. Either `id` or `filter` must
|
|
|
131
131
|
|
|
132
132
|
**update** (`{ vector?: number[]; metadata?: Record<string, any>; }`): Object containing the vector and/or metadata to update
|
|
133
133
|
|
|
134
|
-
Updates a vector and/or its metadata in the specified index. If both vector and metadata are provided, both will be updated.
|
|
134
|
+
Updates a vector and/or its metadata in the specified index. If both vector and metadata are provided, both will be updated. Providing either value updates that value alone.
|
|
135
135
|
|
|
136
136
|
### `deleteVector()`
|
|
137
137
|
|
|
@@ -205,8 +205,8 @@ S3 Vectors supports a strict subset of operators and value types. The Mastra fil
|
|
|
205
205
|
|
|
206
206
|
- **Canonicalizes implicit AND**: `{a:1,b:2}` → `{ $and: [{a:1},{b:2}] }`.
|
|
207
207
|
- **Normalizes Date values** to epoch ms for numeric comparisons and array elements.
|
|
208
|
-
- **Disallows Date** in equality positions (`field: value` or `$eq/$ne`)
|
|
209
|
-
- **Rejects** null/undefined for equality
|
|
208
|
+
- **Disallows Date** in equality positions (`field: value` or `$eq/$ne`). Equality values must be **string | number | boolean**.
|
|
209
|
+
- **Rejects** null/undefined for equality. **array equality** isn't supported (use `$in`/`$nin`).
|
|
210
210
|
- Only **`$and` / `$or`** are allowed as top-level logical operators.
|
|
211
211
|
- Logical operators must contain **field conditions** (not direct operators).
|
|
212
212
|
|
|
@@ -268,10 +268,10 @@ Typical environment variables when wiring your app:
|
|
|
268
268
|
|
|
269
269
|
## Best practices
|
|
270
270
|
|
|
271
|
-
- Choose the metric (`cosine` or `euclidean`) to match your embedding model
|
|
271
|
+
- Choose the metric (`cosine` or `euclidean`) to match your embedding model. `dotproduct` isn't supported.
|
|
272
272
|
- Keep **filterable** metadata small and structured (string/number/boolean). Store large text (e.g., `content`) as **non-filterable**.
|
|
273
273
|
- Use **dotted paths** for nested metadata and explicit `$and`/`$or` for complex logic.
|
|
274
|
-
- Avoid calling `describeIndex()` on hot paths
|
|
274
|
+
- Avoid calling `describeIndex()` on hot paths. `count` is computed with paginated `ListVectors` (**O(n)**).
|
|
275
275
|
- Use `includeVector: true` only when you need raw vectors.
|
|
276
276
|
|
|
277
277
|
## Related
|
|
@@ -20,7 +20,7 @@ The TurbopufferVector class provides vector search using [Turbopuffer](https://t
|
|
|
20
20
|
|
|
21
21
|
**consistency** (`'strong' | 'eventual'`): The default consistency level for queries. Can be overridden per query. "strong" guarantees queries see all data written before the query started, at the cost of higher latency. "eventual" offers lower latency, but recently written data may not be visible yet. (Default: `strong`)
|
|
22
22
|
|
|
23
|
-
**schemaConfigForIndex** (`function`): A callback function that takes an index name and returns a config object for that index.
|
|
23
|
+
**schemaConfigForIndex** (`function`): A callback function that takes an index name and returns a config object for that index. You can define explicit schemas per index.
|
|
24
24
|
|
|
25
25
|
## Methods
|
|
26
26
|
|
|
@@ -218,7 +218,7 @@ Registers and removes event listeners. See [Voice events](https://mastra.ai/refe
|
|
|
218
218
|
|
|
219
219
|
## Available voices
|
|
220
220
|
|
|
221
|
-
Nova 2 Sonic
|
|
221
|
+
Nova 2 Sonic provides voices in ten locales. Tiffany and Matthew are polyglot and can speak any supported language.
|
|
222
222
|
|
|
223
223
|
| Voice ID | Name | Language | Locale | Gender | Polyglot |
|
|
224
224
|
| ---------- | -------- | ---------- | ------ | --------- | -------- |
|
|
@@ -83,7 +83,7 @@ Transcribes audio using Azure's speech-to-text service.
|
|
|
83
83
|
|
|
84
84
|
Returns: `Promise<string>` - The recognized text from the audio
|
|
85
85
|
|
|
86
|
-
|
|
86
|
+
Language and recognition settings are configured in the `listeningModel` configuration during initialization, not passed as options to this method.
|
|
87
87
|
|
|
88
88
|
### `getSpeakers()`
|
|
89
89
|
|
|
@@ -190,7 +190,7 @@ Returns: `Promise<void>`
|
|
|
190
190
|
|
|
191
191
|
### `updateSessionConfig()`
|
|
192
192
|
|
|
193
|
-
Updates the session configuration
|
|
193
|
+
Updates the session configuration at runtime. This can modify voice settings and speaker selection. It can also modify other runtime configurations.
|
|
194
194
|
|
|
195
195
|
**config** (`Partial<GeminiLiveVoiceConfig>`): Configuration updates to apply.
|
|
196
196
|
|
|
@@ -284,14 +284,14 @@ The GeminiLiveVoice class emits the following events:
|
|
|
284
284
|
|
|
285
285
|
## Native-audio behavior
|
|
286
286
|
|
|
287
|
-
Native-audio Gemini Live models
|
|
287
|
+
Native-audio Gemini Live models (any model whose ID contains `native-audio`, such as `gemini-2.5-flash-native-audio-preview-12-2025`) split text output across two channels:
|
|
288
288
|
|
|
289
289
|
- The model's spoken reply is delivered as audio plus an `output_audio_transcription` transcript and surfaced as `writing` with `role: 'assistant'`.
|
|
290
290
|
- The model's internal reasoning is delivered as `modelTurn.parts.text` and surfaced as `thinking`.
|
|
291
291
|
|
|
292
|
-
On non-native-audio models there is no `output_audio_transcription` channel, so `modelTurn.parts.text` is the spoken response itself and is emitted as `writing
|
|
292
|
+
On non-native-audio models there is no `output_audio_transcription` channel, so `modelTurn.parts.text` is the spoken response itself and is emitted as `writing`. The `thinking` event doesn't fire.
|
|
293
293
|
|
|
294
|
-
Input transcription, output transcription, and barge-in detection (`realtime_input_config.activity_handling = 'START_OF_ACTIVITY_INTERRUPTS'`) are enabled automatically in the setup payload
|
|
294
|
+
Input transcription, output transcription, and barge-in detection (`realtime_input_config.activity_handling = 'START_OF_ACTIVITY_INTERRUPTS'`) are enabled automatically in the setup payload. You don't need extra configuration.
|
|
295
295
|
|
|
296
296
|
## Available models
|
|
297
297
|
|
|
@@ -56,7 +56,7 @@ await voice.send(microphoneStream)
|
|
|
56
56
|
voice.close()
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
-
> Inworld API keys
|
|
59
|
+
> Inworld API keys are pre-Basic-encoded. Paste them verbatim into `INWORLD_API_KEY`. The package doesn't re-encode them.
|
|
60
60
|
|
|
61
61
|
## Constructor parameters
|
|
62
62
|
|
|
@@ -118,7 +118,7 @@ Use the typed `session` field for documented Inworld realtime options. Fields co
|
|
|
118
118
|
|
|
119
119
|
### `providerData` (Inworld extensions)
|
|
120
120
|
|
|
121
|
-
`providerData` is a typed object for Inworld-specific realtime extensions. It's sent under `session.providerData` on every `session.update`, and composes with any `session.providerData` you set via the `session` field
|
|
121
|
+
`providerData` is a typed object for Inworld-specific realtime extensions. It's sent under `session.providerData` on every `session.update`, and composes with any `session.providerData` you set via the `session` field: the constructor `providerData` wins on key collisions.
|
|
122
122
|
|
|
123
123
|
It has five branches plus two session-level fields:
|
|
124
124
|
|
|
@@ -147,7 +147,7 @@ const voice = new InworldRealtimeVoice({
|
|
|
147
147
|
|
|
148
148
|
Opens the WebSocket connection, sends the initial `session.update`, and resolves once the server acknowledges with `session.updated`. Must be called before `speak()`, `listen()`, or `send()`.
|
|
149
149
|
|
|
150
|
-
A pre-open `error` or `close` on the WebSocket
|
|
150
|
+
A pre-open `error` or `close` on the WebSocket (or a handshake that exceeds `connectTimeoutMs` (15s default)) surfaces as a rejected promise instead of an uncaught socket error. On reject, the half-open socket is closed.
|
|
151
151
|
|
|
152
152
|
```typescript
|
|
153
153
|
await voice.connect()
|
|
@@ -243,7 +243,7 @@ Returns: `void`
|
|
|
243
243
|
|
|
244
244
|
#### `clearOutput()`
|
|
245
245
|
|
|
246
|
-
Clears the server's entire output audio buffer, stopping playback. This also stops any in-flight back-channel audio. The default barge-in path (`response.cancel` on `interrupted`) is back-channel-safe
|
|
246
|
+
Clears the server's entire output audio buffer, stopping playback. This also stops any in-flight back-channel audio. The default barge-in path (`response.cancel` on `interrupted`) is back-channel-safe. Prefer it. Use `clearOutput()` only when you want to flush everything.
|
|
247
247
|
|
|
248
248
|
```typescript
|
|
249
249
|
voice.clearOutput()
|
|
@@ -327,7 +327,7 @@ The `InworldRealtimeVoice` class emits the following events:
|
|
|
327
327
|
|
|
328
328
|
## Voices
|
|
329
329
|
|
|
330
|
-
The package
|
|
330
|
+
The package includes a curated set of voice IDs returned from `getSpeakers()`:
|
|
331
331
|
|
|
332
332
|
- `Dennis`
|
|
333
333
|
- `Hades`
|
|
@@ -344,7 +344,7 @@ Any voice ID from [Inworld's voice catalog](https://docs.inworld.ai/quickstart-t
|
|
|
344
344
|
|
|
345
345
|
## Notes
|
|
346
346
|
|
|
347
|
-
- API keys can be provided via constructor options or the `INWORLD_API_KEY` environment variable. Keys are pre-Basic-encoded
|
|
347
|
+
- API keys can be provided via constructor options or the `INWORLD_API_KEY` environment variable. Keys are pre-Basic-encoded. Don't re-encode them.
|
|
348
348
|
- The WebSocket URL appends `?key=<sessionId>&protocol=realtime`. The model is configured via the initial `session.update`, not the URL.
|
|
349
349
|
- Per-call `speak(input, { speaker })` scopes the voice override to a single response (via the flat `response.voice` field) and doesn't mutate the session.
|
|
350
350
|
- Audio output defaults to PCM16 at 24 kHz. Telephony `audio/pcmu` and `audio/pcma` at 8 kHz, and `audio/float32`, are also supported via `session.audio.output.format`.
|
|
@@ -352,4 +352,4 @@ Any voice ID from [Inworld's voice catalog](https://docs.inworld.ai/quickstart-t
|
|
|
352
352
|
- The voice instance must be closed with `close()` or `disconnect()` to release the WebSocket.
|
|
353
353
|
- `audio.input.turn_detection` defaults to semantic VAD when `session` doesn't supply it. Override with your own object, or pass `null` to disable turn detection entirely.
|
|
354
354
|
- `audio.input.transcription` defaults to `{ model: 'inworld/inworld-stt-1' }`, so user-side `writing` events fire out of the box. Override with your own object, or pass `null` to disable user-side transcription.
|
|
355
|
-
- `on()` and `off()` are typed against `InworldVoiceEventMap
|
|
355
|
+
- `on()` and `off()` are typed against `InworldVoiceEventMap`. Known event names yield a typed callback payload. Unknown names fall back to `unknown`.
|
|
@@ -8,9 +8,9 @@ See [Realtime voice](https://mastra.ai/docs/voice/realtime-voice) for setup and
|
|
|
8
8
|
|
|
9
9
|
The package has three entry points:
|
|
10
10
|
|
|
11
|
-
- `@mastra/livekit`: server-side APIs
|
|
12
|
-
- `@mastra/livekit/worker`: the worker runtime
|
|
13
|
-
- `@mastra/livekit/plugin`: the LLM-component plugin
|
|
11
|
+
- `@mastra/livekit`: server-side APIs, [`liveKitConnectionRoute()`](#livekitconnectionroute), [`dispatchVoiceSession()`](#dispatchvoicesession), [`pipeAgentReplyToWriter()`](#pipeagentreplytowriter), [`serializeSessionMetadata()`](#livekitsessionmetadata), and [`createEndCallTool()`](#createendcalltool). Import these from Mastra server code. This entry never loads the LiveKit agents runtime.
|
|
12
|
+
- `@mastra/livekit/worker`: the worker runtime, [`createLiveKitWorker()`](#createlivekitworker), [`runLiveKitWorker()`](#runlivekitworker), [`chatContextToMessages()`](#chatcontexttomessages), and the session helpers [`speakGreeting()`](#speakgreeting), [`waitForAgentDoneSpeaking()`](#waitforagentdonespeaking), and [`runEndCall()`](#runendcall). Import it only from the worker entry file.
|
|
13
|
+
- `@mastra/livekit/plugin`: the LLM-component plugin, [`MastraLLM`](#mastrallm) and [`createRemoteAgentReplyGenerator()`](#createremoteagentreplygenerator). Import it in workers that build their own `voice.AgentSession`. `createRemoteAgentReplyGenerator()` is also exported from `@mastra/livekit/worker` because it plugs into `createLiveKitWorker()`'s `generate` option. `MastraLLM` is plugin-only.
|
|
14
14
|
|
|
15
15
|
## `createLiveKitWorker()`
|
|
16
16
|
|
|
@@ -148,7 +148,7 @@ Returns: `VoiceTurnMessage[]`, where each entry is `{ role: 'system' | 'user' |
|
|
|
148
148
|
|
|
149
149
|
## `MastraLLM`
|
|
150
150
|
|
|
151
|
-
A standard LiveKit LLM plugin (`llm.LLM`) backed by a Mastra agent. Use it when you build the `voice.AgentSession` yourself and want Mastra in the `llm` slot
|
|
151
|
+
A standard LiveKit LLM plugin (`llm.LLM`) backed by a Mastra agent. Use it when you build the `voice.AgentSession` yourself and want Mastra in the `llm` slot. [`createLiveKitWorker()`](#createlivekitworker) is the managed alternative. See [Use Mastra as the LLM component](https://mastra.ai/docs/voice/realtime-voice) for how to choose.
|
|
152
152
|
|
|
153
153
|
With `remote`, the plugin streams each turn from your Mastra server over HTTP using Server-Sent Events (SSE). The agent loop, tools, and memory run server-side, and interrupting the agent aborts the server-side generation.
|
|
154
154
|
|
|
@@ -194,13 +194,13 @@ Provide exactly one reply source: `remote`, `agent`, or `generate`.
|
|
|
194
194
|
|
|
195
195
|
### Tools run on the Mastra agent
|
|
196
196
|
|
|
197
|
-
Tools are defined and executed server-side on the Mastra agent. The plugin never forwards LiveKit tool definitions: if the session passes a non-empty `toolCtx`, it logs a one-time warning naming the ignored tools. Every tool must complete server-side
|
|
197
|
+
Tools are defined and executed server-side on the Mastra agent. The plugin never forwards LiveKit tool definitions: if the session passes a non-empty `toolCtx`, it logs a one-time warning naming the ignored tools. Every tool must complete server-side: a tool that requires approval or client-side execution fails the turn with a descriptive error instead of hanging the call.
|
|
198
198
|
|
|
199
199
|
Tool activity reaches the worker through `toolFeedback`, `onToolCall`, and `onTurnComplete`.
|
|
200
200
|
|
|
201
201
|
### Instructions
|
|
202
202
|
|
|
203
|
-
LiveKit injects your `voice.Agent`'s `instructions` into the chat context of every request. The plugin drops them
|
|
203
|
+
LiveKit injects your `voice.Agent`'s `instructions` into the chat context of every request. The plugin drops them because the server-side Mastra agent's own instructions are authoritative. To change the prompt, change the Mastra agent.
|
|
204
204
|
|
|
205
205
|
### Interrupted turns
|
|
206
206
|
|
|
@@ -243,7 +243,7 @@ When the server reports token usage for a turn, the plugin feeds it to LiveKit,
|
|
|
243
243
|
|
|
244
244
|
### Errors and timeouts
|
|
245
245
|
|
|
246
|
-
The transport throws LiveKit's `APIError` types (`APIStatusError`, `APIConnectionError`, `APITimeoutError`), so the session's retry policy (`connOptions.maxRetry`) and `FallbackAdapter` failover work unchanged. A turn is never retried after its first token
|
|
246
|
+
The transport throws LiveKit's `APIError` types (`APIStatusError`, `APIConnectionError`, `APITimeoutError`), so the session's retry policy (`connOptions.maxRetry`) and `FallbackAdapter` failover work unchanged. A turn is never retried after its first token: a voice reply is better failed fast than replayed half-heard.
|
|
247
247
|
|
|
248
248
|
A connect and first-token watchdog uses the session's `connOptions.timeoutMs` (10 seconds by default), so a server that accepts the connection but never streams can't cause indefinite dead air.
|
|
249
249
|
|
|
@@ -275,7 +275,7 @@ export default createLiveKitWorker({
|
|
|
275
275
|
|
|
276
276
|
On the `generate` path the worker-level `toolFeedback` and `onTurnComplete` options don't apply, and the worker's end-call detection doesn't fire; pass the hooks to the generator instead.
|
|
277
277
|
|
|
278
|
-
Cancelling a turn (barge-in) tears down the HTTP request, which aborts generation on the server. Errors are thrown as LiveKit `APIError` types
|
|
278
|
+
Cancelling a turn (barge-in) tears down the HTTP request, which aborts generation on the server. Errors are thrown as LiveKit `APIError` types. The `retries` option applies only to initial connection attempts. A turn is never retried after its first chunk.
|
|
279
279
|
|
|
280
280
|
Returns: `VoiceReplyGenerator`.
|
|
281
281
|
|
|
@@ -325,7 +325,7 @@ await speakGreeting(session, {
|
|
|
325
325
|
|
|
326
326
|
## `waitForAgentDoneSpeaking()`
|
|
327
327
|
|
|
328
|
-
Resolves once the agent is no longer producing or playing a reply
|
|
328
|
+
Resolves once the agent is no longer producing or playing a reply: its state has left `thinking` and `speaking`. Resolves immediately when the agent is already idle, and always resolves within `maxWaitMs` (30 seconds by default) as a safety cap. Use it before tearing a session down so closing words play out instead of being cut off.
|
|
329
329
|
|
|
330
330
|
```typescript
|
|
331
331
|
import { waitForAgentDoneSpeaking } from '@mastra/livekit/worker'
|
|
@@ -335,7 +335,7 @@ await waitForAgentDoneSpeaking(session)
|
|
|
335
335
|
|
|
336
336
|
## `runEndCall()`
|
|
337
337
|
|
|
338
|
-
Ends the call after the agent
|
|
338
|
+
Ends the call after the agent asks to hang up. It waits for the agent's closing words and speaks an optional final `message` without interruption. It then deletes the room and hangs up the caller, including SIP callers. The job shuts down with its registered callbacks.
|
|
339
339
|
|
|
340
340
|
Pair it with [`MastraLLM`](#mastrallm)'s `onToolCall` and an [end-call tool](#createendcalltool) on the server-side agent to rebuild agent-initiated hang-up on a session you own:
|
|
341
341
|
|
|
@@ -369,7 +369,7 @@ The exported constants `DEFAULT_END_CALL_TOOL` (`'endCall'`), `DEFAULT_END_CALL_
|
|
|
369
369
|
|
|
370
370
|
## `createEndCallTool()`
|
|
371
371
|
|
|
372
|
-
Builds the Mastra tool an agent calls to end the call
|
|
372
|
+
Builds the Mastra tool an agent calls when it wants to end the call. The tool signals intent and can run optional bookkeeping. The worker performs the actual hang-up. The tool lives on the server-safe root entry. Add it to agents defined in server code.
|
|
373
373
|
|
|
374
374
|
```typescript
|
|
375
375
|
import { Agent } from '@mastra/core/agent'
|
|
@@ -436,7 +436,7 @@ The route accepts a JSON body with optional `agentId`, `threadId`, and `resource
|
|
|
436
436
|
|
|
437
437
|
## `dispatchVoiceSession()`
|
|
438
438
|
|
|
439
|
-
Dispatches a Mastra voice agent into a LiveKit room programmatically
|
|
439
|
+
Dispatches a Mastra voice agent into a LiveKit room programmatically: for server-initiated sessions such as outbound calls.
|
|
440
440
|
|
|
441
441
|
```typescript
|
|
442
442
|
import { dispatchVoiceSession } from '@mastra/livekit'
|
|
@@ -474,7 +474,7 @@ The metadata passed from the Mastra server to the worker through LiveKit job dis
|
|
|
474
474
|
|
|
475
475
|
**requestContext** (`Record<string, unknown>`): Plain-object entries restored into a RequestContext for agent execution.
|
|
476
476
|
|
|
477
|
-
The metadata travels as a JSON string. `liveKitConnectionRoute()` and `dispatchVoiceSession()` serialize it for you; use `serializeSessionMetadata(metadata)` when dispatching through your own code, or write the JSON directly in LiveKit-side configuration such as a SIP dispatch rule. Entries in `requestContext` reach the agent's
|
|
477
|
+
The metadata travels as a JSON string. `liveKitConnectionRoute()` and `dispatchVoiceSession()` serialize it for you; use `serializeSessionMetadata(metadata)` when dispatching through your own code, or write the JSON directly in LiveKit-side configuration such as a SIP dispatch rule. Entries in `requestContext` reach the agent's runtime-defined instructions, tools, and input processors on every turn of the call.
|
|
478
478
|
|
|
479
479
|
## Related
|
|
480
480
|
|
|
@@ -82,7 +82,7 @@ Returns: `Promise<NodeJS.ReadableStream>`
|
|
|
82
82
|
|
|
83
83
|
### `listen(audioStream, options?)`
|
|
84
84
|
|
|
85
|
-
Transcribes audio using Mistral's Voxtral transcription model. Supports diarization, context biasing, and timestamp
|
|
85
|
+
Transcribes audio using Mistral's Voxtral transcription model. Supports diarization, context biasing, and timestamp level of detail.
|
|
86
86
|
|
|
87
87
|
**audioStream** (`NodeJS.ReadableStream`): Audio stream to transcribe.
|
|
88
88
|
|
|
@@ -113,7 +113,7 @@ Returns: `Promise<void>`
|
|
|
113
113
|
|
|
114
114
|
### `updateConfig()`
|
|
115
115
|
|
|
116
|
-
Updates the session configuration for the voice instance. This can
|
|
116
|
+
Updates the session configuration for the voice instance. This can modify voice settings and turn detection. It can also modify other parameters.
|
|
117
117
|
|
|
118
118
|
**sessionConfig** (`Realtime.SessionConfig`): New session configuration to apply.
|
|
119
119
|
|
|
@@ -129,4 +129,4 @@ Returns: `Promise<Array<{voiceId: SarvamVoiceId}>>`
|
|
|
129
129
|
- Audio is returned as a stream containing binary audio data
|
|
130
130
|
- Speech recognition supports mp3 and wav audio formats
|
|
131
131
|
- `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.
|
|
132
|
-
- Speaker names aren't interchangeable between `bulbul:v2` and `bulbul:v3
|
|
132
|
+
- Speaker names aren't interchangeable between `bulbul:v2` and `bulbul:v3`. Each model version has its own speaker catalog.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# voice.addTools()
|
|
4
4
|
|
|
5
|
-
The `addTools()` method equips a voice provider with tools (functions) that
|
|
5
|
+
The `addTools()` method equips a voice provider with tools (functions) that the model can call during real-time interactions. Voice assistants can use these tools to search for information or make calculations. They can also interact with external systems.
|
|
6
6
|
|
|
7
7
|
## Usage example
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Voice events
|
|
4
4
|
|
|
5
|
-
Voice providers emit
|
|
5
|
+
Voice providers emit events during real-time voice interactions. These events can be listened to using the [voice.on()](https://mastra.ai/reference/voice/voice.on) method and are particularly important for building interactive voice applications.
|
|
6
6
|
|
|
7
7
|
## Common events
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# voice.getSpeakers()
|
|
4
4
|
|
|
5
|
-
The `getSpeakers()` method retrieves a list of available voice options (speakers) from the voice provider.
|
|
5
|
+
The `getSpeakers()` method retrieves a list of available voice options (speakers) from the voice provider. Applications can present users with voice choices or programmatically select the most appropriate voice for different contexts.
|
|
6
6
|
|
|
7
7
|
## Usage example
|
|
8
8
|
|
|
@@ -124,7 +124,7 @@ Different voice providers return different metadata for their voices:
|
|
|
124
124
|
|
|
125
125
|
## Notes
|
|
126
126
|
|
|
127
|
-
- The available voices vary
|
|
127
|
+
- The available voices vary substantially between providers
|
|
128
128
|
- Some providers may require authentication to retrieve the full list of voices
|
|
129
129
|
- The default implementation returns an empty array if the provider doesn't support this method
|
|
130
130
|
- For performance reasons, consider caching the results if you need to display the list frequently
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# voice.on()
|
|
4
4
|
|
|
5
|
-
The `on()` method registers event listeners for
|
|
5
|
+
The `on()` method registers event listeners for voice events. This is particularly important for real-time voice providers, where events are used to communicate transcribed text, audio responses, and other state changes.
|
|
6
6
|
|
|
7
7
|
## Usage example
|
|
8
8
|
|
|
@@ -60,7 +60,7 @@ This method doesn't return a value.
|
|
|
60
60
|
|
|
61
61
|
## Events
|
|
62
62
|
|
|
63
|
-
For a
|
|
63
|
+
For a detailed list of events and their payload structures, see the [Voice Events](https://mastra.ai/reference/voice/voice.events) documentation.
|
|
64
64
|
|
|
65
65
|
Common events include:
|
|
66
66
|
|
|
@@ -111,7 +111,7 @@ Returns: `void`
|
|
|
111
111
|
|
|
112
112
|
### `addInstructions()`
|
|
113
113
|
|
|
114
|
-
Sets session instructions. If the WebSocket is open, the provider sends a `session.update
|
|
114
|
+
Sets session instructions. If the WebSocket is open, the provider sends a `session.update`. Passing `undefined` stores an empty string and clears the active instructions on the current session or the next connection.
|
|
115
115
|
|
|
116
116
|
**instructions** (`string`): System instructions to send to xAI.
|
|
117
117
|
|
|
@@ -199,7 +199,7 @@ Returns: `Promise<void>`
|
|
|
199
199
|
- `speaking`: emits assistant audio deltas.
|
|
200
200
|
- `speaking.done`: emits when an assistant audio response completes.
|
|
201
201
|
- `writing`: emits assistant text deltas and user input transcriptions.
|
|
202
|
-
- `error`: emits xAI
|
|
202
|
+
- `error`: emits xAI and provider execution errors. It also emits tool execution errors, and malformed function-call arguments. Tool errors include `details.call_id` and `details.name`.
|
|
203
203
|
- `close`: emits when the WebSocket closes.
|
|
204
204
|
- `tool-call-start`: emits before a Mastra function tool is executed.
|
|
205
205
|
- `tool-call-result`: emits after a Mastra function tool returns.
|
|
@@ -38,7 +38,7 @@ Steps that check the `abortSignal` parameter can respond to cancellation:
|
|
|
38
38
|
- Steps can check if already aborted: `if (abortSignal.aborted) { ... }`
|
|
39
39
|
- Useful for cancelling timeouts, network requests, or long-running operations
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
Steps must actively check the abort signal to be canceled mid-execution; otherwise, the current step runs to completion and subsequent steps don't execute.
|
|
42
42
|
|
|
43
43
|
## Extended usage examples
|
|
44
44
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Run.startAsync()
|
|
4
4
|
|
|
5
|
-
The `.startAsync()` method starts a workflow run without waiting for completion. It returns immediately with the `runId`, allowing the workflow to execute in the background. This is useful for long-running workflows
|
|
5
|
+
The `.startAsync()` method starts a workflow run without waiting for completion. It returns immediately with the `runId`, allowing the workflow to execute in the background. This is useful for long-running workflows or scheduled tasks. It also avoids blocking on workflow completion.
|
|
6
6
|
|
|
7
7
|
## Usage example
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Run.timeTravel()
|
|
4
4
|
|
|
5
|
-
The `.timeTravel()` method re-executes a workflow starting from any specific step, using either stored snapshot data or custom context you provide.
|
|
5
|
+
The `.timeTravel()` method re-executes a workflow starting from any specific step, using either stored snapshot data or custom context you provide. Use it to debug failed workflows and test individual steps with different inputs. It can also recover from errors without re-running the entire workflow.
|
|
6
6
|
|
|
7
7
|
## Usage example
|
|
8
8
|
|
|
@@ -40,7 +40,7 @@ If you need to run multiple operations per item, use a nested workflow as the st
|
|
|
40
40
|
|
|
41
41
|
### Using `.then()` after `.foreach()`
|
|
42
42
|
|
|
43
|
-
When you chain `.then()` after `.foreach()`, the next step receives the entire output array as its input.
|
|
43
|
+
When you chain `.then()` after `.foreach()`, the next step receives the entire output array as its input. You can aggregate or process all results together.
|
|
44
44
|
|
|
45
45
|
```typescript
|
|
46
46
|
workflow
|