full-florist-90228
02/13/2025, 7:31 AMgit clone <https://github.com/livekit-examples/multimodal-agent-python.git>
cd multimodal-agent-python
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
cp .env.example .env.local
I filled in the .env.local
file with the URL, API_KEY, and API_SECRET obtained from the LiveKit Web Console.
I also ensured that the OPENAI_API_KEY is correctly set.
When I run python3 agent.py dev
, I get the following error:
python agent.py dev
2025-02-13 16:12:08,612 - DEBUG asyncio - Using selector: EpollSelector
2025-02-13 16:12:08,613 - DEV livekit.agents - Watching /home/noah/ghq/github.com/livekit-examples/multimodal-agent-python
2025-02-13 16:12:09,115 - DEBUG asyncio - Using selector: EpollSelector
2025-02-13 16:12:09,118 - INFO livekit.agents - starting worker {"version": "0.12.12", "rtc-version": "0.20.0"}
2025-02-13 16:12:09,433 - WARNING livekit.agents - failed to connect to livekit, retrying in 0s: 401, message='Invalid response status', url='<wss://my-first-ai-voice-agent-f84md5vr.livekit.cloud/agent>'
2025-02-13 16:12:09,476 - WARNING livekit.agents - failed to connect to livekit, retrying in 2s: 401, message='Invalid response status',
...
I've double-checked the URL, API_KEY, and API_SECRET multiple times, and they are correct.
Is there anything I might be missing? Could you provide any insights into possible causes of this issue?
Any help would be greatly appreciated!gray-monkey-83525
02/13/2025, 7:31 AM.env.local
file. According to LiveKit Docs, the access token must be JWT-based and signed with your API secret. Double-check that the token is generated correctly and not expired. Also, verify that the LIVEKIT_URL
is correct and does not include any trailing paths like /agent
.
If the issue persists, try generating a new API key and secret from the LiveKit console, as sometimes keys may need refreshing. Additionally, ensure that your system clock is synchronized, as time discrepancies can affect token validation.
Would you like more detailed troubleshooting steps?
Sources:
- LiveKit Authentication
- LiveKit Slack Discussion š 1 button š 0 button š” Hint: Mention @millions-hair-24956 in the thread for followups.full-florist-90228
02/13/2025, 7:55 AM.env.local
file, but the same error persists.
⢠I have verified that the API_KEY/API_SECRET were copied correctly and that there are no expiration issues.
⢠The LIVEKIT_URL was copied directly from the LiveKit Web Console and does not include any extra paths like /agent
.
⢠The system clock is accurate, with no discrepancies beyond a few seconds.
Is it possible to receive a 401 error even when the authentication credentials are correct?gray-monkey-83525
02/13/2025, 7:55 AM.env.local
file is correctly loaded. You can print the environment variables in your script to confirm they are being read correctly.
2. Token Generation: Verify that the token is generated with the correct permissions. The token should include the necessary grants for the actions you intend to perform, such as joining a room or publishing tracks.
3. Network Issues: Check for any network-related issues that might be affecting the connection to the LiveKit server. Sometimes, proxies or firewalls can interfere with the connection.
4. Server Configuration: Ensure that the LiveKit server is correctly configured to accept connections from your client. This includes checking any IP whitelisting or security settings.
Would you like more detailed troubleshooting steps or a code snippet to verify the environment variables?
Sources:
- LiveKit Slack Discussion š 0 button š 0 button š” Hint: Mention @runllm in the thread for followups.full-florist-90228
02/14/2025, 2:24 AM