big-school-62939
04/07/2026, 1:21 PMtall-airline-16756
04/07/2026, 1:21 PMtall-airline-16756
04/07/2026, 1:22 PMagent_name you set in the @server.rtc_session decorator, so each agent just needs a unique agent_name for dispatch.
If helpful, quick guidance:
• For small projects or closely related agents, keeping them in one file is fine.
• For clarity and maintainability, split agents into separate files (modules) by responsibility.
• Ensure your dispatch/entry logic references the correct agent_name.
If you'd like, share a snippet of your current code and your planned agent responsibilities and I can suggest a concrete file layout.
Sources: Avoiding crosstalk when multiple developers share a LiveKit project | LiveK... | Agent dispatch | LiveKit Documentation, with interactive elementsbig-school-62939
04/07/2026, 4:29 PMtall-airline-16756
04/07/2026, 4:29 PMproject/
├── agents/
│ ├── __init__.py
│ ├── agent_server.py # shared AgentServer / server instance
│ ├── intake/
│ │ ├── __init__.py
│ │ ├── agent.py # @server.rtc_session(agent_name="intake-agent")
│ │ └── test.py # local/console tests for intake agent
│ └── billing/
│ ├── __init__.py
│ ├── agent.py # @server.rtc_session(agent_name="billing-agent")
│ └── test.py # local/console tests for billing agent
├── dispatch_rules.yaml # optional: mapping agent_name -> rules
└── pyproject.toml / requirements.txt
Key points and practices
• Use one shared AgentServer (or server instance) defined in agent_server.py and import it into each agent.py. Agents are identified by their agent_name in @server.rtc_session(...), not by filename.
• Keep each agent’s logic and tests inside its own folder to allow independent development and clear responsibilities.
• For local testing, run the per-agent test script or use console mode to exercise the agent without LiveKit dispatch.
• For dispatching, specify the exact agent_name when creating tokens or routing so jobs go to the correct agent handler.
• Use env vars or CLI flags in test.py to control which agent runs in dev, and deploy multiple workers with the same agent_name for production scale.
If you want, share your current repo layout or one agent’s agent.py and I’ll suggest a concrete refactor and a sample test.py you can run locally.
Sources: Build Your First AI Voice Agent in Python: Complete Tutorial | LiveKit | Agents and handoffs | LiveKit Documentation | Avoiding crosstalk when multiple developers share a LiveKit project | LiveK... | Avoiding crosstalk when multiple developers share a LiveKit project | LiveK... | Agents Framework | livekit/livekit_composite | DeepWiki, with interactive elements