-
Notifications
You must be signed in to change notification settings - Fork 533
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot send stream from LiveKit agent #1295
Comments
@sam-goldman it's not clear your example has anything to do with agents.. if I'm reading it correctly, it spins up a new task that attempts to post to your API endpoint.. |
Hey @davidzhao, let me clarify what the issue is. If I post to my API endpoint from a standalone script (
Here’s the standalone script,
(You can run that script via However, if you copy and paste the exact logic from
Notice how it only displays empty bytes instead of displaying the streamed content (e.g. "Got chunk: b'chunk 0\n'".) This indicates to me that there’s an issue in the logic that runs the Does that make sense? |
Hey @davidzhao, just wanted to follow up on this. Let me know if you need any additional info |
Sending an HTTP stream from the LiveKit agent to a FastAPI endpoint results in empty chunks being sent to the FastAPI endpoint. This issue occurs in the latest version of
livekit-agents
, which is0.12.3
.This issue can be reproduced by setting up a basic LiveKit frontend, voice pipeline agent, and a FastAPI server. The LiveKit agent's
entrypoint
function initiates the stream to the FastAPI server.Steps to reproduce
.env.local
:requirements.txt
and update thelivekit-agents
dependency to:.env.local
file to be the following, and fill in theOPENAI_API_KEY
andDEEPGRAM_API_KEY
:server.py
in the agents repository, and copy and paste this code into it:agent.py
and copy and paste this code into it:http://localhost:3000/
and then click "Start a Conversation"Expected outcome
The FastAPI server should receive the streamed content, causing it to print the following logs:
Actual outcome
The FastAPI server's logs display:
Notice how it only displays empty bytes instead of displaying the streamed content (e.g. "Got chunk: b'chunk 0\n'".)
The text was updated successfully, but these errors were encountered: