I am trying to develop a voice bot with ollama and...
# ask-ai
p
I am trying to develop a voice bot with ollama and livekit in local. But I am getting the below error in windows 2025-10-07 113832,542 - INFO livekit.agents - starting worker {"version": "1.2.14", "rtc-version": "1.0.13"} 2025-10-07 113832,542 - INFO livekit.agents - starting inference executor 2025-10-07 113832,885 - INFO livekit.agents - initializing process {"pid": 36416, "inference": true} 2025-10-07 113842,070 - DEBUG livekit.agents - initializing inference runner {"runner": "lk_end_of_utterance_multilingual", "pid": 36416, "inference": true} 2025-10-07 113842,896 - INFO livekit.agents - killing process {"pid": 36416, "inference": true} 2025-10-07 113842,897 - ERROR livekit.agents - worker failed Traceback (most recent call last): File "C:\system\MachineLearning\livekit_ollama\livekit\lib\site-packages\livekit\agents\ipc\channel.py", line 47, in arecv_message return _read_message(await dplx.recv_bytes(), messages) File "C:\system\MachineLearning\livekit_ollama\livekit\lib\site-packages\livekit\agents\utils\aio\duplex_unix.py", line 35, in recv_bytes len_bytes = await self._reader.readexactly(4) File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\asyncio\streams.py", line 708, in readexactly await self._wait_for_data('readexactly') File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\asyncio\streams.py", line 501, in _wait_for_data await self._waiter asyncio.exceptions.CancelledError During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\asyncio\tasks.py", line 456, in wait_for return fut.result() asyncio.exceptions.CancelledError The above exception was the direct cause of the following exception: Traceback (most recent call last): File "C:\system\MachineLearning\livekit_ollama\livekit\lib\site-packages\livekit\agents\cli\_run.py", line 79, in _worker_run await worker.run() File "C:\system\MachineLearning\livekit_ollama\livekit\lib\site-packages\livekit\agents\worker.py", line 403, in run await self._inference_executor.initialize() File "C:\system\MachineLearning\livekit_ollama\livekit\lib\site-packages\livekit\agents\ipc\supervised_proc.py", line 169, in initialize init_res = await asyncio.wait_for( File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\asyncio\tasks.py", line 458, in wait_for raise exceptions.TimeoutError() from exc asyncio.exceptions.TimeoutError
t
Thanks for reaching out, vabosa7883. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Could you please share a bit more about your setup? It would be really helpful to know: • Which versions of LiveKit and Ollama you’re currently using? • Are you running this in a specific environment, like a virtual environment or Docker? • Have you made any custom configurations or changes from the default setup? • Does this error happen every time or just sometimes under certain conditions? With these details, I’ll be better equipped to help you troubleshoot this. Looking forward to your reply!
p
this is my code import logging from dotenv import load_dotenv from livekit.agents import ( Agent, AgentSession, JobContext, JobProcess, RoomInputOptions, RoomOutputOptions, RunContext, WorkerOptions, cli, metrics, ) from livekit.agents.llm import function_tool from livekit.agents.voice import MetricsCollectedEvent from livekit.plugins import deepgram, openai, silero, cartesia from livekit.plugins.turn_detector.multilingual import MultilingualModel # uncomment to enable Krisp background voice/noise cancellation # currently supported on Linux and MacOS # from livekit.plugins import noise_cancellation logger = logging.getLogger("basic-agent") load_dotenv() class MyAgent(Agent): def __init__(self) -> None: super().__init__( instructions="Your name is Kelly. You would interact with users via voice." "with that in mind keep your responses concise and to the point." "You are curious and friendly, and have a sense of humor.", ) async def on_enter(self): # when the agent is added to the session, it'll generate a reply # according to its instructions self.session.generate_reply(instructions="greet the user and ask about their day") def prewarm(proc: JobProcess): proc.userdata["vad"] = silero.VAD.load() async def entrypoint(ctx: JobContext): # each log entry will include these fields ctx.log_context_fields = { "room": ctx.room.name, "user_id": "your user_id", } await ctx.connect() session = AgentSession( vad=ctx.proc.userdata["vad"], # any combination of STT, LLM, TTS, or realtime API can be used #llm=openai.LLM(model="gpt-4o-mini"), llm=openai.LLM.with_ollama( base_url="http://localhost:11434/", #model="hf.co/DavidAU/Llama-3.2-8X3B-MOE-Dark-Champion-Instruct-uncensored-abliterated-18.4B-GGUF:IQ4_XS" model="qwen2.5:3b", ), stt=deepgram.STT(model="nova-3", language="multi"), tts=cartesia.TTS(), # use LiveKit's turn detection model turn_detection=MultilingualModel(), ) # log metrics as they are emitted, and total usage after session is over usage_collector = metrics.UsageCollector() @session.on("metrics_collected") def _on_metrics_collected(ev: MetricsCollectedEvent): metrics.log_metrics(ev.metrics) usage_collector.collect(ev.metrics) async def log_usage(): summary = usage_collector.get_summary() logger.info(f"Usage: {summary}") # shutdown callbacks are triggered when the session is over ctx.add_shutdown_callback(log_usage) # wait for a participant to join the room await ctx.wait_for_participant() await session.start( agent=MyAgent(), room=ctx.room, room_input_options=RoomInputOptions( # uncomment to enable Krisp BVC noise cancellation # noise_cancellation=noise_cancellation.BVC(), ), room_output_options=RoomOutputOptions(transcription_enabled=True), ) if name == "__main__": cli.run_app(WorkerOptions(entrypoint_fnc=entrypoint, prewarm_fnc=prewarm))
t
Thank you so much for sharing the code! To help you better, could you please clarify a few things for me? • Are you running this on a specific Python version? If yes, which one? • Have you checked that all dependencies (like LiveKit, Ollama, Deepgram, etc.) are installed and compatible with your setup? • Are there any network restrictions or firewall settings that might be affecting the connection to Ollama or other services? • Does the error happen right when you start the application, or after doing something specific? Your answers will really help me understand the issue better and find the best solution for you.
p
python version - Python 3.10.11 • Have you checked that all dependencies (like LiveKit, Ollama, Deepgram, etc.) are installed and compatible with your setup? - Yes • Are there any network restrictions or firewall settings that might be affecting the connection to Ollama or other services? There is no firewall restriction but the code is not ran in admin mode • Does the error happen right when you start the application, or after doing something specific? Error occurring during start of the script
t
I don't have the answer you're looking for. You could also try asking your question: • in one of the other Slack channels or • to https://deepwiki.com/livekit/livekit_composite which is trained on all LiveKit source code If you find the answer, please post it here to help others!