Hello, I am new to Livekit and trying to get a bet...
# server-api
m
Hello, I am new to Livekit and trying to get a better understanding on how to do the following. Participant calls a Twilio number and through Livekit SIP integration gets put into a room. Through Webhook to a python API, we are adding an agent to the room. Using the room.connect(), agents.AgentSession() and agents.AgentSesison().start() to get the agent room and it is all working. However, I want to use the MultilingualModel() for turn_detection instead of VAD When using MultilingualModel() I am getting the following error : no job context found, are you running this code inside a job entrypoint? How can I solve this issue? Any help is much appreciated.
r
Do you have agent code I can run that reproduces this? Did you run
download-files
before starting the agent the first time?
m
@refined-appointment-81829, thank you for your quick response. Currently the code is part of a larger application, let me see whether I can create a standalone snippet to reproduce the issue. Here is some more details about the solution I am trying to build • User calls a Twilio number, which gets forwarded to Livekit through a TiwML SIP integration. • LiveKit SIP dispatch rule puts the user in a unique room. • LiveKit webhook is configured to notify a Python FastAPI application about room creation event. • The python application uses the room name in the room creation event to add an Agent to the room, create a session, and runs the session as mentioned before. I am not using the CLI to register workers with LiveKit server or running download-files in the application. The Python application is running in a docker container in a hosted environment. It is only adding an agent to the room once a user calls through the phone number and gets set up in a room. This set up is working fine with VAD as the turn detector. However, the turn detection is not optimal and I wanted to try MultilingualModel for turn detection. I am using deepgram as the STT plugin for the session. Let me know whether I should be using Livekit in a different way for this solution.
r
This is not how the Agents framework works. • LiveKit webhook is configured to notify a Python FastAPI application about room creation event. • The python application uses the room name in the room creation event to add an Agent to the room, create a session, and runs the session as mentioned before. You should not run agent code in a FastAPI container
Or do you mean that is doing a dispatch?
m
@refined-appointment-81829, thanks for your response. I had to go back to the docs and do some more research, but I now have a better understanding of how to deploy the agent code. I now have it running on LiveKit cloud with the agent getting dispatched from my FastAPI application in response to Webhook. Everything is now working fine. Only issue I am noticing is that the worker goes to "sleep" after some delay and next dispatch takes a long time. Is this because I am on the free usage tier? Is there a way to remove this cold start delay?
r
Which plan are you on?
I thought that only happened on the free plan