Repository navigation
perf(agents): prepare audio publication during native async connect - #8746
Draft
xianshijing-lk wants to merge 8 commits into
Draft
xianshijing-lk wants to merge 8 commits into
xianshijing-lk wants to merge 8 commits into
Conversation
This was referenced Nov 23, 2026
|
|
||
|
|
||
| def write_mark(path: Path, name: str, **fields): | ||
| with path.open("a") as f: |
This branch has not been deployed
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.
Session startup can describe its audio publication before connecting and initialize activity/greeting generation concurrently. The audio output now passes only its source, name and complete publication options; native track creation happens inside Rust's asynchronous connect task, keeping cold native setup off the Python event loop. After connect, output adopts the returned track/publication instead of publishing twice.
AgentSession's public API is unchanged. JobContext.connect adds publish_audio_tracks while retaining publish_tracks; older RTC wheels retain ordinary publication. The output preserves subscription waiting, name changes and normal publication fallback. The application example starts connection/activity/output concurrently and generates its greeting from on_enter.
Dependencies: livekit/python-sdks#963 and livekit/rust-sdks#1732, stacked on Rust #1704. Supporting single-PC servers use Rust's existing JOIN path; other configurations retain fallback publication.
Validation: 160 RoomIO/startup/translation tests passed. Companion validation: 23 focused RTC tests, 13 staging integration tests, native build/format and 39 FFI unit tests. Coverage includes source-description forwarding, adoption without synchronous creation, single/dual PC, repeated destruction, cancellation, rejection and partial invalid input.
Latest paired staging benchmark compares the previous synchronous-preparation PR implementation with this native preparation fix: 24 measured browser sessions plus six warmups; median ICE RTT 62 ms; all received non-silent audio and message acknowledgements, all warm processes and clean shutdowns.
Activity-start delay fell from 102.1 to 3.8 ms. In the delayed-activity case, ready UI and first message acknowledgement improved by about 124 ms each. This resolves the preparation regression found by the earlier pre/post study. Both arms already publish on JOIN, so it does not measure the two-RTT signaling saving. Immediate startup still waits on subscription/media readiness. Synthetic greetings and asynchronous delays are used; real LLM/TTS timing remains unverified.
Evidence, samples, recordings and reproduction: native preparation report. The earlier actual pre-PR and native signaling reports remain available and clearly identify their versions and limitations.