File "C:\Users\ASUS TUF\Desktop\works\123 livekit\...
# ask-ai
r
File "C:\Users\ASUS TUF\Desktop\works\123 livekit\.venv\Lib\site-packages\livekit\agents\ipc\job_proc_lazy_main.py", line 240, in _traceable_entrypoint await self._job_entrypoint_fnc(job_ctx) File "C:\Users\ASUS TUF\Desktop\works\123 livekit\src\front_office_robot\realtime_reply_with_sound.py", line 363, in entrypoint def on_agent_state_changed(ev: AgentStateChangedEvent): ^^^^^^^^^^^^^^^^^^^^^^ NameError: name 'AgentStateChangedEvent' is not defined
t
Thanks for reaching out, Av. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
You're seeing a Python NameError because
AgentStateChangedEvent
isn't defined in your file. Add the import at the top of your module. Suggested fix:
Copy code
from livekit.agents import AgentStateChangedEvent
Then keep your handler:
Copy code
def on_agent_state_changed(ev: AgentStateChangedEvent):
    ...
If you still get errors after adding the import, tell me the top of your file (your current imports) and the LiveKit package version so I can check for any API differences. Sources: Turn detection and interruptions | LiveKit Docs