Port simulation text mode handling#1751
Open
rosetta-livekit-bot[bot] wants to merge 1 commit into
Open
Conversation
|
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
start --simulationflag to disable worker load-limit status changes during simulationsTesting
pnpm exec prettier --check "agents/src/{cli,job,worker}.ts" "agents/src/voice/{agent_activity,agent_session}.ts"pnpm --filter @livekit/agents buildpnpm --filter @livekit/agents lint(warnings only, pre-existing)pnpm --filter @livekit/agents api:check(fails on existing API Extractor limitation:export * as ___indist/index.d.ts)Ported from livekit/agents#6036
Original PR description
What
Worker load limit off under simulation.
lk simulatenow launches the agent with a new--simulationflag (supported on bothpython -m livekit.agents startand the legacy typerstart; hidden from help in the latter). It sets simulation mode onAgentServer:_is_available()always accepts (draining still wins) and_update_worker_status()never reportsWS_FULL, so a run can saturate the agent instead of being throttled byload_threshold. Deliberately not implemented by forcingload_threshold=inf, whichServerOptionsvalidation rejects outside dev mode (and Cloud reverts custom thresholds anyway).Text simulations skip STT/TTS. The simulate worker now stamps
SimulationModeintoSimulationDispatch(agents-private#68).SimulationContext.channelexposes it (unspecified ⇒ TEXT, since older dispatches were all text-only), andAgentSession.start()drops STT/TTS/VAD and disables RoomIO audio I/O when running under a TEXT-mode simulation — they're never initialized or connected, even though the user's code passes them.Forward-compat:
simulation_context()now parses the dispatch withignore_unknown_fields=True, so future dispatch fields don't break older agents.Tests
tests/test_simulation_text_channel.py:_is_available()under full load: rejected normally, accepted in simulation mode, draining still rejectssession.start()under a mocked TEXT-sim job context ends withstt/tts/vad = NoneVerified the protojson produced by the Go worker handler round-trips into
SimulationContext.channel == TEXT, including with unknown future fields injected.Dependencies (draft until released)
Requires a livekit-protocol release containing
SimulationMode(livekit/protocol#1613 via livekit/python-sdks#710) —livekit.agents.__init__importssimulationeagerly, so the package needs the new bindings; bump thelivekit-protocolfloor in pyproject when it ships.Related: livekit/agents-private#68, livekit/cloud-api-server#1892, lk CLI PR (livekit-cli).