Skip to content

Very High Initial EOU latencies while using Azure STT #1893

Description

@Jeeva-MV

We are experiencing a significantly high first-request delay of 4-10 seconds when using Azure Speech-to-Text (Azure-STT) in our Voice-Agent-Pipeline. However, subsequent requests exhibit much lower latency, around 700-750ms.

The agent is currently running our AWS server in India (We have self-hosted livekit) and the agent is connected with telephony using exotel.

We have tried pre-warming the Azure server before dialling to the user by sending in an dummy audio i/p it did not help much in reducing the first EOU latency and we have raised the issue with the Azure Team, any suggestions on how to tackle this will be helpful.

Attaching the STT and VAD configs along with a sample log file for reference.

Azure-configs (Tried with multi-lingual detection as well, but the issue still persists).

    proc.userdata["stt"] = azure.STT( speech_key="<key>", 
                                 speech_region="centralindia", 
                                 language="hi-IN", 
                                 segmentation_silence_timeout_ms=300 )

VAD-configs

    proc.userdata["vad"] = silero.VAD.load(min_silence_duration=0.1, 
                                 prefix_padding_duration=0.3, 
                                 min_speech_duration=0.1, 
                                 max_buffered_speech = 40, 
                                 activation_threshold = 0.4 )

Voice-Agent-Pipeline Configs

agent = VoicePipelineAgent( vad=ctx.proc.userdata["vad"], 
                                 stt=ctx.proc.userdata["stt"], 
                                 llm=google_llm, 
                                 tts=azure_female_tts, 
                                 chat_ctx=initial_ctx, 
                                 fnc_ctx=CallActions(api=ctx.api, participant=participant, room=ctx.room), 
                                 min_endpointing_delay=0.1, 
                                 max_endpointing_delay=0.15 )

Sample-Logs (While running the agent in start-mode).

{"message": "user has picked up", "level": "INFO", "name": "outbound-caller", "pid": 91684, "job_id": "AJ_vULzZB5q72qJ", "timestamp": "2025-03-23T07:43:50.191702+00:00"}
{"message": "Pipeline EOU metrics: sequence_id=fea6e2011213, end_of_utterance_delay=4.12, transcription_delay=4.12", "level": "INFO", "name": "livekit.agents", "pid": 91684, "job_id": "AJ_vULzZB5q72qJ", "timestamp": "2025-03-23T07:43:55.045604+00:00"} 
{"message": "AFC is enabled with max remote calls: 10.", "level": "INFO", "name": "google_genai.models", "pid": 91684, "job_id": "AJ_vULzZB5q72qJ", "timestamp": "2025-03-23T07:43:55.047839+00:00"}
{"message": "AFC remote call 1 is done.", "level": "INFO", "name": "google_genai.models", "pid": 91684, "job_id": "AJ_vULzZB5q72qJ", "timestamp": "2025-03-23T07:43:57.142847+00:00"}
{"message": "Pipeline LLM metrics: sequence_id=fea6e2011213, ttft=2.10, input_tokens=839, output_tokens=11, tokens_per_second=4.99", "level": "INFO", "name": "livekit.agents", "pid": 91684, "job_id": "AJ_vULzZB5q72qJ", "timestamp": "2025-03-23T07:43:57.251831+00:00"}
Info: on_underlying_io_bytes_received: Close frame received Info: on_underlying_io_bytes_received: closing underlying io. Info: on_underlying_io_close_complete: uws_state: 6.
{"message": "Pipeline TTS metrics: sequence_id=fea6e2011213, ttfb=0.36122050000085437, audio_duration=2.69", "level": "INFO", "name": "livekit.agents", "pid": 91684, "job_id": "AJ_vULzZB5q72qJ", "timestamp": "2025-03-23T07:43:57.660506+00:00"}
{"message": "Pipeline EOU metrics: sequence_id=5da306e2d01c, end_of_utterance_delay=0.64, transcription_delay=0.63", "level": "INFO", "name": "livekit.agents", "pid": 91684, "job_id": "AJ_vULzZB5q72qJ", "timestamp": "2025-03-23T07:44:01.970419+00:00"} 
{"message": "AFC is enabled with max remote calls: 10.", "level": "INFO", "name": "google_genai.models", "pid": 91684, "job_id": "AJ_vULzZB5q72qJ", "timestamp": "2025-03-23T07:44:01.971899+00:00"}
{"message": "AFC remote call 1 is done.", "level": "INFO", "name": "google_genai.models", "pid": 91684, "job_id": "AJ_vULzZB5q72qJ", "timestamp": "2025-03-23T07:44:04.025985+00:00"}
{"message": "Pipeline LLM metrics: sequence_id=5da306e2d01c, ttft=2.06, input_tokens=854, output_tokens=25, tokens_per_second=11.50", "level": "INFO", "name": "livekit.agents", "pid": 91684, "job_id": "AJ_vULzZB5q72qJ", "timestamp": "2025-03-23T07:44:04.144913+00:00"}
Info: on_underlying_io_bytes_received: Close frame received Info: on_underlying_io_bytes_received: closing underlying io. Info: on_underlying_io_close_complete: uws_state: 6.
{"message": "Pipeline TTS metrics: sequence_id=5da306e2d01c, ttfb=0.6690272499999992, audio_duration=6.73", "level": "INFO", "name": "livekit.agents", "pid": 91684, "job_id": "AJ_vULzZB5q72qJ", "timestamp": "2025-03-23T07:44:05.154018+00:00"}
{"message": "Pipeline EOU metrics: sequence_id=5c8d081591a3, end_of_utterance_delay=0.60, transcription_delay=0.60", "level": "INFO", "name": "livekit.agents", "pid": 91684, "job_id": "AJ_vULzZB5q72qJ", "timestamp": "2025-03-23T07:44:13.397990+00:00"} 
{"message": "AFC is enabled with max remote calls: 10.", "level": "INFO", "name": "google_genai.models", "pid": 91684, "job_id": "AJ_vULzZB5q72qJ", "timestamp": "2025-03-23T07:44:13.398816+00:00"}
{"message": "AFC remote call 1 is done.", "level": "INFO", "name": "google_genai.models", "pid": 91684, "job_id": "AJ_vULzZB5q72qJ", "timestamp": "2025-03-23T07:44:15.592434+00:00"}
{"message": "Pipeline LLM metrics: sequence_id=5c8d081591a3, ttft=2.20, input_tokens=885, output_tokens=44, tokens_per_second=16.96", "level": "INFO", "name": "livekit.agents", "pid": 91684, "job_id": "AJ_vULzZB5q72qJ", "timestamp": "2025-03-23T07:44:15.993714+00:00"}
Info: on_underlying_io_close_complete: uws_state: 6. Info: uws_client_close_async: closed underlying io.
{"message": "Pipeline TTS metrics: sequence_id=5c8d081591a3, ttfb=3.5816812089997256, audio_duration=7.75", "level": "INFO", "name": "livekit.agents", "pid": 91684, "job_id": "AJ_vULzZB5q72qJ", "timestamp": "2025-03-23T07:44:21.222715+00:00"}
Info: on_underlying_io_bytes_received: Close frame received
Info: on_underlying_io_bytes_received: closing underlying io.
Info: on_underlying_io_close_complete: uws_state: 6. 
{"message": "Pipeline TTS metrics: sequence_id=5c8d081591a3, ttfb=3.9616254579996166, audio_duration=2.30", "level": "INFO", "name": "livekit.agents", "pid": 91684, "job_id": "AJ_vULzZB5q72qJ", "timestamp": "2025-03-23T07:44:25.774709+00:00"}
{"message": "Pipeline EOU metrics: sequence_id=da99722c123d, end_of_utterance_delay=0.62, transcription_delay=0.62", "level": "INFO", "name": "livekit.agents", "pid": 91684, "job_id": "AJ_vULzZB5q72qJ", "timestamp": "2025-03-23T07:44:33.576190+00:00"}
{"message": "AFC is enabled with max remote calls: 10.", "level": "INFO", "name": "google_genai.models", "pid": 91684, "job_id": "AJ_vULzZB5q72qJ", "timestamp": "2025-03-23T07:44:33.577608+00:00"}
{"message": "AFC remote call 1 is done.", "level": "INFO", "name": "google_genai.models", "pid": 91684, "job_id": "AJ_vULzZB5q72qJ", "timestamp": "2025-03-23T07:44:35.543008+00:00"}
{"message": "Pipeline LLM metrics: sequence_id=da99722c123d, ttft=1.97, input_tokens=936, output_tokens=21, tokens_per_second=9.93", "level": "INFO", "name": "livekit.agents", "pid": 91684, "job_id": "AJ_vULzZB5q72qJ", "timestamp": "2025-03-23T07:44:35.692191+00:00"}
Info: on_underlying_io_bytes_received: Close frame received
Info: on_underlying_io_bytes_received: closing underlying io.
Info: on_underlying_io_close_complete: uws_state: 6.
{"message": "Pipeline TTS metrics: sequence_id=da99722c123d, ttfb=0.41878175000056217, audio_duration=2.28", "level": "INFO", "name": "livekit.agents", "pid": 91684, "job_id": "AJ_vULzZB5q72qJ", "timestamp": "2025-03-23T07:44:36.131160+00:00"}
Info: on_underlying_io_bytes_received: Close frame received
Info: on_underlying_io_bytes_received: closing underlying io.
Info: on_underlying_io_close_complete: uws_state: 6.
{"message": "Pipeline TTS metrics: sequence_id=da99722c123d, ttfb=0.36498150000079477, audio_duration=2.93", "level": "INFO", "name": "livekit.agents", "pid": 91684, "job_id": "AJ_vULzZB5q72qJ", "timestamp": "2025-03-23T07:44:36.585260+00:00"}
Info: on_underlying_io_bytes_received: Close frame received
Info: on_underlying_io_bytes_received: closing underlying io.
Info: on_underlying_io_close_complete: uws_state: 6.
{"message": "Pipeline TTS metrics: sequence_id=da99722c123d, ttfb=0.5957701669995004, audio_duration=2.33", "level": "INFO", "name": "livekit.agents", "pid": 91684, "job_id": "AJ_vULzZB5q72qJ", "timestamp": "2025-03-23T07:44:37.304937+00:00"}
{"message": "Pipeline EOU metrics: sequence_id=595fb64d0b22, end_of_utterance_delay=0.70, transcription_delay=0.70", "level": "INFO", "name": "livekit.agents", "pid": 91684, "job_id": "AJ_vULzZB5q72qJ", "timestamp": "2025-03-23T07:44:47.542178+00:00"} 
{"message": "AFC is enabled with max remote calls: 10.", "level": "INFO", "name": "google_genai.models", "pid": 91684, "job_id": "AJ_vULzZB5q72qJ", "timestamp": "2025-03-23T07:44:47.543905+00:00"}
{"message": "AFC remote call 1 is done.", "level": "INFO", "name": "google_genai.models", "pid": 91684, "job_id": "AJ_vULzZB5q72qJ", "timestamp": "2025-03-23T07:44:49.462556+00:00"}
{"message": "Pipeline LLM metrics: sequence_id=595fb64d0b22, ttft=1.92, input_tokens=958, output_tokens=29, tokens_per_second=13.81", "level": "INFO", "name": "livekit.agents", "pid": 91684, "job_id": "AJ_vULzZB5q72qJ", "timestamp": "2025-03-23T07:44:49.644142+00:00"}
Info: on_underlying_io_bytes_received: Close frame received
Info: on_underlying_io_bytes_received: closing underlying io.
Info: on_underlying_io_close_complete: uws_state: 6.
{"message": "Pipeline TTS metrics: sequence_id=595fb64d0b22, ttfb=0.7348645000001852, audio_duration=5.04", "level": "INFO", "name": "livekit.agents", "pid": 91684, "job_id": "AJ_vULzZB5q72qJ", "timestamp": "2025-03-23T07:44:50.467473+00:00"}
Info: on_underlying_io_bytes_received: Close frame received
Info: on_underlying_io_bytes_received: closing underlying io.
Info: on_underlying_io_close_complete: uws_state: 6.
{"message": "Pipeline TTS metrics: sequence_id=595fb64d0b22, ttfb=0.44387512499997683, audio_duration=2.61", "level": "INFO", "name": "livekit.agents", "pid": 91684, "job_id": "AJ_vULzZB5q72qJ", "timestamp": "2025-03-23T07:44:50.984306+00:00"}
{"message": "Pipeline EOU metrics: sequence_id=5b3466823aea, end_of_utterance_delay=0.84, transcription_delay=0.84", "level": "INFO", "name": "livekit.agents", "pid": 91684, "job_id": "AJ_vULzZB5q72qJ", "timestamp": "2025-03-23T07:45:00.130514+00:00"}
{"message": "AFC is enabled with max remote calls: 10.", "level": "INFO", "name": "google_genai.models", "pid": 91684, "job_id": "AJ_vULzZB5q72qJ", "timestamp": "2025-03-23T07:45:00.131955+00:00"}
{"message": "AFC remote call 1 is done.", "level": "INFO", "name": "google_genai.models", "pid": 91684, "job_id": "AJ_vULzZB5q72qJ", "timestamp": "2025-03-23T07:45:01.981920+00:00"}
{"message": "Pipeline LLM metrics: sequence_id=5b3466823aea, ttft=1.85, input_tokens=994, output_tokens=34, tokens_per_second=15.88", "level": "INFO", "name": "livekit.agents", "pid": 91684, "job_id": "AJ_vULzZB5q72qJ", "timestamp": "2025-03-23T07:45:02.272808+00:00"}
Info: on_underlying_io_bytes_received: Close frame received
Info: on_underlying_io_bytes_received: closing underlying io.
Info: on_underlying_io_close_complete: uws_state: 6. 
{"message": "Pipeline TTS metrics: sequence_id=5b3466823aea, ttfb=0.6538038329999836, audio_duration=4.85", "level": "INFO", "name": "livekit.agents", "pid": 91684, "job_id": "AJ_vULzZB5q72qJ", "timestamp": "2025-03-23T07:45:02.960286+00:00"}
Info: on_underlying_io_bytes_received: Close frame received
Info: on_underlying_io_bytes_received: closing underlying io.
Info: on_underlying_io_close_complete: uws_state: 6.
{"message": "Pipeline TTS metrics: sequence_id=5b3466823aea, ttfb=0.42698366699914914, audio_duration=2.63", "level": "INFO", "name": "livekit.agents", "pid": 91684, "job_id": "AJ_vULzZB5q72qJ", "timestamp": "2025-03-23T07:45:03.456047+00:00"}
Info: on_underlying_io_bytes_received: Close frame received
Info: on_underlying_io_bytes_received: closing underlying io.
Info: on_underlying_io_close_complete: uws_state: 6.
{"message": "Pipeline TTS metrics: sequence_id=5b3466823aea, ttfb=0.4602830419989914, audio_duration=3.07", "level": "INFO", "name": "livekit.agents", "pid": 91684, "job_id": "AJ_vULzZB5q72qJ", "timestamp": "2025-03-23T07:45:04.017993+00:00"}
{"message": "Pipeline EOU metrics: sequence_id=f4c709e75e03, end_of_utterance_delay=0.66, transcription_delay=0.66", "level": "INFO", "name": "livekit.agents", "pid": 91684, "job_id": "AJ_vULzZB5q72qJ", "timestamp": "2025-03-23T07:45:16.397638+00:00"} 
{"message": "AFC is enabled with max remote calls: 10.", "level": "INFO", "name": "google_genai.models", "pid": 91684, "job_id": "AJ_vULzZB5q72qJ", "timestamp": "2025-03-23T07:45:16.399153+00:00"}
{"message": "AFC remote call 1 is done.", "level": "INFO", "name": "google_genai.models", "pid": 91684, "job_id": "AJ_vULzZB5q72qJ", "timestamp": "2025-03-23T07:45:18.398228+00:00"}
{"message": "Pipeline LLM metrics: sequence_id=f4c709e75e03, ttft=2.00, input_tokens=1031, output_tokens=18, tokens_per_second=8.48", "level": "INFO", "name": "livekit.agents", "pid": 91684, "job_id": "AJ_vULzZB5q72qJ", "timestamp": "2025-03-23T07:45:18.521107+00:00"}
Info: on_underlying_io_bytes_received: Close frame received
Info: on_underlying_io_bytes_received: closing underlying io.
Info: on_underlying_io_close_complete: uws_state: 6.
{"message": "Pipeline TTS metrics: sequence_id=f4c709e75e03, ttfb=0.43270599999959813, audio_duration=2.17", "level": "INFO", "name": "livekit.agents", "pid": 91684, "job_id": "AJ_vULzZB5q72qJ", "timestamp": "2025-03-23T07:45:18.967886+00:00"}
Info: on_underlying_io_bytes_received: Close frame received
Info: on_underlying_io_bytes_received: closing underlying io.
Info: on_underlying_io_close_complete: uws_state: 6.
{"message": "Pipeline TTS metrics: sequence_id=f4c709e75e03, ttfb=0.40327341699958197, audio_duration=1.69", "level": "INFO", "name": "livekit.agents", "pid": 91684, "job_id": "AJ_vULzZB5q72qJ", "timestamp": "2025-03-23T07:45:19.432806+00:00"}
{"message": "ending the call for phone_user", "level": "INFO", "name": "outbound-caller", "pid": 91684, "job_id": "AJ_vULzZB5q72qJ", "timestamp": "2025-03-23T07:45:22.784387+00:00"}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions