docs: add deployment field documentation for agent dispatch#722
Open
xianshijing-lk wants to merge 2 commits into
Open
docs: add deployment field documentation for agent dispatch#722xianshijing-lk wants to merge 2 commits into
xianshijing-lk wants to merge 2 commits into
Conversation
Update docstrings and examples to document the deployment field for agent dispatch. The deployment field allows targeting a specific agent deployment (e.g., "staging"). Leave empty to target the production deployment. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This was referenced Jun 17, 2026
bcherry
approved these changes
Jun 17, 2026
Show deployment as a commented optional parameter within the active example rather than a separate commented-out block. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
xianshijing-lk
added a commit
to livekit/client-sdk-swift
that referenced
this pull request
Jun 17, 2026
## Summary - Add `deployment` field to `RoomAgentDispatch` for targeting specific agent deployments - Add `agentDeployment` to `TokenRequestOptions` to pass deployment through token requests The `deployment` field allows targeting a specific agent deployment (e.g., "staging"). Leave empty to target the production deployment. Related PRs: - node-sdks: livekit/node-sdks#675 - python-sdks: livekit/python-sdks#722 - rust-sdks: livekit/rust-sdks#1176 - client-sdk-js: livekit/client-sdk-js#1971 ## Usage ```swift let options = TokenRequestOptions( roomName: "my-room", agentName: "my-agent", agentDeployment: "staging" // Optional: target specific deployment ) ``` Or directly via `RoomAgentDispatch`: ```swift let dispatch = RoomAgentDispatch( agentName: "my-agent", metadata: "my-metadata", deployment: "staging" ) ``` ## Test plan ### Unit Tests ```bash swift test # Or via Xcode xcodebuild test -scheme LiveKit -destination "platform=iOS Simulator,name=iPhone 15" ``` ### Manual Verification **1. Verify JSON serialization includes deployment:** ```swift let dispatch = RoomAgentDispatch( agentName: "my-agent", deployment: "staging" ) let encoder = JSONEncoder() let data = try encoder.encode(dispatch) let json = String(data: data, encoding: .utf8)! print(json) // Should include "deployment": "staging" ``` **2. Verify TokenRequestOptions converts to request correctly:** ```swift let options = TokenRequestOptions( roomName: "test-room", agentName: "my-agent", agentDeployment: "staging" ) let request = options.toRequest() print(request.roomConfiguration?.agents?.first?.deployment) // Should print "staging" ``` **3. Verify token contains deployment (with TokenSource):** ```swift let response = try await tokenSource.fetch(TokenRequestOptions( roomName: "test-room", agentName: "my-agent", agentDeployment: "staging" )) if let jwt = response.jwt(), let agents = jwt.roomConfiguration?.agents { print("Deployment: \(agents.first?.deployment ?? "nil")") } ``` ### End-to-End Verification 1. Use TokenSource to get credentials with deployment 2. Connect to room - agent with matching deployment should join 3. Verify only staging agent receives the dispatch 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> Co-authored-by: Błażej Pankowski <86720177+pblazej@users.noreply.github.com>
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.
Summary
deploymentfield increate_dispatchdeploymentfield for both explicit dispatch and token-based dispatchThe
deploymentfield allows targeting a specific agent deployment (e.g., "staging"). Leave empty to target the production deployment.Related PRs:
deploymenttoCreateDispatchOptionsnode-sdks#675Test plan
Unit Tests
cd /path/to/python-sdks pytest tests/api/test_access_token.py -vManual Verification
1. Verify deployment field is sent in request:
2. Verify via list_dispatch:
3. Verify server rejects invalid deployment:
4. Verify token-based dispatch includes deployment:
End-to-End Verification
deployment="staging"deployment="staging"🤖 Generated with Claude Code