In my last article I documented how I created a Speech to Text program using the recent Python 3.14. Unfortunately, I could not continue using 3.14 to create my voice assistant program as a many of the needed systems and imports could only work with Python 3.11.
While creating this program, I faced an issue as my program struggled to connect to Livekit Playground. I tried to search through my program and all seemed fine and it even said it was connected to the Livekit server. I searched through many programmer websites but the problem still prevailed. Atlast I had to consult different AI agents to be able to find a good enough fix.
This article is not really about me overcoming those struggles but me reporting what my code looks like and why this crash might have happened. Again, I am not an expert, but this is just something I faced and thought I should share.
I would also like to state that as I am writing this I am working on finding a better solution.
Code
My program using 3 subfiles including a .env file.
First I had to download the ai interface for my program which gave me these results.
After I had to built my different subfiles; Main.py, api.py and lastly my .env file
Below is what each file looks like.
api.py



.ENV
My .env file was where I kept the main ID information for my program so it can connect to Livekit.

LIVEKIT_URL="wss://voice-assistant-82c4icyf.livekit.cloud"
LIVEKIT_API_KEY="APIRJ4HQfsj7Ppf"
LIVEKIT_API_SECRET="czRgEWYaTS0LmcUe9AvqqO7NXMJu8CaivtCWh9fyOxB"
OPENAI_API_KEY="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"
Main.py
Now for my main.



Main was where the real problem lies. I used the AI agent in VS Code the most for the part, and this was my response.

Although my LiveKit server is able to say it's connected it doesn't really act like it is.

Analysis
Through the research that I did, I believe that due to the difference in many of the system being used from previous tutorials, and LiveKit constant updates, this might have led to a crash on one end. Either that or I might have unkowingly included something that might have crashed my program.