C:\Users\AaronFrancis\Desktop\my work\vscode\main ...
# ask-ai
l
C:\Users\AaronFrancis\Desktop\my work\vscode\main tasks\livekit\agent_deploy\IT-helpdesk-agent\IT_backend_python>python agent.py dev Traceback (most recent call last): File "C:\Users\AaronFrancis\Desktop\my work\vscode\main tasks\livekit\agent_deploy\IT-helpdesk-agent\IT_backend_python\agent.py", line 9, in <module> from livekit.agents.utils import tool ImportError: cannot import name 'tool' from 'livekit.agents.utils' (C:\Users\AaronFrancis\AppData\Local\Programs\Python\Python313\Lib\site-packages\livekit\agents\utils\__init__.py)
t
Thanks for reaching out, Computer. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
It looks like the error is happening because the module
tool
isn’t actually part of
livekit.agents.utils
. No worries though! To fix this, you just need to update your imports to the right module. Here are a couple of ways you can do that: • Primary Method (Recommended):
from livekit.agents import function_tool, FunctionTool
• Alternative Direct Import:
from livekit.agents.llm.tool_context import FunctionTool, function_tool, ToolError
Also, to make sure everything runs smoothly, it’s a good idea to have the latest version of LiveKit Agents installed. You can update it by running:
Copy code
pip install --upgrade livekit-agents
If you run into any more questions or need a hand with anything else, just let me know—I’m here to help! Sources: livekit-agents/livekit/agents/utils/__init__.py | Tool definition and use | LiveKit Docs | Still Have Questions