AWS Nova Sonic RealtimeModel (amazon.nova-2-sonic-v1:0): metrics emitted repeatedly and ttftalways0.0

@livekit

Hi Livekit team,

When using the AWS Nova Sonic realtime model (amazon.nova-2-sonic-v1:0) via the livekit-plugins-aws realtime integration, I’m seeing two problems with the RealtimeModel metrics events:

  1. Metrics are emitted many times for a single response. For one agent turn I get a stream of separate RealtimeModel metrics log lines , each reporting a small chunk (e.g. output_tokens: 20) instead of a single aggregated metrics event at the end of the response.
  2. ttft is always 0.0. Time-to-first-token is never populated — every metrics event reports "ttft": 0.0 regardless of actual latency

Environment

  • Model: amazon.nova-2-sonic-v1:0
  • LiveKit Agents Version: 1.5.17
  • Provider: Amazon (AWS Bedrock)

Sample logs

{“message”: “RealtimeModel metrics”, “model_name”: “amazon.nova-2-sonic-v1:0”, “model_provider”: “Amazon”, “ttft”: 0.0, “input_tokens”: 0, “output_tokens”: 20, “output_text_tokens”: 2, “output_audio_tokens”: 18, “total_tokens”: 20, “timestamp”: “2026-07-17T06:21:37.570279+00:00”}
{“message”: “RealtimeModel metrics”, “model_name”: “amazon.nova-2-sonic-v1:0”, “model_provider”: “Amazon”, “ttft”: 0.0, “input_tokens”: 0, “output_tokens”: 20, “output_text_tokens”: 0, “output_audio_tokens”: 20, “total_tokens”: 20, “timestamp”: “2026-07-17T06:21:37.993354+00:00”}
{“message”: “RealtimeModel metrics”, “model_name”: “amazon.nova-2-sonic-v1:0”, “model_provider”: “Amazon”, “ttft”: 0.0, “input_tokens”: 0, “output_tokens”: 20, “output_text_tokens”: 0, “output_audio_tokens”: 20, “total_tokens”: 20, “timestamp”: “2026-07-17T06:21:38.492814+00:00”}
… (repeats many times for a single turn) …

Questions

  • Is the per-chunk emission expected for the Nova Sonic realtime model, or should these be aggregated?

  • Is ttft measurement supported for AWS realtime models, or is it a known gap in the AWS plugin?

  • Are there any recommended configuration changes, timeout settings, or code adjustments required when using this model with LiveKit Agents?

  • Have there been any fixes or improvements in versions newer than 1.5.17 related to realtime AWS models?

    Any guidance would be greatly appreciated.

@livekit @LiveKit-Community @livekitteams @darryncampbell @CWilson @Muhammad_Usman_Bashir

@Shivakant_Yadav, Both are on the AWS plugin side, and the Nova Sonic realtime source explains them. The repeated metrics are the plugin’s current behavior: _handle_usage_event fires once per Nova Sonic usageEvent, each carrying an incremental token delta, so it emits a separate metrics_collected per delta rather than one aggregated event (realtime_model.py#L1430).

That per-event stream is by design. For a rolled-up total you do not aggregate by hand: AgentSession already runs a usage collector and exposes the aggregate as session.usage. Straight from examples/voice_agents/basic_agent.py:

from livekit.agents import MetricsCollectedEvent, metrics

@session.on("metrics_collected")
def _on_metrics(ev: MetricsCollectedEvent):
    metrics.log_metrics(ev.metrics)          # raw per-event stream

async def log_usage():
    logger.info(f"Usage: {session.usage}")   # aggregated session totals
ctx.add_shutdown_callback(log_usage)

ttft is separate. It is computed as first_token_ts - created_ts and only populated when the generation’s first-token timestamp is set (realtime_model.py#L1446); in the Nova Sonic path that timestamp is not being set, so it stays at the 0.0 default on every event. That is a gap in the AWS plugin, not config, worth filing on livekit/agents with this repro. The same code is on main (agents 1.6.6), so upgrading past 1.5.17 will not change either behavior.