@mastra/mcp-docs-server 1.3.5-alpha.12 → 1.3.5-alpha.18

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.
Files changed (52) hide show
  1. package/.docs/docs/agents/overview.md +1 -1
  2. package/.docs/docs/auth/composite-auth.md +1 -1
  3. package/.docs/docs/auth/custom-auth-provider.md +28 -22
  4. package/.docs/docs/auth/jwt.md +1 -1
  5. package/.docs/docs/auth/overview.md +2 -2
  6. package/.docs/docs/auth/simple-auth.md +6 -1
  7. package/.docs/docs/browser.md +1 -2
  8. package/.docs/docs/deployment/overview.md +1 -1
  9. package/.docs/docs/deployment/web-framework.md +1 -1
  10. package/.docs/docs/evals/built-in-scorers.md +2 -2
  11. package/.docs/docs/guides/overview.md +15 -0
  12. package/.docs/docs/harness/agent-controller.md +7 -10
  13. package/.docs/docs/mastra-platform/configuration.md +1 -1
  14. package/.docs/docs/observability/overview.md +0 -5
  15. package/.docs/docs/sandbox/filesystem.md +12 -12
  16. package/.docs/docs/studio/observability.md +1 -1
  17. package/.docs/integrations/voice/livekit.md +449 -2
  18. package/.docs/models/gateways/netlify.md +2 -1
  19. package/.docs/models/gateways/openrouter.md +3 -1
  20. package/.docs/models/gateways/vercel.md +9 -2
  21. package/.docs/models/index.md +1 -1
  22. package/.docs/models/providers/aki-io.md +12 -12
  23. package/.docs/models/providers/edenai.md +15 -13
  24. package/.docs/models/providers/kilo.md +8 -7
  25. package/.docs/models/providers/llmgateway-providers.md +4 -1
  26. package/.docs/models/providers/llmgateway.md +2 -1
  27. package/.docs/models/providers/mistral.md +7 -6
  28. package/.docs/models/providers/nano-gpt.md +10 -11
  29. package/.docs/models/providers/opencode-go.md +2 -2
  30. package/.docs/models/providers/opencode.md +3 -1
  31. package/.docs/models/providers/requesty.md +3 -1
  32. package/.docs/models/providers/the-grid-ai.md +19 -12
  33. package/.docs/models/providers/wandb.md +4 -13
  34. package/.docs/reference/agent-controller/agent-controller-class.md +2 -2
  35. package/.docs/reference/agent-controller/session.md +18 -11
  36. package/.docs/reference/agents/createSkill.md +1 -2
  37. package/.docs/reference/agents/getModel.md +1 -1
  38. package/.docs/reference/agents/getSkill.md +6 -1
  39. package/.docs/reference/agents/listSkills.md +0 -1
  40. package/.docs/reference/auth/jwt.md +1 -1
  41. package/.docs/reference/auth/supabase.md +1 -1
  42. package/.docs/reference/browser/mastra-browser.md +13 -11
  43. package/.docs/reference/cli/create-mastra.md +1 -1
  44. package/.docs/reference/client-js/agent-controller.md +19 -3
  45. package/.docs/reference/client-js/conversations.md +1 -1
  46. package/.docs/reference/client-js/mastra-client.md +2 -2
  47. package/.docs/reference/client-js/workflows.md +18 -2
  48. package/.docs/reference/code-sdk/mount-agent-controller.md +1 -1
  49. package/.docs/reference/memory/observational-memory.md +2 -0
  50. package/.docs/reference/tools/mcp-server.md +1 -1
  51. package/.docs/reference/vectors/lance.md +56 -10
  52. package/package.json +5 -5
@@ -166,6 +166,8 @@ export default createLiveKitWorker({
166
166
 
167
167
  See the [LiveKit turn detection docs](https://docs.livekit.io/agents/logic/turns/) for all options.
168
168
 
169
+ To disable voice activity detection, set `vad: false` on `createLiveKitWorker()`. The worker passes `null` to LiveKit, which otherwise enables its bundled detector when `vad` is omitted. Choose a turn detection mode that doesn't require VAD, such as `'manual'`, when disabling it. Values in `sessionOptions` override the worker's generated options, including `vad`.
170
+
169
171
  ### Per-call voices and transcription
170
172
 
171
173
  The top-level `stt` and `tts` options apply to every call. To pick them per call, one voice or language per tenant, set the `configuration.stt` and `configuration.tts` resolvers instead. Each resolver runs once per call with the dispatch metadata, request context, room name, and job context, and returns a value accepted by the matching top-level option. The value is either a plugin instance or an inference model string. Return `undefined` to fall back to the top-level option.
@@ -448,6 +450,208 @@ await dispatchVoiceSession({
448
450
  })
449
451
  ```
450
452
 
453
+ ### Record calls
454
+
455
+ Pass `recording` to `dispatchVoiceSession()` or `liveKitConnectionRoute()` to create a room with [LiveKit auto egress](https://docs.livekit.io/transport/media/ingress-egress/egress/autoegress/). Mastra creates the room with recording configured, then dispatches the voice agent. Omitting `recording` preserves the existing behavior and return values.
456
+
457
+ Recording requires LiveKit Cloud or a self-hosted [egress service](https://docs.livekit.io/transport/self-hosting/egress/), plus an output destination. The example below records the caller and agent into a single mixed OGG audio file in an S3 bucket. Set `RECORDINGS_S3_BUCKET`, `RECORDINGS_S3_REGION`, `RECORDINGS_S3_ACCESS_KEY`, and `RECORDINGS_S3_SECRET` on your server, alongside the LiveKit credentials.
458
+
459
+ Install the server SDK to use its output format enum:
460
+
461
+ **npm**:
462
+
463
+ ```bash
464
+ npm install livekit-server-sdk
465
+ ```
466
+
467
+ **pnpm**:
468
+
469
+ ```bash
470
+ pnpm add livekit-server-sdk
471
+ ```
472
+
473
+ **Yarn**:
474
+
475
+ ```bash
476
+ yarn add livekit-server-sdk
477
+ ```
478
+
479
+ **Bun**:
480
+
481
+ ```bash
482
+ bun add livekit-server-sdk
483
+ ```
484
+
485
+ Define recording settings in a server-only module:
486
+
487
+ ```typescript
488
+ import type { LiveKitRecordingOptions } from '@mastra/livekit'
489
+ import { EncodedFileType } from 'livekit-server-sdk'
490
+
491
+ export const recording: LiveKitRecordingOptions = {
492
+ room: {
493
+ audioOnly: true,
494
+ fileOutputs: [
495
+ {
496
+ fileType: EncodedFileType.OGG,
497
+ filepath: 'calls/{room_name}.ogg',
498
+ output: {
499
+ case: 's3',
500
+ value: {
501
+ bucket: process.env.RECORDINGS_S3_BUCKET!,
502
+ region: process.env.RECORDINGS_S3_REGION!,
503
+ accessKey: process.env.RECORDINGS_S3_ACCESS_KEY!,
504
+ secret: process.env.RECORDINGS_S3_SECRET!,
505
+ },
506
+ },
507
+ },
508
+ ],
509
+ },
510
+ }
511
+ ```
512
+
513
+ `LiveKitRecordingOptions` accepts the settings used to construct LiveKit's `RoomEgress`, as either a plain object or an SDK instance. Set `room.audioOnly: true` for mixed audio, or use `tracks` or `participant` for separate recordings. Mastra passes these settings to LiveKit without choosing a format or storage provider for you. See [LiveKit output options](https://docs.livekit.io/transport/media/ingress-egress/egress/outputs/) for other destinations.
514
+
515
+ For an outbound phone call, configure recording before adding the phone participant:
516
+
517
+ ```typescript
518
+ import { randomUUID } from 'node:crypto'
519
+ import { dispatchVoiceSession } from '@mastra/livekit'
520
+ import { recording } from './mastra/recording'
521
+
522
+ const roomName = `support-call-${randomUUID()}`
523
+
524
+ await dispatchVoiceSession({
525
+ roomName,
526
+ metadata: { agentId: 'support', resourceId: 'caller-7' },
527
+ recording,
528
+ })
529
+
530
+ // Add the phone participant to roomName through your existing LiveKit SIP code.
531
+ ```
532
+
533
+ Use a fresh room name for each recorded session and await dispatch before dialing. `dispatchVoiceSession()` throws `LiveKitRecordingRoomConflictError` if the room already exists. Import this error from `@mastra/livekit` to handle the conflict. The existence check and room creation are separate requests, so your application must prevent another process from creating the same room concurrently. This option doesn't start recording in an existing room or capture earlier audio.
534
+
535
+ For browser sessions, pass the same settings to the connection route:
536
+
537
+ ```typescript
538
+ import { Mastra } from '@mastra/core/mastra'
539
+ import { liveKitConnectionRoute } from '@mastra/livekit'
540
+ import { recording } from './recording'
541
+
542
+ export const mastra = new Mastra({
543
+ server: {
544
+ apiRoutes: [liveKitConnectionRoute({ recording })],
545
+ },
546
+ })
547
+ ```
548
+
549
+ With recording enabled, the route creates the room and dispatches the agent when connection details are requested, before the browser joins. The response remains `{ serverUrl, roomName, participantName, participantToken }`. Recording settings and storage credentials stay on the server and aren't included in the join token or agent metadata.
550
+
551
+ The route also accepts a synchronous or asynchronous `recording` callback. It receives `{ body, context, roomName }`, including the resolved room name, so your server can choose settings for each session. Return `undefined` to skip recording for that request. Recording configuration isn't read directly from the request body.
552
+
553
+ An existing recording room returns HTTP 409 before agent dispatch or token issuance. Other room creation and dispatch errors reject the operation; the route doesn't issue a token on failure. If dispatch fails after room creation, the room remains in LiveKit. Successful setup doesn't guarantee that the recording finishes or uploads successfully. Use LiveKit's [egress events](https://docs.livekit.io/intro/basics/rooms-participants-tracks/webhooks-events/#webhook-events) to check completion and retrieve file details before making a recording available to users. To verify the setup, make a test call, end the room, and listen to the completed file under `calls/` in your bucket for audio from both participants.
554
+
555
+ #### Recording lifecycle and consent
556
+
557
+ Enabling `recording` starts recording during room creation, before a browser connects or a phone participant joins. An abandoned connection request can still start the agent and consume recording and storage resources. Configure authentication and application limits on the connection route before exposing it to users.
558
+
559
+ `createConsentTool()` and `configuration.consentPolicy` don't control LiveKit egress. They don't delay, pause, or stop an automatic recording. If your application needs consent during the call before capturing audio, obtain it first and use LiveKit's explicit egress APIs to start recording in the existing room. A spoken greeting alone doesn't gate this feature.
560
+
561
+ Recordings follow the LiveKit room lifecycle. Disconnecting only the agent doesn't necessarily end the room or finalize the file. Wait for a successful egress completion status and file results before marking a recording ready. Treat failed setup and abandoned rooms as application cleanup responsibilities.
562
+
563
+ The audio file lives in the configured output storage, separately from Mastra memory, transcripts, and traces. Deleting a Mastra thread doesn't delete the recording. Your application manages storage access, retention, and download links for end users. Keep storage credentials in server configuration, including when choosing recording settings per session.
564
+
565
+ ### Review recordings in Studio
566
+
567
+ Register `liveKitRecordingRoute()` to add **Review Audio** to a voice call's trace panel in Studio. The button opens an audio player for that call. Recording and trace storage must both be configured: the route reads the stored `voice call` span and passes its `roomName` to your server-side resolver. The browser supplies only the trace ID.
568
+
569
+ The resolver returns `{ url, expiresAt? }`, or `undefined` when no file is available. Use a short-lived signed URL for private storage. The route doesn't persist playback URLs in traces, and Studio requests a fresh URL each time the review opens. Missing files and playback errors offer **Refresh recording** so you can retry after the upload finishes or a link expires.
570
+
571
+ For the S3 configuration above, use the same `calls/{room_name}.ogg` object key for recording and playback. Room names must remain unique across calls, including after a room has ended. Install the AWS SDK in your application:
572
+
573
+ **npm**:
574
+
575
+ ```bash
576
+ npm install @aws-sdk/client-s3 @aws-sdk/s3-request-presigner
577
+ ```
578
+
579
+ **pnpm**:
580
+
581
+ ```bash
582
+ pnpm add @aws-sdk/client-s3 @aws-sdk/s3-request-presigner
583
+ ```
584
+
585
+ **Yarn**:
586
+
587
+ ```bash
588
+ yarn add @aws-sdk/client-s3 @aws-sdk/s3-request-presigner
589
+ ```
590
+
591
+ **Bun**:
592
+
593
+ ```bash
594
+ bun add @aws-sdk/client-s3 @aws-sdk/s3-request-presigner
595
+ ```
596
+
597
+ ```typescript
598
+ import {
599
+ GetObjectCommand,
600
+ HeadObjectCommand,
601
+ S3Client,
602
+ S3ServiceException,
603
+ } from '@aws-sdk/client-s3'
604
+ import { getSignedUrl } from '@aws-sdk/s3-request-presigner'
605
+ import { liveKitRecordingRoute } from '@mastra/livekit'
606
+ import { authorizeRecording } from './recording-access'
607
+
608
+ const s3 = new S3Client({
609
+ region: process.env.RECORDINGS_S3_REGION!,
610
+ credentials: {
611
+ accessKeyId: process.env.RECORDINGS_S3_ACCESS_KEY!,
612
+ secretAccessKey: process.env.RECORDINGS_S3_SECRET!,
613
+ },
614
+ })
615
+
616
+ export const recordingReviewRoute = liveKitRecordingRoute({
617
+ authorize: authorizeRecording,
618
+ resolveRecording: async ({ roomName }) => {
619
+ const object = {
620
+ Bucket: process.env.RECORDINGS_S3_BUCKET!,
621
+ Key: `calls/${roomName}.ogg`,
622
+ }
623
+ try {
624
+ await s3.send(new HeadObjectCommand(object))
625
+ } catch (error) {
626
+ if (error instanceof S3ServiceException && error.$metadata.httpStatusCode === 404)
627
+ return undefined
628
+ throw error
629
+ }
630
+ const expiresIn = 15 * 60
631
+ return {
632
+ url: await getSignedUrl(
633
+ s3,
634
+ new GetObjectCommand({ ...object, ResponseContentType: 'audio/ogg' }),
635
+ { expiresIn },
636
+ ),
637
+ expiresAt: new Date(Date.now() + expiresIn * 1000).toISOString(),
638
+ }
639
+ },
640
+ })
641
+ ```
642
+
643
+ Add `recordingReviewRoute` to `server.apiRoutes` alongside `liveKitConnectionRoute({ recording })`. Keep the default path, `GET /voice/livekit/recordings/:traceId`, for Studio discovery. Both the connection route and server-initiated dispatch recordings can be reviewed, as long as the worker persisted the call trace and your resolver can locate its file.
644
+
645
+ The review route requires authentication by default and an explicit `authorize({ traceId, context })` callback. Implement the `authorizeRecording` helper in your application to check the authenticated user's access to the requested trace against your trusted ownership or tenant records. Return `true` only when access is allowed. Authentication alone doesn't establish recording ownership.
646
+
647
+ The route rejects missing authorization callbacks at registration, including when `requiresAuth` is `false`. A denied request returns `403` before trace storage is read or a playback URL is generated. Policy errors also stop resolution. The resolver receives the stored `span` and request `context` only after authorization succeeds.
648
+
649
+ > **Warning:** Use `requiresAuth: false` only for a local demo. It doesn't bypass the required recording authorization callback. If a demo policy allows all recordings, keep that policy explicitly limited to local development and replace it before deployment.
650
+
651
+ Recording upload permissions alone don't grant playback access. The signing credentials need `s3:GetObject` for the recording objects, including the `HEAD` check. S3 also requires `s3:ListBucket` to return a missing-object `404` instead of `403`. Your application can use separate read credentials for playback. The browser receives a temporary URL that authorizes access to that file, so treat it as sensitive. See [S3 object permissions](https://docs.aws.amazon.com/AmazonS3/latest/API/API_HeadObject.html) and [presigned URLs](https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-presigned-url.html).
652
+
653
+ `liveKitRecordingRoute()` is storage-independent. You can resolve URLs from another provider or a recording index populated by LiveKit completion events. It doesn't depend on LiveKit retaining historical egress jobs. If you use timestamped filenames or change buckets, retain the mapping from room to object in your application and resolve that mapping instead of constructing a key.
654
+
451
655
  ### Observability
452
656
 
453
657
  When the Mastra instance has [observability](https://mastra.ai/docs/observability/overview) configured, the worker traces each call. It opens one `voice call` span per session and nests everything under it:
@@ -478,6 +682,125 @@ export const mastra = new Mastra({
478
682
 
479
683
  Tracing is on by default. Pass `observability: false` to `createLiveKitWorker` to turn it off.
480
684
 
685
+ ### Request recording playback from your application
686
+
687
+ Import the browser client helper from `@mastra/livekit/client`. Install `@mastra/client-js` 1.51.2 or newer within 1.x to use this entry point:
688
+
689
+ **npm**:
690
+
691
+ ```bash
692
+ npm install @mastra/livekit @mastra/client-js
693
+ ```
694
+
695
+ **pnpm**:
696
+
697
+ ```bash
698
+ pnpm add @mastra/livekit @mastra/client-js
699
+ ```
700
+
701
+ **Yarn**:
702
+
703
+ ```bash
704
+ yarn add @mastra/livekit @mastra/client-js
705
+ ```
706
+
707
+ **Bun**:
708
+
709
+ ```bash
710
+ bun add @mastra/livekit @mastra/client-js
711
+ ```
712
+
713
+ ```typescript
714
+ import { MastraClient } from '@mastra/client-js'
715
+ import { getLiveKitRecording } from '@mastra/livekit/client'
716
+ import type { LiveKitRecordingResponse } from '@mastra/livekit/client'
717
+
718
+ const client = new MastraClient({
719
+ baseUrl: 'https://mastra.example.com',
720
+ credentials: 'include',
721
+ })
722
+
723
+ const recording: LiveKitRecordingResponse = await getLiveKitRecording(client, traceId)
724
+ if (recording.status === 'ready') {
725
+ audioElement.src = recording.url
726
+ }
727
+ ```
728
+
729
+ Register [`liveKitRecordingRoute()`](#review-recordings-in-studio) on the server first. The helper requests its default `/voice/livekit/recordings/:traceId` path, independently of the client's API prefix. It preserves the client's authentication headers, cookies, custom fetch function, and abort signal. Pass `{ signal }` as a third argument to cancel an individual request. Failed requests use `MastraClientError` and aren't retried automatically.
730
+
731
+ `@mastra/client-js@1.51.2` declares support for Zod 3 and 4, but its `@ai-sdk/ui-utils@1.2.11` dependency declares a Zod 3 peer dependency. This mismatch can cause strict npm installs with Zod 4 to fail. Use Zod `^3.25.76` with that SDK to satisfy both peer ranges. Server and worker consumers without the optional client SDK also support Zod 4.
732
+
733
+ The `/client` entry point excludes LiveKit server and worker imports. Other integration entry points don't require `@mastra/client-js`. Installing `@mastra/livekit` still installs its package-level dependencies; the browser entry point only controls which code enters the browser bundle. Storage credentials and recording authorization remain on the server.
734
+
735
+ ### Turn metrics and playback completion
736
+
737
+ `createLiveKitWorker()` accepts two observers for evaluating voice calls:
738
+
739
+ ```typescript
740
+ import { createLiveKitWorker } from '@mastra/livekit/worker'
741
+
742
+ export default createLiveKitWorker({
743
+ mastra,
744
+ agent: 'support',
745
+ onTurnMetrics: metrics => {
746
+ console.info('voice metric', metrics)
747
+ },
748
+ onSpeechComplete: speech => {
749
+ console.info('speech outcome', speech.speechId, speech.outcome)
750
+ },
751
+ })
752
+ ```
753
+
754
+ Observers run asynchronously and aren't awaited by the audio pipeline. Errors are logged. Keep their work small. Neither observer writes or reconciles memory.
755
+
756
+ `onTurnMetrics` receives versioned records with `phase: 'generation'` or `phase: 'speech'`. Generation records contain a `turnId`, a unique `attemptId`, a terminal `outcome`, `durationMs`, optional `firstTextMs`, and tool timings. Attempts for the same user message share its turn ID. Tool durations run from the bridge receiving a tool call to receiving its result; remote durations include transport and aren't pure server execution times. A tool without a result has no duration.
757
+
758
+ Speech records also contain LiveKit's `speechId`. The bridge carries turn and attempt IDs in assistant message metadata so they can be joined after playback. Speech without a correlated assistant message, such as cancelled speech that produced no output, uses its speech ID as the turn ID and omits the attempt ID. Don't infer a correlation by matching event arrival order.
759
+
760
+ | Measurement | Meaning |
761
+ | ----------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
762
+ | Generation `firstTextMs` | Time from starting generation to the first text forwarded toward speech synthesis. Can include filler. |
763
+ | Speech `firstAudioMs` | Time from caller speech ending to the first output audio, as reported by LiveKit. Can include filler. |
764
+ | Speech `completionMs` | Time from caller speech ending to completed output playback. Omitted for interrupted, cancelled, or failed speech. |
765
+ | `speechStartedAt` / `speechEndedAt` | Playback timestamps in Unix epoch milliseconds when available. |
766
+
767
+ Missing measurements are `undefined`, not zero. Local generation durations use a monotonic clock. LiveKit's speech timing values are converted to milliseconds. When observability is configured, these records appear as events in the existing `voice call` trace. Pipeline metric events retain LiveKit's speech ID when supplied.
768
+
769
+ `onSpeechComplete` runs once when a speech handle finishes, or when the session closes with that speech pending. It supplies the speech metrics plus optional `playedText` and `transcriptSource`. Outcomes are `completed`, `interrupted`, `cancelled`, or `failed`. A completed speech lifecycle alone doesn't prove that audio was produced; check whether the relevant audio measurements are present.
770
+
771
+ The measurement source is `server-playout`. LiveKit's committed transcript can be partial or estimated, depending on the output's synchronization support. It doesn't prove that the remote browser or phone listener heard every word. `transcriptSource: 'unavailable'` means no committed assistant transcript was available.
772
+
773
+ Keep using `onTurnComplete` for its existing generation contract. It can fire before speech playback finishes, with `interrupted: false`, even when the caller interrupts the audio later. Use `onSpeechComplete` for playback outcomes. Existing agent memory may already contain generated text; adding this hook doesn't change that persistence behavior.
774
+
775
+ For a session you own, call `observeVoiceSession(session, { onTurnMetrics, onSpeechComplete })` from `@mastra/livekit/worker` or `@mastra/livekit/plugin` before `session.start()`. Its return value detaches the observer and finalizes pending speech as cancelled. The worker attaches its observer automatically.
776
+
777
+ ### Speech segment boundaries
778
+
779
+ The built-in agent, remote, and workflow reply generators preserve text-segment and tool-step boundaries. Tool feedback is flushed after its text is queued, so an acknowledgment can reach text-to-speech while a tool is still running. A flush requests a segment boundary; it doesn't guarantee immediate audio from every speech provider.
780
+
781
+ Custom generators can continue returning string streams. To emit an explicit boundary, return a `ReadableStream<VoiceReplyChunk>` and enqueue `VOICE_TEXT_FLUSH`, both exported from `@mastra/livekit/worker` and `@mastra/livekit/plugin`. Consumers that read a reply generator directly must distinguish strings from boundary objects. Never concatenate a boundary object into a transcript.
782
+
783
+ The worker translates boundaries into LiveKit's `FlushSentinel`. With the `MastraLLM` plugin, add the node adapter to the LiveKit agent you own:
784
+
785
+ ```typescript
786
+ import { voice } from '@livekit/agents'
787
+ import { MastraLLM, mastraLLMNode } from '@mastra/livekit/plugin'
788
+
789
+ class SupportAgent extends voice.Agent {
790
+ override llmNode(...args: Parameters<voice.Agent['llmNode']>) {
791
+ return mastraLLMNode(this, ...args)
792
+ }
793
+ }
794
+
795
+ const session = new voice.AgentSession({
796
+ llm: new MastraLLM({ agent: supportAgent }),
797
+ // Configure STT and TTS for your application.
798
+ })
799
+ await session.start({ agent: new SupportAgent({ instructions: 'Support assistant' }), room })
800
+ ```
801
+
802
+ Without the adapter, the plugin still emits text, but LiveKit's default node doesn't translate the plugin's boundary metadata into flush markers. Use `pipeAgentReplyToWriter()` in a workflow reply step to preserve the boundaries and tool results used for timing.
803
+
481
804
  ### Deployment
482
805
 
483
806
  The worker is a separate process from your Mastra server. Deploy it as a long-running Node service with the production command:
@@ -505,6 +828,126 @@ Conversation history lives in Mastra Memory, so voice sessions and text chat can
505
828
  - [Agent Memory](https://mastra.ai/docs/memory/overview)
506
829
  - [LiveKit Agents docs](https://docs.livekit.io/agents/)
507
830
 
831
+ ## Upgrade to 0.5.0
832
+
833
+ The 0.5.0 prerelease requires LiveKit Agents 1.7.1 or newer within 1.x. The speech helpers use `FlushSentinel` and `SpeechHandle.exception()`, which are absent in Agents 1.4.0. Test the supplied prerelease version or package archive before deploying it. Updating a dependency range doesn't update an existing lockfile: check the installed versions after installation.
834
+
835
+ If you used `client.getLiveKitRecording(traceId)` in an earlier snapshot, switch to `getLiveKitRecording(client, traceId)` from `@mastra/livekit/client`. Import `LiveKitRecordingResponse` from the same entry point instead of `GetLiveKitRecordingResponse` from client-js.
836
+
837
+ ### Authorize recording access
838
+
839
+ Before upgrading an application that registers `liveKitRecordingRoute()`, add an `authorize({ traceId, context })` callback that checks the authenticated user's access to the requested trace. The callback is required even when `requiresAuth: false`; omitting it throws during route registration. Return `true` only to allow access, before trace lookup or playback URL resolution. See [Review recordings in Studio](#review-recordings-in-studio) for the setup example.
840
+
841
+ ### Install compatible packages
842
+
843
+ Use the same exact release for Agents and its plugins. The tested baseline is:
844
+
845
+ | Package | Version |
846
+ | -------------------------------- | --------- |
847
+ | `@livekit/agents` | `1.7.1` |
848
+ | `@livekit/agents-plugin-livekit` | `1.7.1` |
849
+ | `@livekit/agents-plugin-silero` | `1.7.1` |
850
+ | `@livekit/rtc-node` | `0.13.34` |
851
+ | `livekit-server-sdk` | `2.16.0` |
852
+
853
+ For a local prerelease archive, install it with the matching LiveKit packages:
854
+
855
+ **npm**:
856
+
857
+ ```bash
858
+ npm install ./mastra-livekit-0.5.0-next.0.tgz @livekit/agents@1.7.1 @livekit/agents-plugin-livekit@1.7.1 @livekit/agents-plugin-silero@1.7.1 @livekit/rtc-node@0.13.34 livekit-server-sdk@2.16.0
859
+ ```
860
+
861
+ **pnpm**:
862
+
863
+ ```bash
864
+ pnpm add ./mastra-livekit-0.5.0-next.0.tgz @livekit/agents@1.7.1 @livekit/agents-plugin-livekit@1.7.1 @livekit/agents-plugin-silero@1.7.1 @livekit/rtc-node@0.13.34 livekit-server-sdk@2.16.0
865
+ ```
866
+
867
+ **Yarn**:
868
+
869
+ ```bash
870
+ yarn add ./mastra-livekit-0.5.0-next.0.tgz @livekit/agents@1.7.1 @livekit/agents-plugin-livekit@1.7.1 @livekit/agents-plugin-silero@1.7.1 @livekit/rtc-node@0.13.34 livekit-server-sdk@2.16.0
871
+ ```
872
+
873
+ **Bun**:
874
+
875
+ ```bash
876
+ bun add ./mastra-livekit-0.5.0-next.0.tgz @livekit/agents@1.7.1 @livekit/agents-plugin-livekit@1.7.1 @livekit/agents-plugin-silero@1.7.1 @livekit/rtc-node@0.13.34 livekit-server-sdk@2.16.0
877
+ ```
878
+
879
+ Replace the archive path with the supplied prerelease. Install any other `@livekit/agents-plugin-*` packages at the matching release. Agents 1.7.1 and Silero 1.7.1 require RTC `^0.13.34`; RTC 1.x doesn't satisfy that requirement. Don't override peer dependency errors to install it.
880
+
881
+ Keep Node.js 22.13 or newer. Both `@mastra/livekit` and Agents require Zod `^3.25.76 || ^4.1.8`. Upgrade older Zod versions before installing 0.5.0. Verify the installed dependency tree and initialize the worker's models:
882
+
883
+ **npm**:
884
+
885
+ ```bash
886
+ npm ls @mastra/livekit @livekit/agents @livekit/agents-plugin-livekit @livekit/agents-plugin-silero @livekit/rtc-node
887
+ npx tsx src/mastra/voice-worker.ts download-files
888
+ ```
889
+
890
+ **pnpm**:
891
+
892
+ ```bash
893
+ npm ls @mastra/livekit @livekit/agents @livekit/agents-plugin-livekit @livekit/agents-plugin-silero @livekit/rtc-node
894
+ pnpm dlx tsx src/mastra/voice-worker.ts download-files
895
+ ```
896
+
897
+ **Yarn**:
898
+
899
+ ```bash
900
+ npm ls @mastra/livekit @livekit/agents @livekit/agents-plugin-livekit @livekit/agents-plugin-silero @livekit/rtc-node
901
+ yarn dlx tsx src/mastra/voice-worker.ts download-files
902
+ ```
903
+
904
+ **Bun**:
905
+
906
+ ```bash
907
+ npm ls @mastra/livekit @livekit/agents @livekit/agents-plugin-livekit @livekit/agents-plugin-silero @livekit/rtc-node
908
+ bun x tsx src/mastra/voice-worker.ts download-files
909
+ ```
910
+
911
+ Use a single installed copy of Agents for both the integration and a custom `voice.AgentSession`. Multiple copies can fail LiveKit's runtime class checks.
912
+
913
+ ### Check VAD and turn detection
914
+
915
+ `vad: false` now disables VAD at session creation. Previously, the worker skipped plugin prewarming but passed `undefined` to LiveKit, which could enable its bundled VAD. If an application relied on that behavior, configure a detector explicitly.
916
+
917
+ ```typescript
918
+ import { createLiveKitWorker } from '@mastra/livekit/worker'
919
+ import { mastra } from './index'
920
+
921
+ export default createLiveKitWorker({
922
+ mastra,
923
+ agent: 'support',
924
+ vad: false,
925
+ turnDetection: 'manual',
926
+ })
927
+ ```
928
+
929
+ The default still loads the Silero plugin during prewarm. The `'english'` and `'multilingual'` turn detection options still select their existing text models. LiveKit's newer `inference.VAD` and `inference.TurnDetector` APIs are available through the existing instance and resolver options; switching to them is a separate choice that can change endpointing, model downloads, and cloud usage.
930
+
931
+ ### Review custom LiveKit tools
932
+
933
+ Mastra tools continue to run through the Mastra agent. If you also implement LiveKit tools or a custom LiveKit plugin, account for the changes since Agents 1.4:
934
+
935
+ - `ToolContext` is a class. Use its accessors and `flatten()` instead of enumerating or mutating it as a plain object.
936
+ - Named tool lists and duplicate-name checks are supported. Object shorthand with anonymous tools remains supported; converting every tool map isn't required.
937
+ - Provider tools use subclasses of `ProviderTool` instead of the older `ProviderDefinedTool` API.
938
+
939
+ See the [LiveKit tool API](https://github.com/livekit/agents-js/blob/main/agents/src/llm/tool_context.ts) for custom plugin migration details.
940
+
941
+ ### Review shutdown
942
+
943
+ The `onCallEnd` hook still uses LiveKit's job shutdown callbacks. Keep cleanup within the configured shutdown window, and verify that it completes when a caller disconnects or a worker receives a shutdown signal.
944
+
945
+ ### Verify recordings and calls
946
+
947
+ The integration's room-level `recording` configuration and S3 permissions stay the same. LiveKit Agents' `AgentSession.start({ record })` controls separate session recording and telemetry. Disabling one doesn't disable the other.
948
+
949
+ Before promoting the prerelease, test both a browser call and a phone call through a configured SIP trunk. Verify both speakers, interruptions, tools, greeting and consent behavior, hangup, the completed trace, and `onCallEnd`. When recording is enabled, wait for the S3 object and play it with **Review Audio**. Also test recording disabled and rejection of an existing room name. Run these checks on the deployment image with its model files and native libraries installed.
950
+
508
951
  ## API reference
509
952
 
510
953
  The `@mastra/livekit` package connects Mastra agents to the LiveKit Agents framework. LiveKit runs the audio pipeline (voice activity detection, speech-to-text, turn detection, text-to-speech, barge-in) and the package bridges reply generation to a Mastra agent's `stream()` call.
@@ -986,12 +1429,14 @@ The route accepts a JSON body with optional `agentId`, `threadId`, and `resource
986
1429
 
987
1430
  **requiresAuth** (`boolean`): Whether the route requires authentication. (Default: `true`)
988
1431
 
989
- **roomName** (`string | (args) => string`): Room name or a function that derives one from the request.
1432
+ **roomName** (`string | (args) => string`): Room name or a function that derives one from the request. With recording enabled, use a unique name for each call. An existing room returns HTTP 409 before agent dispatch or token issuance.
990
1433
 
991
1434
  **participantIdentity** (`string | (args) => string`): Participant identity or a function that derives one from the request.
992
1435
 
993
1436
  **metadata** (`(args) => LiveKitSessionMetadata | Promise<LiveKitSessionMetadata>`): Builds the session metadata delivered to the worker. Defaults to passing through agentId, threadId, and resourceId from the request body.
994
1437
 
1438
+ **recording** (`LiveKitRecordingOptions | (args) => LiveKitRecordingOptions | undefined | Promise<LiveKitRecordingOptions | undefined>`): Creates a fresh room with automatic recording and dispatches the agent before returning connection details. The server-side callback receives body, context, and the resolved roomName. Return undefined to skip recording. Existing rooms return HTTP 409. Other setup failures reject the request.
1439
+
995
1440
  ### `dispatchVoiceSession()`
996
1441
 
997
1442
  Dispatches a Mastra voice agent into a LiveKit room programmatically: for server-initiated sessions such as outbound calls.
@@ -1008,12 +1453,14 @@ await dispatchVoiceSession({
1008
1453
 
1009
1454
  #### Options
1010
1455
 
1011
- **roomName** (`string`): Room to dispatch the agent into. Created on demand.
1456
+ **roomName** (`string`): Room to dispatch the agent into. Created on demand. With recording enabled, use a unique name for each call. An existing room throws LiveKitRecordingRoomConflictError.
1012
1457
 
1013
1458
  **agentName** (`string`): Must match the worker's agentName. (Default: `'mastra-voice'`)
1014
1459
 
1015
1460
  **metadata** (`LiveKitSessionMetadata`): Session metadata: agentId, threadId, resourceId, requestContext.
1016
1461
 
1462
+ **recording** (`LiveKitRecordingOptions`): Creates a fresh room with automatic recording before dispatching. Accepts LiveKit RoomEgress settings as a plain object or SDK instance. Existing rooms and setup failures reject the operation. Omit to preserve dispatch-only behavior.
1463
+
1017
1464
  **serverUrl** (`string`): LiveKit server URL. (Default: `process.env.LIVEKIT_URL`)
1018
1465
 
1019
1466
  **apiKey** (`string`): LiveKit API key. (Default: `process.env.LIVEKIT_API_KEY`)
@@ -4,7 +4,7 @@
4
4
 
5
5
  # Netlify
6
6
 
7
- Netlify AI Gateway provides unified access to multiple providers with built-in caching and observability. Access 270 models through Mastra's model router.
7
+ Netlify AI Gateway provides unified access to multiple providers with built-in caching and observability. Access 271 models through Mastra's model router.
8
8
 
9
9
  Learn more in the [Netlify documentation](https://docs.netlify.com/build/ai-gateway/overview/).
10
10
 
@@ -73,6 +73,7 @@ ANTHROPIC_API_KEY=ant-...
73
73
  | `gemini/gemini-3.8-flash` |
74
74
  | `gemini/gemini-flash-latest` |
75
75
  | `gemini/gemini-flash-lite-latest` |
76
+ | `gemini/gemini-nano-banana-2.1` |
76
77
  | `openai/chat-latest` |
77
78
  | `openai/gpt-4.1` |
78
79
  | `openai/gpt-4.1-mini` |
@@ -4,7 +4,7 @@
4
4
 
5
5
  # ![OpenRouter logo](https://models.dev/logos/openrouter.svg)OpenRouter
6
6
 
7
- OpenRouter aggregates models from multiple providers with enhanced features like rate limiting and failover. Access 388 models through Mastra's model router.
7
+ OpenRouter aggregates models from multiple providers with enhanced features like rate limiting and failover. Access 390 models through Mastra's model router.
8
8
 
9
9
  Learn more in the [OpenRouter documentation](https://openrouter.ai/models).
10
10
 
@@ -136,6 +136,7 @@ ANTHROPIC_API_KEY=ant-...
136
136
  | `google/gemini-3.6-flash` |
137
137
  | `google/gemini-3.7-flash` |
138
138
  | `google/gemini-3.8-flash` |
139
+ | `google/gemini-nano-banana-2.1` |
139
140
  | `google/gemma-2-27b-it` |
140
141
  | `google/gemma-3-12b-it` |
141
142
  | `google/gemma-3-27b-it` |
@@ -194,6 +195,7 @@ ANTHROPIC_API_KEY=ant-...
194
195
  | `mistralai/mistral-large` |
195
196
  | `mistralai/mistral-large-2407` |
196
197
  | `mistralai/mistral-large-2512` |
198
+ | `mistralai/mistral-large-4-0` |
197
199
  | `mistralai/mistral-medium-3` |
198
200
  | `mistralai/mistral-medium-3-5` |
199
201
  | `mistralai/mistral-medium-3.1` |
@@ -4,7 +4,7 @@
4
4
 
5
5
  # ![Vercel logo](https://models.dev/logos/vercel.svg)Vercel
6
6
 
7
- Vercel aggregates models from multiple providers with enhanced features like rate limiting and failover. Access 402 models through Mastra's model router.
7
+ Vercel aggregates models from multiple providers with enhanced features like rate limiting and failover. Access 409 models through Mastra's model router.
8
8
 
9
9
  Learn more in the [Vercel documentation](https://ai-sdk.dev/providers/ai-sdk-providers).
10
10
 
@@ -113,6 +113,7 @@ ANTHROPIC_API_KEY=ant-...
113
113
  | `bfl/flux-2-klein-9b` |
114
114
  | `bfl/flux-2-max` |
115
115
  | `bfl/flux-2-pro` |
116
+ | `bfl/flux-3-image` |
116
117
  | `bfl/flux-3-video` |
117
118
  | `bfl/flux-kontext-max` |
118
119
  | `bfl/flux-kontext-pro` |
@@ -135,6 +136,8 @@ ANTHROPIC_API_KEY=ant-...
135
136
  | `bytedance/seedream-5.0-pro` |
136
137
  | `cohere/command-a` |
137
138
  | `cohere/embed-v4.0` |
139
+ | `cohere/embed-v5.0-fast` |
140
+ | `cohere/embed-v5.0-pro` |
138
141
  | `cohere/rerank-v3.5` |
139
142
  | `cohere/rerank-v4-fast` |
140
143
  | `cohere/rerank-v4-pro` |
@@ -179,6 +182,7 @@ ANTHROPIC_API_KEY=ant-...
179
182
  | `google/gemini-3.8-live-extended-thinking` |
180
183
  | `google/gemini-embedding-001` |
181
184
  | `google/gemini-embedding-2` |
185
+ | `google/gemini-nano-banana-2.1` |
182
186
  | `google/gemini-omni-flash-preview` |
183
187
  | `google/gemma-4-26b-a4b-it` |
184
188
  | `google/gemma-4-31b-it` |
@@ -222,7 +226,6 @@ ANTHROPIC_API_KEY=ant-...
222
226
  | `meta/muse-spark-1.2-contributor` |
223
227
  | `meta/muse-spark-1.3` |
224
228
  | `meta/muse-spark-1.3-contributor` |
225
- | `microsoft/mai-transcribe-1.5` |
226
229
  | `microsoft/mai-transcribe-2` |
227
230
  | `microsoft/mai-transcribe-2-streaming` |
228
231
  | `microsoft/mai-voice-2` |
@@ -246,6 +249,7 @@ ANTHROPIC_API_KEY=ant-...
246
249
  | `mistral/ministral-8b` |
247
250
  | `mistral/mistral-embed` |
248
251
  | `mistral/mistral-large-3` |
252
+ | `mistral/mistral-large-4` |
249
253
  | `mistral/mistral-medium-3.5` |
250
254
  | `mistral/mistral-nemo` |
251
255
  | `mistral/mistral-small` |
@@ -404,6 +408,9 @@ ANTHROPIC_API_KEY=ant-...
404
408
  | `tencent/hy4-preview` |
405
409
  | `thinkingmachines/inkling` |
406
410
  | `thinkingmachines/inkling-small` |
411
+ | `topaz/proteus` |
412
+ | `topaz/starlight-precise-2.6` |
413
+ | `topaz/wonder-3.5` |
407
414
  | `voyage/rerank-2.5` |
408
415
  | `voyage/rerank-2.5-lite` |
409
416
  | `voyage/rerank-3` |
@@ -4,7 +4,7 @@
4
4
 
5
5
  # Model Providers
6
6
 
7
- Mastra provides a unified interface for working with LLMs across multiple providers, giving you access to 7772 models from 213 providers through a single API.
7
+ Mastra provides a unified interface for working with LLMs across multiple providers, giving you access to 7792 models from 213 providers through a single API.
8
8
 
9
9
  ## Features
10
10