feat(job): expose single_peer_connection in JobContext.connect#5966
Merged
Conversation
The rtc SDK supports `RoomOptions.single_peer_connection` (added in livekit-rtc 1.1.0), but `JobContext.connect` constructs `RoomOptions` internally and never forwarded the flag, so agents had no way to enable single peer connection mode without bypassing the helper. Forward it through like the other connect options. Co-authored-by: Cursor <cursoragent@cursor.com>
|
|
theomonnom
approved these changes
Jun 4, 2026
Member
|
Thanks |
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
rtc.RoomOptionssupportssingle_peer_connection(added tolivekit-rtcin python-sdks#576, shipped inrtc-v1.1.0), butJobContext.connectbuilds itsRoomOptionsinternally and only forwardsencryption,auto_subscribe, andrtc_config. As a result there's no way to enable single peer connection mode from an agent short of bypassingctx.connect()and callingroom.connect()directly (and re-implementingconnect()'s side effects).This forwards
single_peer_connectionthroughJobContext.connectlike the other connection options. Defaults toNone, preserving current behavior (server default = dual peer connection, with graceful fallback).Notes
livekit-agentsalready pinslivekit==1.1.8, so the field is available.connect_timeout(added in the same rtc PR) is also not exposed byJobContext.connect; happy to include it here too if preferred, but kept this PR focused onsingle_peer_connection.Test plan
make check(ruff + typecheck) passesawait ctx.connect(single_peer_connection=True)results in a singleRTCPeerConnectionWritten by Claude Opus 4.8, using Cursor.
Made with Cursor