fix(voice): treat silent agent turns as successful - #2258
Open
rosetta-livekit-bot[bot] wants to merge 3 commits into
Open
fix(voice): treat silent agent turns as successful#2258rosetta-livekit-bot[bot] wants to merge 3 commits into
rosetta-livekit-bot[bot] wants to merge 3 commits into
Conversation
🦋 Changeset detectedLatest commit: 04ba245 The changes in this PR will be included in the next version bump. This PR includes changesets to release 39 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
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
run_inputerrorRemoteSession,SessionHost, andAgentSession@livekit/agentsPorts livekit/agents#6779.
Source diff coverage
livekit-agents/livekit/agents/voice/remote_session.py: Adapted toagents/src/voice/remote_session.ts. Removed the equivalent empty-items error guard and ported the source explanation using TypeScript naming and comment style.tests/test_run_input_errors.py: Adapted toagents/src/voice/remote_session.test.ts. Ported the source-added silent-turn test into the target's existing colocated remote-session suite, using its paired in-memory transports, JSFakeLLM, andRemoteSession.sendMessagecounterpart. The assertion remains that the response item list is empty and no error is raised.Validation
pnpm test agents(115 files, 1,589 passed, 5 skipped)pnpm --filter @livekit/agents buildpnpm --filter @livekit/agents lint(passes with existing warnings)pnpm exec prettier --check agents/src/voice/remote_session.ts agents/src/voice/remote_session.test.ts .changeset/silent-agent-turns.mdcue-clitext-mode runtime assertion with an intentionally silent dispatched agent: no error event and no assistant conversation itemPorted from livekit/agents#6779
Original PR description
Problem
SessionHostturns a run that produced no chat items into an error:The caller sees it as a raised
RuntimeError, so the turn — and, in simulations, the whole job — is scored as an agent failure.An empty turn is a legitimate outcome. An LLM can return a completion with no text and no tool calls, and every item-add site in
agent_activityis guarded on non-empty text (if forwarded_text:), so nothing lands in the chat context or inRunResult.events.Agents that induce this on purpose hit it reliably. A close-the-call tool whose output tells the model it has already said goodbye and should now say nothing gets exactly that:
Agent-side traces for that turn confirm the model, not the framework, produced the silence:
One output token, empty response text, no tool call, not interrupted — and the transcript up to that point is complete and correct.
Fix
Report the empty item list and let the caller decide what the silence means. Simulation drivers already model a silent turn explicitly, so they can end the call cleanly instead of failing it.
Test
test_run_silent_turn_is_not_an_errordrives a realAgentSessionwhose LLM returns an empty completion throughSessionHost→RemoteSession. Without the fix it fails with the exact production error: