Thanks — I’ll explain how two SFUs with one agent typically operate, and what to expect for media flow, redundancy, and scaling.
How it works (high level)
• Each SFU handles WebRTC connections for a subset of clients. Clients (browsers/mobile) connect to an SFU and publish/subscribe media there.
• The single agent joins the same room as a normal client and connects to one of the SFUs (whichever the agent’s signalling/selection routes it to).
• The SFUs forward media between each other as needed so the agent can receive streams published on any SFU and other participants can receive the agent’s output.
Media routing & connectivity
• When a publisher on SFU A publishes a track, SFU A forwards that track to other SFUs (including SFU B) via the SFU mesh/peering so subscribers on SFU B and the agent (wherever it’s connected) can receive it.
• The agent receives remote tracks from the SFU it’s connected to and can:
◦ Process them (STT/LLM/etc.) locally, and
◦ Publish processed audio/voice or synthesized media back into the room via its SFU connection.
• The SFU the agent is connected to will forward the agent’s published tracks to subscribers on other SFUs.
Resilience and failover
• If the agent is connected to SFU A and SFU A fails, the agent must reconnect (or be restarted) and will typically connect to SFU B to continue processing.
• If an SFU fails, clients connected to that SFU lose their direct connection and need to reconnect — their new connection may land on the surviving SFU; media flows resume once peers reconnect.
• For higher availability of the agent, run multiple agent instances (or use an autoscaling pool) so one agent can failover without losing processing capacity.
Performance and scaling considerations
• Two SFUs split media bandwidth and CPU load for forwarding; the single agent’s CPU/GPU is the bottleneck for any compute-heavy tasks (STT, LLM inference).
• Monitor agent CPU, latency (RTT), and media throughput. If agent processing becomes a bottleneck, add agent instances and distribute work (multiple agents can join the same room or separate rooms depending on your design).
• Ensure SFU interconnects have sufficient bandwidth and low latency so cross-SFU forwarding doesn’t introduce noticeable delay.
Questions to tailor guidance
• Is the agent doing real-time heavy processing (on-prem inference) or primarily cloud API calls?
• Do you want automatic agent failover or are you okay with manual restart/scale-up?
• Are you using LiveKit Cloud or self-hosted SFUs?
Tell me which of those apply and I’ll give specific deployment recommendations and configuration tips.
, with interactive elements