Skip to content

feat(job): expose single_peer_connection in JobContext.connect#5966

Merged
theomonnom merged 1 commit into
livekit:mainfrom
renal128:expose-single-peer-connection
Jun 4, 2026
Merged

feat(job): expose single_peer_connection in JobContext.connect#5966
theomonnom merged 1 commit into
livekit:mainfrom
renal128:expose-single-peer-connection

Conversation

@renal128

@renal128 renal128 commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Summary

rtc.RoomOptions supports single_peer_connection (added to livekit-rtc in python-sdks#576, shipped in rtc-v1.1.0), but JobContext.connect builds its RoomOptions internally and only forwards encryption, auto_subscribe, and rtc_config. As a result there's no way to enable single peer connection mode from an agent short of bypassing ctx.connect() and calling room.connect() directly (and re-implementing connect()'s side effects).

This forwards single_peer_connection through JobContext.connect like the other connection options. Defaults to None, preserving current behavior (server default = dual peer connection, with graceful fallback).

await ctx.connect(single_peer_connection=True)

Notes

  • livekit-agents already pins livekit==1.1.8, so the field is available.
  • The sibling option connect_timeout (added in the same rtc PR) is also not exposed by JobContext.connect; happy to include it here too if preferred, but kept this PR focused on single_peer_connection.

Test plan

  • make check (ruff + typecheck) passes
  • await ctx.connect(single_peer_connection=True) results in a single RTCPeerConnection

Written by Claude Opus 4.8, using Cursor.

Made with Cursor

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>
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 1 additional finding.

Open in Devin Review

@theomonnom

Copy link
Copy Markdown
Member

Thanks

@theomonnom theomonnom merged commit a713c37 into livekit:main Jun 4, 2026
16 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants