silly-animal-40683
12/08/2025, 8:04 PMtall-airline-16756
12/08/2025, 8:04 PMtall-airline-16756
12/08/2025, 8:04 PMSTTMetrics and TTSMetrics) to see concurrent connections, durations, and retry patterns.
• Add exponential backoff on retries and avoid creating duplicate agent instances or parallel streams.
If you want, tell me:
• Your LiveKit plan (Build, Scale, etc.)
• Whether you use LiveKit Inference or third-party plugins
• Typical call duration, frequency, and how many audio streams/tracks are active
With those I can point to specific diagnostics and recommend whether optimizing usage or requesting a limit increase is the right next step.
Sources: Quotas and limits | LiveKit docs | Observability data hooks | LiveKit docs | Introducing LiveKit Inference: A unified model interface for voice AIsilly-animal-40683
12/08/2025, 8:06 PMtall-airline-16756
12/08/2025, 8:06 PMSTTMetrics and TTSMetrics to watch streamed, audio_duration, and characters_count.
A couple quick questions so I can give concrete next steps:
• Are you using LiveKit Inference or third‑party STT/TTS plugins?
• When you run a test, do you see multiple active connections in the dashboard or just one?
Answer those and I’ll recommend targeted diagnostics or whether a plan increase is appropriate.silly-animal-40683
12/08/2025, 8:07 PMsilly-animal-40683
12/08/2025, 8:07 PMtall-airline-16756
12/08/2025, 8:07 PMSTTMetrics and TTSMetrics to track streamed, audio_duration, and characters_count during your tests.
If you still hit limits after those changes, tell me:
• Whether you see multiple active connections in the dashboard during a single test
• Approximate number of audio tracks published per session
I’ll recommend targeted diagnostics or next steps (optimize usage vs request increased concurrency). Would you like instructions for how to view the concurrency metrics in the dashboard?tall-airline-16756
12/08/2025, 8:07 PMSTTMetrics and TTSMetrics during a test and watch streamed, audio_duration, and timestamps to see overlapping requests.
4. Run a test while watching the Project → Project tab in the Cloud dashboard to see concurrency spikes in real time.
If you still hit limits while seeing only one visible connection, paste:
• a short snippet of your agent logs around a test run (STT/TTS start/retry events),
• the number of published audio tracks per session,
and I’ll point to exactly which events are consuming concurrency and recommend fixes (backoff, single-connection flow, or whether a plan increase is needed).
Sources: Quotas and limits | LiveKit docs | Agents (Python) | livekit/livekit_composite | DeepWikisilly-animal-40683
12/08/2025, 8:15 PMtall-airline-16756
12/08/2025, 8:16 PMsilly-animal-40683
12/08/2025, 8:19 PM[14:14:40.392] ERROR (44388): Unhandled error. ({
type: 'error',
error: APIConnectionError: Error connecting to LiveKit WebSocket
at WebSocket.onError ([REDACTED]/node_modules/.pnpm/@livekit+agents@1.0.24_@livekit+rtc-node@0.13.21_zod@3.25.76/node_modules/@livekit/agents/src/inference/utils.ts:48:16)
at Object.onceWrapper (node:events:633:26)
at WebSocket.emit (node:events:518:28)
at emitErrorAndClose ([REDACTED]/node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/websocket.js:1041:13)
at process.processTicksAndRejections (node:internal/process/task_queues:90:21) {
body: null,
retryable: true
},
source: STT {
_events: [Object: null prototype] {
metrics_collected: [Function (anonymous)],
error: [Function (anonymous)]
},
_eventsCount: 2,
_maxListeners: undefined,
opts: {
model: 'assemblyai/universal-streaming',
language: 'en',
encoding: 'pcm_s16le',
sampleRate: 16000,
baseURL: 'wss://agent-gateway.livekit.cloud/v1',
apiKey: 'REDACTED',
apiSecret: 'REDACTED',
modelOptions: {}
},
streams: Set(1) { [SpeechStream] },
[Symbol(shapeMode)]: false,
[Symbol(kCapture)]: false
},
createdAt: 1765224880389
})
jobID: "AJ_CtpS8V72KxHt"
err: {
"type": "Error",
"message": "Unhandled error. ({\n type: 'error',\n error: APIConnectionError: Error connecting to LiveKit WebSocket\n at WebSocket.onError ([REDACTED]/node_modules/.pnpm/@livekit+agents@1.0.24_@livekit+rtc-node@0.13.21_zod@3.25.76/node_modules/@livekit/agents/src/inference/utils.ts:48:16)\n at Object.onceWrapper (node:events:633:26)\n at WebSocket.emit (node:events:518:28)\n at emitErrorAndClose ([REDACTED]/node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/websocket.js:1041:13)\n at process.processTicksAndRejections (node:internal/process/task_queues:90:21) {\n body: null,\n retryable: true\n },\n source: STT {\n _events: [Object: null prototype] {\n metrics_collected: [Function (anonymous)],\n error: [Function (anonymous)]\n },\n _eventsCount: 2,\n _maxListeners: undefined,\n opts: {\n model: 'assemblyai/universal-streaming',\n language: 'en',\n encoding: 'pcm_s16le',\n sampleRate: 16000,\n baseURL: 'wss://agent-gateway.livekit.cloud/v1',\n apiKey: 'REDACTED',\n apiSecret: 'REDACTED',\n modelOptions: {}\n },\n streams: Set(1) { [SpeechStream] },\n [Symbol(shapeMode)]: false,\n [Symbol(kCapture)]: false\n },\n createdAt: 1765224880389\n})",
"stack":
Error [ERR_UNHANDLED_ERROR]: Unhandled error. ({
type: 'error',
error: APIConnectionError: Error connecting to LiveKit WebSocket
at WebSocket.onError ([REDACTED]/node_modules/.pnpm/@livekit+agents@1.0.24_@livekit+rtc-node@0.13.21_zod@3.25.76/node_modules/@livekit/agents/src/inference/utils.ts:48:16)
at Object.onceWrapper (node:events:633:26)
at WebSocket.emit (node:events:518:28)
at emitErrorAndClose ([REDACTED]/node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/websocket.js:1041:13)
at process.processTicksAndRejections (node:internal/process/task_queues:90:21) {
body: null,
retryable: true
},
source: STT {
_events: [Object: null prototype] {
metrics_collected: [Function (anonymous)],
error: [Function (anonymous)]
},
_eventsCount: 2,
_maxListeners: undefined,
opts: {
model: 'assemblyai/universal-streaming',
language: 'en',
encoding: 'pcm_s16le',
sampleRate: 16000,
baseURL: 'wss://agent-gateway.livekit.cloud/v1',
apiKey: 'REDACTED',
apiSecret: 'REDACTED',
modelOptions: {}
},
streams: Set(1) { [SpeechStream] },
[Symbol(shapeMode)]: false,
[Symbol(kCapture)]: false
},
createdAt: 1765224880389
})
at AgentSession.emit (node:events:507:17)
at AgentSession.emit ([REDACTED]/node_modules/.pnpm/@livekit+agents@1.0.24_@livekit+rtc-node@0.13.21_zod@3.25.76/node_modules/@livekit/agents/src/voice/agent_session.ts:205:18)
at AgentActivity.onError ([REDACTED]/node_modules/.pnpm/@livekit+agents@1.0.24_@livekit+rtc-node@0.13.21_zod@3.25.76/node_modules/@livekit/agents/src/voice/agent_activity.ts:520:25)
at STT.<anonymous> ([REDACTED]/node_modules/.pnpm/@livekit+agents@1.0.24_@livekit+rtc-node@0.13.21_zod@3.25.76/node_modules/@livekit/agents/src/voice/agent_activity.ts:276:43)
at STT.emit (node:events:518:28)
at SpeechStream.emitError ([REDACTED]/node_modules/.pnpm/@livekit+agents@1.0.24_@livekit+rtc-node@0.13.21_zod@3.25.76/node_modules/@livekit/agents/src/stt/stt.ts:231:15)
at SpeechStream.mainTask ([REDACTED]/node_modules/.pnpm/@livekit+agents@1.0.24_@livekit+rtc-node@0.13.21_zod@3.25.76/node_modules/@livekit/agents/src/stt/stt.ts:205:18)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
"code": "ERR_UNHANDLED_ERROR",
"context": {
"type": "error",
"error": {
"body": null,
"retryable": true,
"name": "APIConnectionError"
},
"source": {
"_events": {},
"_eventsCount": 2,
"opts": {
"model": "assemblyai/universal-streaming",
"language": "en",
"encoding": "pcm_s16le",
"sampleRate": 16000,
"baseURL": "wss://agent-gateway.livekit.cloud/v1",
"apiKey": "REDACTED",
"apiSecret": "REDACTED",
"modelOptions": {}
},
"streams": {}
},
"createdAt": 1765224880389
}
}tall-airline-16756
12/08/2025, 8:19 PMwss://agent-gateway.livekit.cloud/v1. That prevents the agent session from starting. Let’s troubleshoot step-by-step.
Please confirm or try each of the following:
1. API credentials
• Confirm the API key and secret used for LiveKit Inference are correct and not expired.
• Are you using the project API key/secret (not a different or limited key)?
1. Network / firewall
• Can your host reach *.livekit.cloud on TCP port 443? Corporate networks or firewalls often block WebSocket traffic.
• From the agent host run a quick check (curl or openssl) to validate TLS to the gateway and DNS resolution.
1. SDK / agent version
• You’re running @livekit/agents v1.0.24. Please confirm you’re on Node SDK v1.0.7+ (latest Agents SDK recommended). If not, try upgrading.
1. Retryable error behavior
• The error shows retryable: true. If your agent immediately spawns many retries, that can cause transient failures. Add/examine exponential backoff for STT connection attempts while we diagnose connectivity.
1. Dashboard & metrics
• While attempting startup, does the Project dashboard show any attempted STT/TTS connections or failed requests?
• Any STTMetrics/TTSMetrics entries at that timestamp?
Please paste these items if you can:
• The exact API key type you’re using (project key or other).
• Output of a connectivity test (e.g., curl -Iv https://agent-gateway.livekit.cloud/v1 or openssl s_client -connect agent-gateway.livekit.cloud:443) run from the agent host.
• Any additional agent logs around the same timestamp showing connection attempts or retries.
If you confirm credentials and network access look good, paste the connectivity output and a short log snippet of the first connection attempt — I’ll point to the precise next steps (auth mismatch vs network vs SDK issue).