Agent Fallback Adapter for STT. Manages multiple STT instances with automatic fallback when the primary provider fails.

When the primary STT fails, the adapter switches to the next available provider in the list for the active session. Failed providers are monitored by one probe stream per provider. The probe receives its owner's live audio; another waiting stream takes over if the owner closes. A non-empty FINAL_TRANSCRIPT marks the provider available again. If every provider is unavailable, normal streams retry them in priority order.

Non-streaming STTs are automatically wrapped with StreamAdapter provided a vad is passed in.

Example

import { FallbackAdapter } from '@livekit/agents';
import { STT as DeepgramSTT } from '@livekit/agents-plugin-deepgram';
import { STT as AssemblyAISTT } from '@livekit/agents-plugin-assemblyai';

const fallbackSTT = new FallbackAdapter({
sttInstances: [
new AssemblyAISTT(), // Primary
new DeepgramSTT(), // Fallback
],
});

Hierarchy (view full)

Constructors

Properties

attemptTimeoutMs: number
label: string = 'stt.FallbackAdapter'
maxRetryPerSTT: number
retryIntervalMs: number
sttInstances: stt.STT[]

Accessors

  • get model(): string
  • The model of the instance serving the open stream (see _served), else of the one that serves next (see nextInstance). Spans and metrics read this, so a failover shows the model transcribing, or expected to, rather than the adapter.

    Returns string

  • get status(): STTStatus[]
  • Returns the current status of all STT instances, including availability and background recovery state.

    Returns STTStatus[]

Methods

  • Open the provider connection ahead of the first recognition. Best effort and non-blocking. Called by the framework when an agent starts or resumes. Providers without a persistent connection need not override this.

    Returns void