Skip to content

TurnMetricsEvent

Emitted once per conversation turn with the turn's latency breakdown.

Defined in: src/core/events/types.ts:1134

Emitted once per conversation turn with the turn’s latency breakdown.

Remarks

Captures the timing of every pipeline stage for one turn — STT final → LLM first token → TTS first audio → playback start — as both absolute timestamps and derived durations. Use it to tune the eager pipeline (durations.sttFinalToFirstToken goes negative when a speculative generation was adopted) and to compare provider choices on real traffic.

Timestamps are epoch milliseconds, so each phase maps directly onto a tracing span (OpenTelemetry or otherwise) without clock translation.

Interrupted turns (barge-in, stopSpeaking(), pipeline errors) are also reported, with interrupted: true and whatever marks were captured before the interruption.

Example

agent.on('turn.metrics', (event) => {
  const { voiceToVoice, sttFinalToFirstToken } = event.durations;
  console.log(`turn ${event.turnId}: ${voiceToVoice}ms voice-to-voice`);
  if (event.eagerUsed) {
    console.log(`eager pipeline saved ${-sttFinalToFirstToken!}ms`);
  }
});

See

TurnMetricsSummary for field documentation

Extends

Properties

PropertyTypeDescriptionInherited fromDefined in
durationsTurnDurationsDerived phase durations in milliseconds.TurnMetricsSummary.durationssrc/core/pipeline/TurnMetrics.ts:144
eagerUsedbooleanWhether an eager (preflight-triggered) LLM generation was adopted.TurnMetricsSummary.eagerUsedsrc/core/pipeline/TurnMetrics.ts:132
interruptedbooleanWhether the turn ended early — barge-in, stopSpeaking(), or a pipeline error — rather than completing playback.TurnMetricsSummary.interruptedsrc/core/pipeline/TurnMetrics.ts:138
metadata?Record<string, unknown>Optional metadata associated with the event. Remarks May contain provider-specific data or debugging information.BaseEvent.metadatasrc/core/events/types.ts:94
modality"voice" | "text"How the turn was initiated: transcribed speech or typed text.TurnMetricsSummary.modalitysrc/core/pipeline/TurnMetrics.ts:129
timestampnumberUnix timestamp (in milliseconds) when the event occurred. Remarks Useful for latency measurements and debugging the pipeline timing.BaseEvent.timestampsrc/core/events/types.ts:86
timestampsTurnTimestampsAbsolute timestamps (epoch ms) for each captured stage.TurnMetricsSummary.timestampssrc/core/pipeline/TurnMetrics.ts:141
transcriptstringThe user text that started the turn.TurnMetricsSummary.transcriptsrc/core/pipeline/TurnMetrics.ts:126
turnIdnumberMonotonic turn counter, starting at 1 for the first turn.TurnMetricsSummary.turnIdsrc/core/pipeline/TurnMetrics.ts:123
type"turn.metrics"Discriminant for this event type.-src/core/events/types.ts:1136

© 2026 CompositeVoice. All rights reserved.

Font size
Contrast
Motion
Transparency