How should we set up livekit so that local develop...
# ask-ai
a
How should we set up livekit so that local developers do not have agent dispatch causing their jobs to be handled by other workers registered in the room? If there a way to force livekit to use the local worker?
t
Thanks for reaching out, Matt. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
To ensure that local developers use the local worker and avoid agent dispatch to other workers in the room, you have two main options: • Use a Separate Project for Local Development: Set up different LiveKit project credentials for local development. This ensures that your local worker operates independently from production workers. Configure your environment variables as follows: This approach isolates your local development environment from production, preventing real users from being connected to your local worker. ◦ `LIVEKIT_URL`: Pointing to your local or development LiveKit server ◦ `LIVEKIT_API_KEY`: From your development project ◦ `LIVEKIT_API_SECRET`: From your development project • Use Explicit Agent Dispatch: Set the
agent_name
field in your
WorkerOptions
to enable explicit dispatch. For example:
Copy code
opts = WorkerOptions(
    ...
    agent_name="local-dev-agent",
)
When
agent_name
is set, automatic dispatch is disabled. You can then: ◦ Dispatch jobs via API when needed for testing ◦ Configure participant tokens to automatically dispatch your named agent when participants connect ◦ Control exactly which agent handles which rooms The recommended approach is to use separate project credentials for local development, as it provides complete isolation between your development and production environments while maintaining simplicity for local testing. Sources: Deployment and scaling | LiveKit Docs | Agent dispatch | LiveKit Docs | livekit-agents/livekit/agents/worker.py
a
So each developer needs a local project?
t
I don't have the answer you're looking for. You could also try asking your question: • in one of the other Slack channels or • to https://deepwiki.com/livekit/livekit_composite which is trained on all LiveKit source code If you find the answer, please post it here to help others!
a
If I set agent_name to disable automatic dispatch - how do I make sure the job is dispatched?