Repository navigation
feat: run the agent with the LiveKit CLI and dispatch to a local-dev deployment - #43
Merged
Merged
Conversation
…deployment The agent script's own dev/console commands and Python's built-in CLI are deprecated in favour of `lk agent dev|console|start` and `python -m livekit.agents`: - `pnpm dev` / `pnpm agent:py:console` use `lk agent dev --deployment local-dev` / `lk agent console` (LiveKit CLI 2.19+) - production start and the Docker CMD use `python -m livekit.agents start src/agent.py` (what `lk agent start` runs) - frontend token route sets `deployment` on the agent dispatch (AGENT_DEPLOYMENT, default local-dev) so tokens reach the dev worker - CI: worker-start smoke test (also inside the Docker image) that fails on deprecation warnings - READMEs / AGENTS.md updated Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013EcAtRg8aYia9VZrTAZ4Av
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Running the agent through its own script (
uv run src/agent.py dev|console|start) is deprecated in favour of the LiveKit CLI (lk agent dev|console|start, CLI 2.19+) and the SDK'spython -m livekit.agents. This follows the currentagent-starter-pythontemplate and matches livekit-examples/mongodb-hacker-starter#59.pnpm devruns the agent withlk agent dev --deployment local-dev, andpnpm agent:py:consoleuseslk agent console.pnpm agent:py:startand the DockerCMDuseuv run -m livekit.agents start src/agent.py, exactly whatlk agent startruns.agent.pykeeps the template's__main__/cli.run_app(server), but nothing documented goes through it anymore. That path emits the "built-in Python CLI is deprecated" DeprecationWarning, which the template's Dockerfile CMD still triggers.lk agent devregisters the worker under a deployment, a randomdev-<hex>unless one is passed (LiveKit CLIresolveDevDeployment), so a frontend token that dispatches to production wouldn't reach it.RoomAgentDispatchhas adeploymentfield (protocol field 4). The token route now sets it toAGENT_DEPLOYMENT(defaultlocal-dev) when the dispatch has none; set it empty to target production (pnpm agent:py:start, Docker, LiveKit Cloud). Added tofrontend/.env.example.--helpchecks (on the runner and inside the Docker image) are replaced by a worker-start smoke test. It runspython -m livekit.agents start src/agent.pyagainst an unreachable server withPYTHONWARNINGS=default, requires "starting worker", and fails on any deprecation warning.Testing
tsc --noEmit, format:check.POST /api/tokeninnext dev(decodedroomConfig.agents):[{"agentName": "agent-py", "metadata": "{\"user_id\":\"67706c17-…\"}", "restartPolicy": "JRP_ON_FAILURE", "deployment": "local-dev", "attributes": {}}]AGENT_DEPLOYMENT=empty it carries"deployment": ""(production).inferedge-moss-coreneeds glibc 2.38), so the worker start, deprecation check and Docker run are covered by CI here.livekit-serverwithlk agent dev --deployment local-dev. The worker registered underlocal-devand received the token's dispatch. A production-deployment token was not delivered to it.🤖 Generated with Claude Code
https://claude.ai/code/session_013EcAtRg8aYia9VZrTAZ4Av