After the session ends, the audio_recording_path I see in the session report looks partial. something in this format:
/tmp/livekit-agents/job-jobid/audio.ogg
How do I get the full url of the recording? Is there an implied base url?
Does LiveKit also store the audio somewhere indefinitely? Or would I need to download it and use my own storage if I want it to stay up indefinitely?
@royibernthal, That /tmp/livekit-agents/job-jobid/audio.ogg is a local path on the ephemeral agent worker where the recording is written, not a URL, and there is no base URL that turns it into one. Audio recordings are automatically collected and uploaded to LiveKit Cloud for each session (data hooks), and you access them for playback and download in the Agent Insights tab, not through that path (insights).
On storage, LiveKit does not keep them indefinitely. All agent observability data, audio included, is on a 30-day retention window and is auto-deleted after that (same insights page). So for anything permanent you either download the file from Insights, or capture it to your own bucket with an egress. For a permanent copy, start an audio-only room composite egress to your S3 when the agent joins (from the data-hooks page):
import { LiveKitAPI, EncodedFileOutput, EncodedFileType } from 'livekit-server-sdk';
const api = new LiveKitAPI(); // reads LIVEKIT_URL / API key / secret from env
const output = new EncodedFileOutput({
fileType: EncodedFileType.OGG,
filepath: `livekit/${ctx.room.name}.ogg`,
output: {
case: 's3',
value: {
accessKey: process.env.AWS_ACCESS_KEY_ID,
secret: process.env.AWS_SECRET_ACCESS_KEY,
bucket: process.env.AWS_BUCKET_NAME,
region: process.env.AWS_REGION,
},
},
});
await api.egress.startRoomCompositeEgress(ctx.room.name ?? 'room', output, { audioOnly: true });
That file lands in your bucket and stays as long as you keep it, independent of the 30-day window. You can also gate the Cloud-side upload entirely with the record parameter on AgentSession.start().