How can I move the Voice agent to the background f...
# ask-ai
c
How can I move the Voice agent to the background for human to human conversation on the LiveKit room? I don't want the agent to publish tracks
t
Thanks for reaching out, Tamaghna. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Could you help me understand a bit better—are you using a custom setup for the Voice agent, or is it the standard LiveKit feature? Also, are you aiming to fully stop the agent from publishing tracks, or just pause it for a while? I’m here to help!
If you want to move the Voice agent to the background and stop it from publishing tracks in a LiveKit room, here are a couple of easy ways to do that: • Pause Upstream: This lets you temporarily stop the agent from sending tracks to the server, but keeps your local media active. You can use the
pauseUpstream()
method for this. For example, in JavaScript:
Copy code
await publication.pauseUpstream();
When you're ready to start publishing again, just use:
Copy code
await publication.resumeUpstream();
Just a heads-up: this method will let other participants know you're "muted." • Unpublish a Track: If you'd rather completely stop the agent from publishing tracks (and optionally stop the local media track), you can use the
unpublishTrack()
method. Here's how you'd do it in Android:
Copy code
localParticipant.unpublishTrack(track, stopOnUnpublish = true);
If you want a hand implementing these or have any other questions, just let me know—I'm here to help! Sources: livekit-rtc/livekit/rtc/participant.py | lib/src/publication/remote.dart | src/room/participant/LocalParticipant.ts
c
Please give me solution w.r.t. Python
t
Managing your Voice agent's tracks in LiveKit using the Python SDK is pretty straightforward! Here are a couple of handy options for you: • Unpublishing a Track: You can use the
unpublish_track
method to completely stop publishing a track, and if you want, also stop the local track. Here’s a quick example:
Copy code
await local_participant.unpublish_track(track_sid="track_sid_here")
Just a heads-up: the
track_sid
parameter is required, and the
stop_on_unpublish
flag (which defaults to
True
) will stop the local track when you unpublish it. • Pausing a Track: While there isn’t a direct
pauseUpstream
method in the Python SDK, you can easily mute the local track to get the same effect. Here’s how you can do it:
Copy code
# To pause (mute) the track
local_track.mute()

# To resume (unmute) the track
local_track.unmute()
If you have any questions or want a hand with implementing these, just let me know—I’m here to help! Sources: src/room/track/LocalTrack.ts | Managing participants | LiveKit Docs | livekit-rtc/livekit/rtc/_proto/track_pb2.py
c
t
Hey there! Updating permissions for participants in LiveKit is a great way to flexibly manage what each person can do in a room. You can easily make these changes using the
UpdateParticipant
server API, even after someone has already joined. Here are some important permissions you can tweak: • CanPublish: This lets a participant share their audio, video, or screen. If you turn this off, all their shared tracks will be unpublished automatically. • CanSubscribe: This lets them receive and view other participants' tracks. Turning it off will stop all their current subscriptions. • CanPublishData: This gives them the ability to send data messages inside the room. For example, if you want to promote someone from the audience to a speaker, you just enable
CanPublish
and
CanSubscribe
. Later, if you want to switch them back, simply disable
CanPublish
. If you want a hand setting this up or have any questions, just give me a shout—I’m here to help! Sources: Managing participants | LiveKit Docs | Room & Participant Management | livekit/livekit_composite | DeepWiki | packages/livekit-server-sdk/src/RoomServiceClient.ts | Authentication | LiveKit Docs