any setting in , where we can set how much audio b...
# ask-ai
p
any setting in , where we can set how much audio before is sent to stt ?
t
Thanks for reaching out, Adarsh. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
You're asking if there's a setting to control how much audio is sent to STT before processing — yes. You can control this behavior with VAD and endpointing settings: • VAD parameters (example with Silero VAD): ◦
min_silence_duration
— how long silence must be seen to end an utterance (increases/decreases how much trailing audio is buffered). ◦
min_speech_duration
— minimum detected speech length to start an utterance. ◦
prefix_padding_duration
— how much audio to include before detected speech (pre-roll). Example:
Copy code
vad = silero.VAD.load(
      min_silence_duration=0.55,
      min_speech_duration=0.05,
      prefix_padding_duration=0.5
  )
• For STT adapters that aren’t natively streaming (e.g., Whisper), a
StreamAdapter
wraps the STT with VAD to buffer until end-of-utterance is detected. • Session-level endpointing controls: ◦
min_endpointing_delay
and
max_endpointing_delay
in
AgentSession
to fine-tune when an utterance is finalized and sent to STT. Which STT model and integration are you using (Silero VAD, Whisper, another), and do you want shorter latency or more complete utterances? I can give exact config recommendations once you tell me. Sources: Silero VAD plugin | LiveKit docs | Speech-to-text (STT) models | LiveKit Docs | Turn detection and interruptions | LiveKit Docs
p
so whats default prefix_padding_duration annd will it increase how much audio will go to stt ?
t
Default
prefix_padding_duration
is 0.5 seconds. Yes—increasing
prefix_padding_duration
will include more audio before detected speech in each chunk, so more audio is sent to STT (helps avoid clipping the start of utterances, at the cost of slightly more latency/data). Sources: Silero VAD plugin | LiveKit docs
p
is there a way to send sarvam stt some words which i want it to recognize because when i say small words like "चार" etc it cant detect it
t
You're asking if you can send specific words to Sarvam STT (e.g., "चार") to improve recognition — yes. What you can do: • Use Sarvam's contextual biasing / custom vocabulary via the
context
parameter to prioritize specific words/phrases. • Ensure you configure the correct language (e.g.,
hi-IN
) so the model expects Hindi phonemes. • If needed, add a post‑processing mapping layer that corrects common misrecognitions (a small lookup or fuzzy match). Example (conceptual):
Copy code
stt = sarvam.STT(
  language="hi-IN",
  context="एक दो तीन चार पाँच छह"
)
Would you like a concrete code example for your agent setup or help building a small post-processing dictionary for common mis-recognitions? Sources: Soniox STT plugin guide | LiveKit Docs | Sarvam STT plugin guide | LiveKit Docs
p
are you sure of this thing ? context="एक दो तीन चार पाँच छह" ??? because i cant see this in their plugin of STT
t
You're right to question that — the LiveKit Sarvam STT plugin does not currently expose a
context
parameter directly. What you can do instead: • Ensure
language="hi-IN"
(or correct locale) so the model expects Hindi phonemes. • Post-process transcripts with a small dictionary/fuzzy matcher to map common mis-recognitions (e.g., "char" → "चार"). • Call Sarvam's Speech-to-Text API directly (their API supports contextual bias/vocabulary) if you need immediate custom vocabulary control outside the plugin. • Verify your plugin version in case newer releases add contextual parameters, and consider filing a feature request if you want
context
in the plugin. Would you like a code example for post-processing corrections or a sample call to Sarvam’s API to pass context directly?
p
agent not detecting my audio when i am saying . its on phone calls
t
Sorry you're experiencing that — let's troubleshoot why the agent isn't detecting audio on phone calls. Please tell me: 1. Which Agent and STT plugin are you using (e.g., LiveKit Agent with Sarvam STT, or a custom agent)? 2. Are you using LiveKit's Phone integration for the calls? 3. Current VAD/endpointing settings you have configured:
min_silence_duration
,
min_speech_duration
,
prefix_padding_duration
,
min_endpointing_delay
,
max_endpointing_delay
(if set). 4. Is the audio audible to other participants? Any DTMF or call-recording gateway between the phone and LiveKit? 5. Are you seeing any logs or errors from the agent (VAD dropped frames, no audio packets, or STT timeouts)? If so, paste a short log excerpt. With those details I can suggest targeted fixes (VAD tuning, phone audio routing checks, or workarounds). Would you like a quick checklist to test audio path now?
p
silero vad, sarvam stt. But it isnt problem of stt, because vad is not detecting my audio. how it will send to stt. we have setup a egress but in livekit only . no logs for vad.
t
Thanks — I’ll help troubleshoot Silero VAD not detecting audio on phone calls. A few targeted questions and a short checklist will quickly narrow this down. Please confirm: 1. How phone calls are connected to LiveKit (SIP gateway, PSTN provider, carrier integration, or third‑party bridge)? 2. Where Silero VAD runs (inside your agent process handling the LiveKit participant audio, or on a separate service)? 3. VAD config values you currently have:
min_silence_duration
,
min_speech_duration
,
prefix_padding_duration
. 4. Audio format being published to LiveKit: sample rate (e.g., 8k, 16k), channels (mono/stereo), and codec (PCM/opus). 5. How egress is configured — are you recording from the LiveKit room or directly from the agent? 6. Can you confirm other participants can hear the caller audio in the room (i.e., audio is being published to LiveKit)? Quick checklist to try now: • Verify audio is actually being published to the participant’s audio track in LiveKit (use the LiveKit dashboard or subscribe locally to confirm audible audio). • Ensure sample rate is compatible with Silero VAD (Silero works best with 16 kHz mono PCM). If calls are 8 kHz, resample to 16 kHz before VAD. • Confirm audio is mono and not interleaved stereo; VAD may miss speech on the wrong channel. • Lower VAD sensitivity temporarily: reduce
min_speech_duration
and
min_silence_duration
to detect short utterances. • Add a short prefix padding (0.5s default) if starts are being clipped — but main issue is VAD not seeing any frames, so check the audio pipeline first. • If you have no VAD logs, enable Silero VAD verbose/debug logging in the agent to confirm frames arriving and decisions (
frame_received
,
speech_start
,
speech_end
). If you can paste: • The VAD config values you use, • The audio sample rate/codec, • A brief description of how the phone audio reaches the agent (SIP gateway name or architecture), I’ll give exact config changes and a minimal validation snippet you can run to verify frames reach Silero VAD.
p
i am making voice agents using livekit , so in my use case the prompt has become 75k characters which increases the latency. so are there any other ways to divide the prompt someting like that, in livekit or any way or anyone has implemented online on youtube or reddit
t
You're right to ask — LiveKit doesn't provide built-in prompt-splitting for Agent prompts. For a 75k-character prompt, here are practical ways others use to reduce latency and keep only relevant context sent to the LLM: Options you can implement now • Retrieval-augmented generation (RAG): store the large context in a vector DB and fetch only relevant chunks per interaction. This is the most common production approach. • Break into focused agents (workflows): split responsibilities into multiple smaller agents and pass only the needed context to each agent. • Precompute & summarize: summarize large static sections offline and store small summaries to include in prompts. • Stateful/context caching: keep session state (recent turns, key facts) and send only that, not the entire history. • Custom LLM node: override the
llm_node
to programmatically trim or assemble prompt pieces before sending to the model. • Post/incremental prompting: send a short prompt to get a quick response, then stream or follow up with additional context if needed. Technical tips to reduce latency • Use smaller/faster models for parts of the flow (e.g., rerankers or embed+retrieve with a compact LLM for short answers). • Measure Time To First Token (TTFT) and tokens/sec to see how much the prompt contributes to latency. • Cache embeddings and retrieval results so you don't rebuild context each request. No built-in LiveKit feature or community video was identified that automatically chunks prompts for Agents; implementing RAG or workflows is the recommended pattern. Would you like: • a short example of a RAG flow (vector DB + retrieval + prompt template), or • a sketch showing how to split a monolithic prompt into multiple agent/workflow steps? Sources: livekit/livekit_composite | DeepWiki | How can I reduce latency in voice agents using STT, TTS and LLM? | Observability data hooks | LiveKit docs | Building the all-in-one platform for voice AI agents | External data and RAG | LiveKit Docs
p
dont you support something like workflow based ?
t
Yes — LiveKit supports workflow-based patterns for Agents. • Use the Workflows pattern to split a large monolithic prompt into multiple focused agents or steps. Each agent handles a smaller responsibility and only receives the context it needs. • You can implement workflows by wiring multiple agents together (e.g., an ingestion/summarization agent, a retrieval agent that pulls relevant chunks from a vector DB, and a final response agent). LiveKit’s
workflows
guidance shows this approach. • You can also override the
llm_node
to programmatically trim or assemble prompt pieces per step, and use job metadata or agent prewarm to store static/contextual data. Would you like a concise example: 1) a workflow sketch (agents + data flow), or 2) a code snippet showing an
llm_node
that injects retrieved context?
p
example: 1) a workflow sketch (agents + data flow),
t
Below is a concise workflow sketch (agents + data flow) you can implement to split a 75k-character prompt into small, low‑latency steps. Workflow overview 1. Orchestrator Agent ◦ Receives full prompt and user intent. ◦ Splits the large prompt into logical segments (sections/topics) and stores segments in
userdata
or a vector DB. ◦ Decides which specialist agents to call and in what order. 1. Ingestion / Retriever Agent ◦ If using RAG: query vector DB with the user query, return the top N relevant chunks (not the whole 75k). ◦ If not using RAG: pull the specific segments from
userdata
assigned by Orchestrator. 1. Specialist Agents (one or more) ◦ Each handles a focused subtask (e.g., domain A analysis, domain B validation, numeric extraction). ◦ Receive only their segment + minimal context (few hundred–few thousand tokens). ◦ Produce structured outputs and store results back to
userdata
(or return to Orchestrator). 1. Summarizer / Aggregator Agent ◦ Collects specialist outputs, synthesizes into a concise context (summary + facts). ◦ Produces a small, focused prompt for final generation. 1. Response Agent ◦ Uses the summarized context + current user input to generate the final reply. ◦ Sends output to TTS / LiveKit egress. Data flow (simple sequence) User → Orchestrator (split/store) → Retriever → Specialist A → Specialist B → Summarizer → Response → User Implementation notes / tips • Store large static context externally (vector DB or object store). Only retrieve relevant chunks per request. • Use
userdata
or
chat_ctx
to pass small structured state between agents rather than re-sending full text. • Use handoffs (function_tool calls or agent handoff API) to route control between agents. • Keep each agent’s prompt small (ideally <5–10k chars) to reduce TTFT. • Cache embeddings and retrieval results to avoid repeated work. • If you need parallel work, run multiple specialists concurrently and aggregate results in the Summarizer. • For voice: stream intermediate steps non-blocking where possible so the user hears progress quickly. Would you like a short code sketch showing: • how the Orchestrator splits/stores segments and invokes a Specialist, or • an example handoff that passes
userdata
between agents? Sources: Workflows | LiveKit docs | External data and RAG | LiveKit Docs | Agents and handoffs | LiveKit docs | Tool definition and use | LiveKit docs | Tasks and task groups | LiveKit docs
p
does livekit always sends intructions + chat context to the llm calls ?
t
Yes — LiveKit includes the agent’s instructions (system prompt) and the chat context (conversation history) together when making LLM calls. • The
instructions
are sent as the system-level message. • The
chat_ctx
(previous user/assistant messages) is appended as the conversation history. • For realtime models, instructions are passed via the model’s
instructions
parameter while the model manages context, but both pieces still guide generation. If prompt size is a concern, I can suggest ways to trim or manage what gets sent (e.g., summarize history, cache/static context, or use workflows/RAG). Which would you prefer? Sources: Agents v0.x migration guide - Node.js | LiveKit Docs | Agents v0.x migration guide - Python | LiveKit docs | Pipeline nodes and hooks | LiveKit docs | Modifying LLM output before TTS | LiveKit docs | Gemini Live API plugin | LiveKit docs
p
are there any thing that livekit provides for testing that particular conversation between user and agent went well ?
t
Yes — LiveKit provides multiple ways to test and verify that a conversation between a user and an agent went well. What you can use • Built-in testing framework (Python): simulate user inputs, assert agent responses, and use the
judge()
helper to have an LLM evaluate correctness (works with pytest or similar). • Agent Observability / Agent Insights (LiveKit Cloud): ◦ Turn-by-turn transcripts and session timeline ◦ Audio recordings (playback/download) ◦ Session traces, runtime logs, and tool call traces ◦ Metrics per turn (TTFT, token counts, STT/TTS latencies, EOU delays) • Session reports / exports: ◦
ctx.make_session_report()
and
session.history
let you export structured JSON of events, transcripts, and metrics for offline analysis. • Metrics hooks: capture
metrics_collected
events to compute end‑to‑end latencies or custom KPIs. • Third‑party testing tools: integrate voice testing platforms (e.g., Bluejay, Cekura, Coval, Hamming) for large-scale, realistic call simulations. How teams commonly validate "went well" • Automated test suites for intent/response correctness (unit tests + LLM judge). • Listen/playback recordings and compare transcripts to expected answers. • Define success KPIs (e.g., intent accuracy, TTFT < X ms, STT confidence) and compute them from metrics and session reports. • Use RAG/semantic checks in post‑processing to verify factual grounding. Would you like a short example of: • a pytest-style test using the testing framework, or • how to generate and parse
ctx.make_session_report()
JSON to compute KPIs? Sources: Testing and evaluation | LiveKit Docs | Agent insights in LiveKit Cloud | LiveKit docs | Observability data hooks | LiveKit docs
p
i mean like that lets say i defined 3-4 exampler workflows that i want to check. I made a change in prompt (instructions) and now i want to run simulation between the agent's llm (our voice agent) and another llm (which will simulate human according to the workflow i want to test) and then evaluate whether this workflow breaked or worked out
t
You can do exactly that with LiveKit’s testing framework + agent handoffs. High-level approach and a minimal pattern to run automated regression tests where your voice agent (LLM) talks to a simulated human LLM and you assert workflow correctness: 1) Create test scenarios • Define 3–4 workflow scenarios as pairs: (initial user prompt / conversation seed, expected workflow steps or outcomes). • Store each scenario’s seed and expected assertions (e.g., which specialist agents should be invoked, key facts returned, or final intents). 2) Build a simulated-human agent • Implement a lightweight agent that acts as the user. It reads the scenario seed, replies according to the test script, and responds to the voice agent’s prompts. Use a deterministic LLM or temperature=0 to keep replies stable. 3) Use LiveKit’s Python test framework to orchestrate both agents • Spin up the voice agent under test (real agent code). • Connect the simulated-human agent as the participant in the same session. • Drive the conversation by sending the initial seed from the simulated agent, let the voice agent run its workflow (handoffs to specialists), and capture outputs. 4) Evaluate outcomes automatically • Use the testing helpers (e.g.,
result.expect.next_event().is_message(...)
) to assert messages, tool calls, and handoffs. • Use the
judge()
helper to have an LLM evaluate whether the agent’s response meets expected behavior (intent, tone, required facts). • Generate a session report with
ctx.make_session_report()
and inspect
session.history
, traces, and metrics for deeper checks (which agents ran, token costs, latencies). 5) Fail/Pass criteria examples • Specialist agents invoked in correct order (check handoff events or
userdata
). • Final response contains required facts (use exact match or fuzzy matching). • No unexpected tool/error calls. • Latency thresholds (TTFT < X ms) if relevant. Concise test flow (pseudo) 1. Load scenario S. 2. Start voice agent (A) and simulated human agent (H). 3. H sends seed utterance. 4. Wait for A to finish workflow. 5. Collect events, transcripts,
userdata
. 6. Assert expected handoffs/output or run
judge()
to score. 7. Record pass/fail and session report. If you want, I can: • Provide a short pytest-style code snippet showing how to run two agents in a test and assert handoff events, or • Draft an example scenario file format and the judge prompt to evaluate correctness. Which would you prefer?
q
@prehistoric-horse-81038 you can try cekura.ai which specifically solves testing for voice ai agents. You can build any kind of test case on cekura and use it regularly in your CI/CD pipelines to test your infra on every deployment. Lmk in case of any doubts