mysterious-teacher-37099
07/09/2025, 4:56 PMinfo = await room.local_participant.send_file(
file_path="path/to/file.jpg",
topic="my-topic",
)
print(f"Sent file with stream ID: {info.stream_id}")
what should I implement from the agent side to understand the file and respond accordingly?tall-airline-16756
07/09/2025, 4:56 PMtall-airline-16756
07/09/2025, 4:56 PMsend_file
on the agent (remote) side, you should implement a byte stream handler using the registerByteStreamHandler
API. This registers a callback that is triggered when an incoming byte stream is received on a specified topic.
The handler receives a ByteStreamReader
object that allows reading the incoming file data incrementally or in full. You can then process the received data and respond accordingly.
In summary, the agent side should:
• Use registerByteStreamHandler
to register a handler for the topic related to the file transfer.
• In the handler, use the ByteStreamReader
to read and process the incoming file stream.
• Implement any response logic based on the file content as needed.
This mechanism enables robust file transfer handling integrated with LiveKit's streaming architecture.
Sources: Sending files & bytes | LiveKit Docs | examples/demo/demo.ts | livekit-rtc/livekit/rtc/_proto/data_stream_pb2.pyimysterious-teacher-37099
07/09/2025, 4:58 PMtall-airline-16756
07/09/2025, 4:58 PM