Bedrud includes Python-based bot agents that can join meeting rooms and stream media content. These are useful for background music, radio streams, or sharing video content.
Available Agents
| Agent | Description | Media Type |
|---|---|---|
music_agent | Plays audio files into a room | Audio (PCM) |
radio_agent | Streams internet radio stations | Audio (PCM via FFmpeg) |
video_stream_agent | Shares video content (HLS, MP4) | Video + Audio |
How Agents Work
All agents follow the same connection pattern:
flowchart TD
A[1. Parse meeting URL] --> B[2. Guest login<br/>POST /api/auth/guest-login]
B --> C[3. Join room<br/>POST /api/room/join]
C --> D[4. Connect to LiveKit<br/>WebSocket + Token]
D --> E[5. Publish tracks<br/>Stream audio/video frames]flowchart LR
subgraph Media["Media Source"]
MS["File / URL<br/>(MP3, radio, HLS, MP4)"]
end
subgraph Agent["Python Agent"]
FF[FFmpeg Decoder]
PA[Agent Logic]
end
subgraph Server["Bedrud Server"]
GL[Guest Login<br/>/api/auth/guest-login]
JR[Join Room<br/>/api/room/join]
end
subgraph LK["LiveKit SFU<br/>(WebRTC)"]
WS[WebSocket Connect]
PT[Publish Tracks]
end
MS --> FF --> PA
PA --> GL
GL --> JR
JR --> WS
WS --> PTMusic Agent
Plays audio files (MP3, WAV, etc.) into a meeting room.
Setup
cd agents/music_agent
pip install -r requirements.txtDependencies: httpx, livekit, pydub
Usage
python agent.py "https://meet.example.com/m/room-name"How It Works
- Decodes audio files using
pydub - Converts to PCM frames
- Publishes audio frames to LiveKit as a microphone track
See Music Agent README for setup and usage instructions.
Radio Agent
Streams internet radio stations into a meeting room using FFmpeg for audio decoding.
Setup
cd agents/radio_agent
pip install -r requirements.txtDependencies: httpx, livekit
System requirement: FFmpeg must be installed (brew install ffmpeg or apt install ffmpeg)
Usage
python agent.py "https://meet.example.com/m/room-name"How It Works
- Connects to a radio stream URL
- Pipes the stream through FFmpeg to decode to raw PCM
- Publishes PCM audio frames to LiveKit
See Radio Agent README for setup and usage instructions.
Video Stream Agent
Shares video and audio from a URL (HLS/m3u8, MP4) into a meeting room.
Setup
cd agents/video_stream_agent
pip install -r requirements.txtDependencies: httpx, livekit
System requirement: FFmpeg must be installed
Usage
python agent.py "https://meet.example.com/m/room-name"How It Works
- Runs two FFmpeg processes in parallel:
- Video: Decodes to YUV420p raw frames (1280x720 @ 30fps)
- Audio: Decodes to PCM samples
- Publishes video as a screen share track
- Publishes audio as a microphone track
See Video Stream Agent README for setup and usage instructions.
Video Specifications
| Setting | Value |
|---|---|
| Width | 1280 |
| Height | 720 |
| FPS | 30 |
| Pixel Format | YUV420p |
Writing a Custom Agent
To create a new agent, follow this pattern:
import httpx
from livekit import rtc
# 1. Parse the meeting URL to extract room name
room_name = parse_url(meeting_url)
# 2. Guest login
client = httpx.Client(base_url=server_url)
resp = client.post("/api/auth/guest-login", json={"name": "Bot Name"})
token = resp.json()["token"]
# 3. Join room
client.headers["Authorization"] = f"Bearer {token}"
resp = client.post("/api/room/join", json={"roomName": room_name})
lk_token = resp.json()["token"]
# 4. Connect to LiveKit
room = rtc.Room()
await room.connect(livekit_url, lk_token)
# 5. Publish tracks
source = rtc.AudioSource(sample_rate=48000, num_channels=1)
track = rtc.LocalAudioTrack.create_audio_track("audio", source)
await room.local_participant.publish_track(track)
# 6. Stream frames
while has_data:
frame = get_next_frame()
await source.capture_frame(frame)See also
- Music Agent README - setup and usage
- Radio Agent README - setup and usage
- Video Stream Agent README - setup and usage