feat(stt): add stt context options#2058
Merged
Merged
Conversation
🦋 Changeset detectedLatest commit: b5c231d The changes in this PR will be included in the next version bump. This PR includes changesets to release 37 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 |
Validate explicit AssemblyAI context atomically, truncate automatic carryover safely, and cover session forwarding controls and cleanup. Co-authored-by: Cursor <cursoragent@cursor.com>
Derive inference forwarding support solely from the selected model while retaining session opt-out controls and dynamic listener lifecycle behavior. Co-authored-by: Cursor <cursoragent@cursor.com>
toubatbrian
force-pushed
the
backer-toughest-spirally
branch
from
July 20, 2026 21:54
7a0c614 to
b5c231d
Compare
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
Ports livekit/agents#6475 to agents-js as the upper stack on PR #2057:
sttContextOptionswithkeyterms,keytermDetection, andforwardChatContext.keytermsOptionsmapped to the new STT context shape.forwardChatContext.@livekit/agents.Source diff coverage
Coverage table
examples/voice_agents/basic_agent.pyexamples/src/basic_agent.ts: renamedkeytermsOptionstosttContextOptionsin the matching example.livekit-agents/livekit/agents/__init__.pyandvoice/__init__.pySTTContextOptionsis exported publicly.livekit-agents/livekit/agents/inference/stt.pyagents/src/inference/stt.ts: the lower stack's temporary inference carryover flag is removed; capability follows AssemblyAI U3 Pro model support and refreshes on model changes.livekit-agents/livekit/agents/voice/agent_activity.pyagents/src/voice/agent_activity.ts: forwarding is gated bysttContextOptions.forwardChatContext, with listener cleanup.livekit-agents/livekit/agents/voice/agent_session.pyandkeyterm_detection.pylivekit-plugins/.../assemblyai/stt.pyplugins/assemblyai/src/stt.ts: U3 Pro carryover, deprecated plugin compatibility warnings, 1,750-character validation, automatic tail truncation, and failure atomicity.No source diff files were omitted.
Validation
interim-prevue-pate/ PR Support AssemblyAI inference context carryover #2057 at0eebde463c7ab84705ff644327b77bf566de5758.b5c231d283cae2d23136238062878d331e37e9fa.Cue voice E2E
Forwarding session:
sid_95490732184e.b5c231d283cae2d23136238062878d331e37e9fa.voicewith real LiveKit transport, voice injection/recording, and Cartesiasonic-3through LiveKit inference TTS./v3/wsboundary captured the actual plugin query andUpdateConfigurationmessages while supplying deterministic STT events; the LLM was deterministic.universal-3-5-prowas model-derived supported while an unsupported-model probe was false. The initial request carriedagent_context=ORIGINAL-2058; a 2,250-character assistant item produced exactly the final 1,750Dcharacters, SHA-256d3078ec32af005bf146a63d2e11424b912726627eb5c22ecfa02fba92b2cd8f9.1/1to0/0, and a second voice turn committedCONTINUITY-FORWARD-2058with audio.Opt-out session:
sid_e98d8b0c8667.providerContextUpdateCount=0, provingforwardChatContext: falsesuppresses forwarding without changing capability.CONTINUITY-OPTOUT-2058in the same session.Artifacts:
events.jsonl, both commandresult.jsonfiles per session, session WAVs, and all command WAVs under~/.cue-cli/sessions/{sid_95490732184e,sid_e98d8b0c8667}/were flushed and inspected directly.Known validation gaps
Ported from livekit/agents#6475
Original PR description
Adds
stt_context_optionsonAgentSession— a single conversation-aware STT option grouping statickeyterms, LLMkeyterm_detection, and aforward_chat_contexttoggle that forwards agent replies to STTs that consume context natively (e.g. AssemblyAI Universal-3 Pro).forward_chat_contextis on by default and is the only control for carryover, applied consistently across the inference STT and the AssemblyAI plugin. Agent replies are now sent to AssemblyAI u3-pro by default when used viaAgentSession; opt out withstt_context_options={"forward_chat_context": False}.Deprecated (still work, warn):
AgentSession(keyterms_options=...)→ usestt_context_optionsagent_context_carryover→ usestt_context_options.forward_chat_context(passFalseto opt out)Removes the unpublished
agent_context_carryoverparam from the inference STT.