I'm getting lots of errors today: ```[11:46:52.095...
# ask-ai
c
I'm getting lots of errors today:
Copy code
[11:46:52.095] WARN (17695): failed to recognize speech, retrying in 2000s
    tts: "inference.STT"
    attempt: 2
    error: {
      "body": null,
      "retryable": true,
      "name": "APIConnectionError"
    }
t
Thanks for reaching out, Stefan. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
You're seeing repeated
APIConnectionError
retries from the speech-to-text (STT) step (
inference.STT
). I can help troubleshoot—here are focused next steps and a couple quick questions to narrow the cause. What you can check now • Confirm network connectivity from the agent host (no packet loss, DNS resolution to the STT provider). • Check the STT provider status/health page (provider outages or degraded service). • Inspect provider quotas/rate limits and your request volume; rate limits can cause retryable connection errors. • Verify your STT adapter configuration: ◦ Are you using a single provider or a
FallbackAdapter
with secondary providers? ◦ If you have a fallback configured, confirm backup provider credentials are valid. • Review recent changes (deploys, credential rotations, firewall rules) that could affect outbound API calls. • Validate audio quality: low-quality input can increase STT errors—test with a known-good audio sample. Logs and info that will help me drill in • Full agent log around one failure (timestamps ±30s), especially any upstream network/connect stack traces. • Which STT provider and adapter you’re using (provider name and whether
FallbackAdapter
is enabled). • Recent error frequency (how many failures per minute/hour) and whether failures are intermittent or persistent. • Any recent config changes or deploys before the errors started. If you prefer immediate mitigation • Enable or confirm a
FallbackAdapter
so a secondary STT provider is used automatically. • Temporarily reduce request rate to the STT provider to rule out rate-limiting. Tell me the STT provider and whether you have a fallback configured, and paste one fuller log sample (timestamps ±30s). I’ll analyze the logs and recommend the next concrete action. Sources: Events and error handling | LiveKit docs | Live Conversations with AI using ChatGPT and WebRTC | SIP troubleshooting guide | LiveKit docs
c
how to configure a fallback in nodejs?
t
You're asking how to configure a fallback STT provider in Node.js. Below is a concise example and steps to set it up with the LiveKit Agents framework using the
FallbackAdapter
. 1) Install required packages
Copy code
pnpm add @livekit/agents @livekit/agents-plugin-livekit @livekit/agents-plugin-deepgram @livekit/agents-plugin-assemblyai
2) Example Node.js setup (TypeScript-style)
Copy code
import { AgentSession } from '@livekit/agents';
import * as livekitPlugin from '@livekit/agents-plugin-livekit';
import * as deepgram from '@livekit/agents-plugin-deepgram';
import * as assemblyai from '@livekit/agents-plugin-assemblyai';

// Create session with a FallbackAdapter for STT
const session = new AgentSession({
  stt: new livekitPlugin.FallbackAdapter([
    // Primary provider
    new deepgram.STT({ apiKey: process.env.DEEPGRAM_API_KEY, model: 'nova-2' }),

    // Fallback provider
    new assemblyai.STT({ apiKey: process.env.ASSEMBLYAI_API_KEY, language: 'en' }),
  ]),
  // other config (llm, tts, etc.)
});
What the
FallbackAdapter
does • Automatically retries on the next provider if the current one returns connection or retryable errors. • Marks unhealthy providers and uses backups until the primary recovers. • Periodically probes primaries to resume them when healthy. Quick tips • Ensure API keys and network egress to each provider are valid. • Monitor rate limits for each provider to avoid repeated failures. • Test with a known-good audio sample to confirm failover behavior. If you want, paste which STT providers and adapters you currently use and I’ll give tailored code or troubleshoot your config. Sources: Events and error handling | LiveKit docs