Repository navigation
Description
Feature request
Please expose subscriber-side track enable/disable in the Python RTC SDK, for example RemoteTrackPublication.set_enabled(enabled: bool), matching the semantics of the corresponding APIs in the other LiveKit SDKs.
Use case
A real-time voice/language-learning agent needs to accept microphone audio only during short, explicitly armed speaking attempts. During tutor playback, instructions, or review, the client should keep its microphone track published and the backend should control whether media is forwarded to the agent. This avoids coupling the client to the agent's recording state, prevents unrelated speech from reaching VAD/STT/realtime inference and avoids unnecessary downstream media transfer. User-controlled microphone mute remains independent and must not be overridden by the agent.
Current behavior
AgentSession.input.set_audio_enabled(False)in Agents 1.8.8 detaches the local input stream and drops frames after receipt, leaving the RTC subscription intact; other local consumers can continue receiving frames.RemoteTrackPublication.set_subscribed(False)stops subscription but resubscribing can require negotiation and stream reconstruction. For short, frequent turn transitions, this can introduce startup latency and risk losing the first word.- Python RTC 1.3.0 exposes
set_subscribedand video quality selection but no public subscriber-sideset_enabledmethod. - The subscription documentation distinguishes enable/disable from subscription changes and recommends the former for frequent toggles.
Proposed API
publication.set_enabled(False) # pause media delivery, retain subscription
publication.set_enabled(True) # resume media deliveryThis should operate on the receiving participant only, retain the publication/subscription and avoid SDP renegotiation for toggles. It should work for remote audio tracks (and ideally maintain parity for video), without remotely unmuting the publisher. A possible implementation is to expose the existing native track settings operation through the Rust FFI and Python bindings, subject to maintainer guidance.
Validation
- Confirm subscription stays active across repeated toggles, with no subscription/unsubscription events attributable to the toggle.
- Verify delivery of new audio frames pauses and resumes and downstream RTP traffic falls while disabled, allowing in-flight packets to drain.
- Verify other subscribers and publisher mute state are unaffected.
- Measure time from enable to first usable audio frame; no particular latency bound is assumed.
References: Python RTC 1.3.0 track publication, Agents 1.8.8 input stream.
Activity
zhao-xuan commentedon Dec 3, 2026
Implementation PR: #977 (#977).
The pinned Rust SDK already implements
EnableRemoteTrackPublicationRequest, and the generated Python protobuf bindings expose it. The PR therefore adds the missing public Python wrapper and parameterized unit tests without changing the native SDK. End-to-end media delivery and resume latency still need validation.