Conversation
🦋 Changeset detectedLatest commit: a6e6bd6 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 |
davidzhao
added this pull request to stack #2502
September 15, 2026 06:32
davidzhao
force-pushed
the
dz/telemetry-coverage
branch
from
September 15, 2026 06:46
b21aa74 to
f3e8092
Compare
davidzhao
force-pushed
the
dz/telemetry-coverage
branch
from
September 16, 2026 04:28
f3e8092 to
8b62e64
Compare
…text input Port of livekit/agents#7137. Interruptions: `agent_turn` carries `lk.interruption.source`, set by the caller that knows the cause (`audio_activity` for a VAD/STT barge-in and the realtime server's own speech detection, `user_turn` for a committed turn or a final transcript ending a pause, `programmatic` for session.interrupt(), tools and teardown); the first interruption's cause stands. The pipeline and `say` paths stamp `lk.playout.position`, the seconds actually played when the user cut in. The say and realtime paths now also stamp `lk.interrupted`, which only the pipeline reply did before. Agent handoff: `updateAgent()` opens an `update_agent` span under `agent_session` with `lk.previous_agent_label` / `lk.agent_label`; the old agent's `drain_agent_activity` (with `on_exit`) and the new agent's `start_agent_activity` / `resume_agent_activity` nest under it. The initial start stays under `session_start`. Fallback adapters: LLM, TTS and STT `model` / `provider` follow the instance that serves next (first available, else the primary), so `llm_node`, `tts_node` and `start_agent_activity` name a real model. The LLM and TTS attempt span carries `lk.fallback.label` / `lk.fallback.index` and the serving instance's request model and provider; the adapter's request span and the caller's node span get `gen_ai.response.model` / provider of the instance that answered, per request. The STT adapter's last-served tracking is replaced by the same next-instance rule. Text input: the keyterm-detection LLM pass runs in its own `keyterm_detection` span under the `agent_turn` whose reply added the user message, else under `agent_session`, with counts only (`lk.keyterms.count/added/removed`) plus model and provider. Adaptations: agents carry `id` where Python has `label`; JS `SpeechHandle` and `AgentActivity.interrupt` take the source as a second positional parameter / option instead of a keyword. The LLM and TTS stream base classes expose their request span to subclasses (`llmRequestSpan`, `ttsRequestSpan`), the JS counterpart of Python's `_llm_request_span`. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
davidzhao
force-pushed
the
dz/telemetry-coverage
branch
from
September 16, 2026 04:34
8b62e64 to
a6e6bd6
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.
Port of livekit/agents#7137. Stacked on #2498.
Description
Smaller coverage gaps on existing spans, each of which came up when reading a trace and not being able to answer a question from it.
Interruptions.
agent_turncarried a singlelk.interruptedboolean. It now also carrieslk.interruption.source, set by the caller that knows the cause:audio_activity(barge-in from VAD / STT activity),user_turn(a committed user turn preempting the reply),programmatic(session.interrupt(), a tool, teardown). The first cause wins. The pipeline andsaypaths also stamplk.playout.position, how many seconds had actually played when the user cut in.Agent handoff.
updateAgent()spans anupdate_agentbar (parentagent_session) withlk.previous_agent_labelandlk.agent_label. The old agent'sdrain_agent_activity(withon_exitinside) and the new agent'sstart_agent_activitynest under it. The initial start stays undersession_start.Fallback adapters (LLM, TTS, STT).
FallbackAdapter.model/.providerfollow the instance that serves next, sollm_node,tts_nodeandstart_agent_activityname a real model instead of the adapter. The attempt span carrieslk.fallback.label/lk.fallback.index, and a failover mid-request is recorded on the response side:gen_ai.response.modelandgen_ai.provider.nameof the serving instance on the adapter's request span and onllm_node/tts_node. Usage metrics needed no change.Text input. A
keyterm_detectionspan around the keyterm-detection LLM pass, nested under theagent_turnthat answers the user message (falling back toagent_session), so itsllm_requestno longer looks like a second inference step. Attributes are counts only (lk.keyterms.count/added/removed) plus model and provider; the terms stay in the session report as PII.Changes Made
voice/speech_handle.ts:InterruptionSource,interrupt(force, source);voice/agent_activity.ts:recordInterruption, source threaded through every interrupt path,lk.playout.position;voice/agent_session.ts:update_agentspan.llm|tts|stt/fallback_adapter.ts:nextInstance(),model/provideroverrides, served-instance attribution;llm/llm.ts,tts/tts.ts: protected request-span getters.voice/keyterm_detection.ts:keyterm_detectionspan.telemetry/trace_types.ts: eight new attributes (none PII).Adaptations from the Python source
lk.agent_label/lk.previous_agent_labeluseagent.id.recordInterruptionalso stampslk.interrupted=true: the JSsayand realtime paths never set it before (only the pipeline reply did)._activeSttlast-served tracking is removed with the getters that read it.llm_fallback_adapterspan name has no JS counterpart; the adapter's request span keeps the fixedllm_requestname and is found through itsllm_request_runchild.Testing
voice/coverage_spans.test.ts(barge-in source and playout position through a fake session,update_agentnesting, LLM fallback serving provider, first-cause-wins) andvoice/keyterm_detection_span.test.ts; fallback adapter tests updated for next-instance identity;agent_session_handoff.test.tsaccepts the threaded trace context.agentssuite green; build, typecheck, lint, API report updated.🤖 Generated with Claude Code