Support LIVEKIT_AGENT_NAME environment variable#1332
Merged
toubatbrian merged 4 commits intomainfrom Apr 28, 2026
Merged
Conversation
Port from python livekit/agents#5571: when agentName is not provided in ServerOptions, fall back to the LIVEKIT_AGENT_NAME environment variable. The /worker HTTP endpoint now reports agent_name_is_env so deployments can tell whether the explicit dispatch name came from code or the environment.
🦋 Changeset detectedLatest commit: 7419378 The changes in this PR will be included in the next version bump. This PR includes changesets to release 26 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
|
…tion cli.ts reconstructs ServerOptions by spreading an existing instance, which caused agentNameIsEnv to flip back to false when the resolved agentName came from LIVEKIT_AGENT_NAME. Accept agentNameIsEnv as an optional constructor parameter so the env-source signal survives re-construction.
theomonnom
approved these changes
Apr 28, 2026
This was referenced Apr 28, 2026
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.
Description
Add support for the
LIVEKIT_AGENT_NAMEenvironment variable to enable explicit agent dispatch. This aligns the TypeScript SDK with the Python SDK's behavior, allowing agents to be dispatched based on a name specified either via configuration or environment variable.Changes Made
agentNameIsEnvboolean field toServerOptionsto track whether the agent name was sourced from the environment variableServerOptionsconstructor to check forLIVEKIT_AGENT_NAMEenvironment variable whenagentNameis not explicitly providedagent_name_is_envfield for proper tracking on the server sideLIVEKIT_AGENT_NAMEto the turbo.json environment variables listWorkerResponseinterface to include the newagent_name_is_envfieldPre-Review Checklist
Testing
Additional Notes
This change includes references to the corresponding Python SDK implementation (livekit-agents/livekit/agents/worker.py) for consistency and maintainability.
https://claude.ai/code/session_01DRRyse5LLFAuvWVf1LuJbr