Agent Not Connecting to Local Environment β€” Unable to Debug

Hi LiveKit Team,

I am testing LiveKit locally and running into an issue where the agent appears to be connected on the frontend, but nothing is being reflected in my local environment. The LiveKit agent session is also not updating on my end.

I am not sure what is causing this, but the agent does not seem to be connecting to my local setup at all.

This is blocking me from debugging and testing any parameter changes locally.

Could you help me understand:

  1. Why the agent shows as connected on the frontend but is not reflecting anything locally?

  2. Why the LiveKit agent session is not updating in my local environment?

  3. What is the correct way to connect and test the agent locally for debugging?

Are you using the same Lk credentials elsewhere? If the agent server is deployed elsewhere and if you are using the same creds in local, The agent may connect to the deployed one instead of the local one causing such behavior. Just a sanity check you can do

1 Like

I have changed nothing, and after 2-3 hours, it again connected to my local, and when I close my local server, it connected to the LiveKit cloud. I don’t know what happened.

If you mean you are testing with uv run agent.py dev and also have an agent with the same name deployed to your cloud account, that might be causing confusion

1 Like

What should I do so that if I am running my agent locally, then the socket should connect from local, while if the local dev server is not running, then it should connect to the cloud.

I am using this cmd
uv run src/agent.py dev

If you connect your agent to a locally running LiveKit server then you should only get conenctions from the local server. But if you Agent is connect to LiveKit cloud then it will become part of the routing pool for that agent name and new calls will be load-balanced across all available agents with that name.