LiveKit Agents SDK latest version? <@U07FRRZH2GN>
# ask-ai
f
LiveKit Agents SDK latest version? @icy-policeman-64898
t
Thanks for reaching out, Abhishek. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Here are the latest versions of the LiveKit Agents SDK for you: • Python SDK: 1.2.18 • Node.js SDK: 1.0.16 If you have any more questions or need a hand with anything else, please don’t hesitate to reach out. I’m here to help! Sources: livekit-agents/livekit/agents/version.py | plugins/livekit/CHANGELOG.md | Models | LiveKit Docs | livekit/livekit_composite | DeepWiki | livekit/livekit_composite | DeepWiki
f
Hiw can i upgrade from LiveKit Agents SDK 1.2.11 to LiveKit Agents SDK 1.2.8 and will it support python 3.13.5?
t
To help you smoothly upgrade from LiveKit Agents SDK 1.2.11 to 1.2.18, here’s a simple guide you can follow: 1. First, update your
requirements.txt
or
pyproject.toml
file to specify
livekit-agents>=1.2.18
. 2. Next, run the command
pip install --upgrade livekit-agents
to download and install the latest version. About Python 3.13.5 compatibility — the SDK supports Python versions starting from 3.9 and includes compatibility markers for Python 3.13 and above. While 3.13.5 isn’t specifically listed, it falls within this supported range, so it should work well. That said, I’d recommend giving your specific setup a test run after upgrading, just to be sure everything runs smoothly. If you have any questions or need a hand with the upgrade or testing, please don’t hesitate to reach out. I’m here to help! Sources: Agents v0.x migration guide - Python | LiveKit docs | uv.lock
f
(.venv_new) PS D:\Tharun-09-sep\backend> python .\agent.py dev Traceback (most recent call last): File "D:\Tharun-09-sep\backend\agent.py", line 19, in <module> from livekit.agents import ( ...<11 lines>... ) File "D:\Tharun-09-sep\backend\.venv_new\Lib\site-packages\livekit\agents\__init__.py", line 23, in <module> from . import cli, inference, ipc, llm, metrics, stt, tokenize, tts, utils, vad, voice File "D:\Tharun-09-sep\backend\.venv_new\Lib\site-packages\livekit\agents\cli\__init__.py", line 1, in <module> from .cli import AgentsConsole, run_app File "D:\Tharun-09-sep\backend\.venv_new\Lib\site-packages\livekit\agents\cli\cli.py", line 47, in <module> from ..worker import AgentServer, WorkerOptions File "D:\Tharun-09-sep\backend\.venv_new\Lib\site-packages\livekit\agents\worker.py", line 30, in <module> from multiprocessing.context import ForkServerContext ImportError: cannot import name 'ForkServerContext' from 'multiprocessing.context' (C:\Users\abhis\AppData\Local\Programs\Python\Python313\Lib\multiprocessing\context.py) (.venv_new) PS D:\Tharun-09-sep\backend> above si the error i am facing
t
I'm sorry you're encountering the error
ImportError: cannot import name 'ForkServerContext' from 'multiprocessing.context'
. This happens because the LiveKit Agents SDK uses the
"spawn"
multiprocessing context, which works across different platforms and avoids Unix-specific contexts like
ForkServerContext
. Let's walk through some steps together to help resolve this: 1. First, please check if your code or any dependencies are directly importing
ForkServerContext
. If so, try replacing those imports with
multiprocessing.get_context("spawn")
. 2. Next, you can explicitly set the start method in your code by adding:
Copy code
import multiprocessing as mp
mp.set_start_method('spawn', force=True)
3. It’s also a good idea to verify your environment: ◦ Run
python --version
to make sure you’re using a standard CPython distribution. ◦ Check for any conflicting dependencies by running
pip freeze
and updating packages that might affect multiprocessing, like
torch
or
transformers
. 1. If things are still not working, try recreating your virtual environment to clear out any corrupted files or partial installations. If you’d like, feel free to share the output of
pip freeze
and some details about your setup—such as your OS, Python version, and whether you’re using Docker or a serverless environment. I’m here to help you get this sorted! Sources: livekit-plugins/livekit-plugins-aws/livekit/plugins/aws/__init__.py | Troubleshooting & Common Issues | livekit/livekit_composite | DeepWiki | Still Have Questions
f
(.venv_new) PS D:\Tharun-09-sep\backend> python .\agent.py dev 132654 CRITI… voice-agent Agent process failed with a critical error: Event loop is closed Traceback (most recent call last): File "D:\Tharun-09-sep\backend\agent.py", line 1199, in <module> cli.run_app(worker_options) ~~~~~~~~~~~^^^^^^^^^^^^^^^^ File "D:\Tharun-09-sep\backend\.venv_new\Lib\site -packages\livekit\agents\cli\cli.py", line 1541, in run_app _build_cli(server)() ~~~~~~~~~~~~~~~~~~^^ File "D:\Tharun-09-sep\backend\.venv_new\Lib\site -packages\typer\main.py", line 327, in call raise e File "D:\Tharun-09-sep\backend\.venv_new\Lib\site -packages\typer\main.py", line 310, in call return get_command(self)(*args, **kwargs) ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^ ^ File "D:\Tharun-09-sep\backend\.venv_new\Lib\site -packages\click\core.py", line 1462, in call return self.main(*args, **kwargs) ~~~~~~~~~^^^^^^^^^^^^^^^^^ File "D:\Tharun-09-sep\backend\.venv_new\Lib\site -packages\typer\core.py", line 803, in main return _main( self, ...<6 lines>... **extra, ) File "D:\Tharun-09-sep\backend\.venv_new\Lib\site -packages\typer\core.py", line 192, in _main rv = self.invoke(ctx) File "D:\Tharun-09-sep\backend\.venv_new\Lib\site -packages\click\core.py", line 1850, in invoke return _process_result(sub_ctx.command.invoke(sub_c tx)) ~~~~~~~~~~~~~~~~~ ~~~~~^^^^^^^^^ File "D:\Tharun-09-sep\backend\.venv_new\Lib\site -packages\click\core.py", line 1246, in invoke return ctx.invoke(self.callback, **ctx.params) ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^ File "D:\Tharun-09-sep\backend\.venv_new\Lib\site -packages\click\core.py", line 814, in invoke return callback(*args, **kwargs) File "D:\Tharun-09-sep\backend\.venv_new\Lib\site -packages\typer\main.py", line 691, in wrapper return callback(**use_params) File "D:\Tharun-09-sep\backend\.venv_new\Lib\site -packages\livekit\agents\cli\cli.py", line 1482, in dev loop.run_until_complete(_run_loop()) ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^ File "C:\Users\abhis\AppData\Local\Programs\Pytho n\Python313\Lib\asyncio\base_events.py", line 700, in run_until_complete self._check_closed() ~~~~~~~~~~~~~~~~~~^^ File "C:\Users\abhis\AppData\Local\Programs\Pytho n\Python313\Lib\asyncio\base_events.py", line 556, in _check_closed raise RuntimeError('Event loop is closed') RuntimeError: Event loop is closed D\Tharun 09 sep\backend\agent.py1201: RuntimeWarning: coroutine '_build_cli.<locals>.dev.<locals>._run_loop' was never awaited logger.critical(f"Agent process failed with a critical error: {e}", exc_info=True) RuntimeWarning: Enable tracemalloc to get the object allocation traceback (.venv_new) PS D:\Tharun-09-sep\backend>
t
I'm sorry you're encountering the
RuntimeError: Event loop is closed
issue. This usually happens when asynchronous operations are attempted after the event loop has already been closed. It often occurs if components like
VADStream
,
RecognizeStream
, or
SentenceStream
are used after they've been closed. Let's walk through some steps that might help you resolve this: 1. Make sure you're not calling methods like
push_frame()
on a stream after
aclose()
has been called. Using context managers (like
async with
) can really help manage the lifecycle of these components smoothly. 2. Check that all your agent logic finishes before the event loop shuts down. The
worker.run()
method should take care of cleanup, including calling
drain()
and
aclose()
on the worker instance. 3. If you want to restart functionality after the event loop has closed, try creating new instances of components tied to a fresh event loop. 4. Review your code to ensure no asynchronous calls happen after the agent session's
close
event has been emitted. If you're still running into trouble, please take another look for any operations on closed streams or event loops, and don’t hesitate to reach out—I’m here to help you through this! Sources: livekit-agents/livekit/agents/cli/watcher.py | Events and error handling | LiveKit docs