aloof-forest-57428
11/21/2025, 10:11 AMtall-airline-16756
11/21/2025, 10:11 AMtall-airline-16756
11/21/2025, 10:11 AMServerType.ROOM (or the per-room/job configuration) so the server spawns a separate agent process for each room.
• Create a new AgentSession scoped to each JobContext/room; do not share a single AgentSession across rooms.
• Ensure your deployment has enough processes/resources and enable concurrent job processing (adjust num_idle_processes, loadFunc, drain_timeout, etc.) so multiple agent processes can run simultaneously.
If you want, tell me: 1) how you currently start your agent server (code/config), and 2) whether you use ServerType.ROOM or a single shared session—I'll point out the exact config/code changes to spawn separate instances.
Sources: Agent server | LiveKit docs | Agent server options | LiveKit docs | Agent session | LiveKit docsaloof-forest-57428
11/21/2025, 10:59 AMtall-airline-16756
11/21/2025, 11:00 AMWorkerType.ROOM, spawning a new session per JobContext, creating a fresh AgentSession, and connecting per-worker). That means a single shared session is not the likely cause.
A few targeted checks and small fixes to help find the root cause:
1. Confirm process concurrency
• Ensure MAX_CONCURRENT_CALLS >= number of simultaneous rooms you expect. num_idle_processes + scaling must allow that many worker processes.
1. Verify each worker actually runs in its own process
• When two calls are active, check your process list / logs to confirm two separate agent processes were started (one per room). Look for the per-room logs you instrumented (Room: ctx.room.name, TTS/STT ready, Starting agent session).
1. Check resource constraints
• CPU, memory, or model/TT S/STT limits can cause one process to stall. Monitor host metrics during concurrent calls.
1. Confirm VAD / audio routing isolation
• Each AgentSession creates its own vad_instance. Ensure vad_instance and STT/TTS instances are not shared globally. (In your code they appear local — good.) Also confirm LiveKit subscriptions/track routing give each process the correct participant audio (per-room connect).
1. Look for blocking calls or global locks
• Search for any global state, async blocking calls, or shared DB locks during session runtime. Your DB connect per-process is correct; ensure db_manager methods used during the session are fully async and non-blocking.
1. Session lifecycle/timeouts
• Confirm session.start() completes and the session remains running. Check for exceptions in the per-room logs shortly after start. Also ensure llm.timeout=5.0 isn’t timing out often and causing session termination.
If you'd like, share:
• The worker startup logs from two concurrent calls (include timestamps and the per-room log lines), and
• Values for MAX_CONCURRENT_CALLS, num_idle_processes, and observed host CPU/memory during the incident.
I can then point to the exact log lines or code locations that indicate why one room lost responsiveness. Would you like to provide those logs?