billowy-hairdresser-80384
07/23/2025, 12:24 PMtall-airline-16756
07/23/2025, 12:25 PMtall-airline-16756
07/23/2025, 12:25 PMbillowy-hairdresser-80384
07/23/2025, 12:45 PMtall-airline-16756
07/23/2025, 12:46 PMbillowy-hairdresser-80384
07/23/2025, 1:17 PMtall-airline-16756
07/23/2025, 1:19 PMfrom livekit import api
async def entrypoint(ctx):
req = api.ParticipantEgressRequest(
room_name=ctx.room.name,
identity="your-tts-agent-identity", # The TTS participant's identity
audio_only=True,
file_outputs=[api.EncodedFileOutput(
file_type=api.EncodedFileType.OGG,
filepath="recordings/tts-agent-audio.ogg",
# Optionally configure S3 upload here
)],
)
lkapi = api.LiveKitAPI()
res = await lkapi.egress.start_participant_egress(req)
await lkapi.aclose()
• Just swap out your-tts-agent-identity with your TTS participant's actual identity.
• This clever method will record only the audio from your TTS agent, leaving other participants' audio untouched.
• Feel free to customize the output file format and location to suit your needs.
This approach makes capturing your TTS audio stream a breeze. Need an example for a different SDK or want to record using track IDs? I'm here to help – just give me a shout!
Sources: livekit-agents/livekit/agents/voice/room_io/_output.py | Recording participants | LiveKit Docs | How to set a fixed participant for agent audio processing