Most voice agents should transcribe callers over a streaming connection. An AssemblyAI-STT-3.7-Realtime-Agent session returns partial transcripts while the caller is still talking, decides when the turn is over, and holds the turn open around entities like phone numbers and order IDs so they aren't split. That's the work a voice agent needs from its speech-to-text layer, and it's why streaming is the right starting point for nearly every agent.
The Sync API takes a different shape: one HTTP request with a finished clip, one response with the transcript. No socket, no partials, no turn detection. (For how it compares to pre-recorded transcription, see sync vs. async transcription.) That makes it a poor primary path for most agents, but a very useful tool next to one. This post covers where Sync fits in a voice agent, where it doesn't, and the code for each pattern.
Start with streaming
If you're building on LiveKit, Pipecat or your own WebSocket loop, start with AssemblyAI-STT-3.7-Realtime-Agent. On Pipecat it needs pipecat-ai 1.17.0 or newer, where it's the AssemblyAI service's default model. Three things you get from the stream are hard to rebuild on top of a request/response API:
- Partials during the turn. Interim text arrives while the caller is still speaking, so an end-of-utterance model or a speculative LLM call can start before the turn is final.
- Turn detection that understands content. The model decides whether the turn is complete based on what's been said, and entity-aware endpointing holds the turn open when a caller is partway through reading out a number or an email. With Sync, your own VAD makes every one of those calls on silence alone.
- A reliable barge-in signal. The stream sends a
SpeechStartedmessage as soon as the model hears real speech (not just background noise), which is your cue to stop the agent's TTS. A clip-per-turn design only sees speech after the turn ends.
Framework defaults are built around this. LiveKit's end-of-utterance model, for example, reads the transcript as it streams in to decide whether the caller has finished. Feeding it from Sync means calling the API every time your VAD fires and wiring the results back in yourself. It's possible, but it's custom orchestration you'd be signing up for instead of a supported path.
For the full picture of how streaming turn-taking works, see our guide to turn detection and endpointing.
Where Sync helps a voice agent
Sync earns its place in three situations: as a second pass on turns you don't trust, as a recovery path when the stream drops, and as the primary STT for low-volume agents whose teams already own turn detection.
1. A second pass on low-confidence turns
Keep the stream as your primary transcript. When a finished turn comes back with low word confidence, or carries a value you can't afford to get wrong (a card number, an account ID, a spelled-out name), send that turn's audio to Sync for a second read before the LLM acts on it.
Sync returns the finished transcript in about 134 ms at p50, so a second pass adds little to the turn. Pass the recent dialogue as conversation_context so the model knows what the caller was asked. (The examples use Python 3.10+ and requests.)
import io
import json
import wave
import requests
SYNC_URL = "https://sync.assemblyai.com/v1/transcribe"
HEADERS = {
"Authorization": "YOUR_ASSEMBLYAI_API_KEY",
"X-AAI-Model": "universal-3-6-pro",
}
session = requests.Session() # reuse the TLS connection across calls
def pcm_to_wav(pcm: bytes, sample_rate: int = 16000) -> bytes:
"""Wrap 16-bit mono PCM in a WAV header so Sync can read the format."""
buf = io.BytesIO()
with wave.open(buf, "wb") as w:
w.setnchannels(1)
w.setsampwidth(2)
w.setframerate(sample_rate)
w.writeframes(pcm)
return buf.getvalue()
def sync_transcribe(pcm: bytes, context: list[str] | None = None) -> dict:
files = {"audio": ("turn.wav", pcm_to_wav(pcm), "audio/wav")}
if context:
config = {"conversation_context": context}
files["config"] = (None, json.dumps(config), "application/json")
r = session.post(SYNC_URL, headers=HEADERS, files=files, timeout=30)
r.raise_for_status()
return r.json()
def needs_second_pass(words, threshold: float = 0.6) -> bool:
"""True if any word in the streamed turn is below the confidence threshold."""
return any(w.confidence < threshold for w in words)
def final_text_for_turn(turn, turn_audio: bytes, recent_dialogue: list[str]) -> str:
if not needs_second_pass(turn.words):
return turn.transcript
result = sync_transcribe(turn_audio, context=recent_dialogue[-6:])
return result["text"]To use this, keep the PCM for the current turn in a buffer while you stream it, so the same audio is ready to resend. The threshold is yours to tune. Start by logging which turns would have triggered a second pass and compare the two transcripts before you let the second pass change what the agent does.
Stream with AssemblyAI-STT-3.7-Realtime-Agent, then re-check the turns that matter with one Sync API call. Start free.
2. Recovering audio when the WebSocket drops
Streaming connections drop. A network blip closes the socket, you reconnect, and now you're several seconds behind with audio nobody transcribed. You can't send it faster than real time to catch up: the streaming API throttles throughput at about 1.25× real time, so a backlog drains slowly and the transcript lags behind the conversation.
Sync clears the backlog in one call instead. Keep a rolling buffer of recent audio on the client. When the stream fails, send everything since the last finalized turn to Sync, splice the text into the transcript, and reopen the stream:
import collections
SAMPLE_RATE = 16000
BYTES_PER_SECOND = SAMPLE_RATE * 2 # 16-bit mono
BUFFER_SECONDS = 120
class AudioBackfill:
"""Keeps recent audio so a dropped stream can be recovered with one Sync call."""
def __init__(self):
self.buffer = collections.deque(maxlen=BUFFER_SECONDS * BYTES_PER_SECOND)
self.unconfirmed_start = 0 # bytes since the last finalized turn
def add(self, chunk: bytes):
overflow = len(self.buffer) + len(chunk) - self.buffer.maxlen
if overflow > 0:
self.unconfirmed_start = max(0, self.unconfirmed_start - overflow)
self.buffer.extend(chunk)
def turn_finalized(self):
self.unconfirmed_start = len(self.buffer)
def recover(self) -> str:
pending = bytes(self.buffer)[self.unconfirmed_start:]
if len(pending) < BYTES_PER_SECOND // 10: # under 100 ms: nothing to recover
return ""
self.turn_finalized()
return sync_transcribe(pending)["text"]Call add() with every chunk you send to the stream, turn_finalized() when the stream returns a final turn, and recover() from your disconnect handler before you reconnect. A two-minute buffer covers almost every blip, and the HTTP endpoint accepts up to 20 minutes if you need more. Teams running AI note-takers use this pattern in production so a dropped connection never shows up as a gap in the notes.
3. Low-volume agents that already own turn detection
Some teams have built their own harness: their own VAD, their own turn logic, LLM and TTS called as plain HTTP services. For them, Sync can replace the STT stage entirely. Each turn becomes one request:
def handle_turn(turn_audio: bytes, recent_dialogue: list[str]):
transcript = sync_transcribe(turn_audio, context=recent_dialogue[-6:])["text"]
reply = run_llm(transcript) # your LLM call
audio = synthesize(reply) # your TTS call
play(audio)This makes the most sense when call volume is low and cost matters. Sync is priced at $0.30/hr of audio sent, and you only send speech, so an agent that sits idle between short exchanges isn't paying to keep a connection open. Pre-warm the connection with GET /v1/warm so the TLS handshake isn't on the critical path of the first turn. If you build on Pipecat, the Sync STT on Pipecat guide shows a supported integration with prewarming built in.
Be clear about what you're taking on. Every decision about when a turn ends now rests on your VAD and silence thresholds. If those are wrong, callers get cut off mid-number or wait through dead air, and no transcription speed fixes that. If you don't already have turn logic you trust, use streaming.
Which to use
| AssemblyAI-STT-3.7-Realtime-Agent | Sync API | |
|---|---|---|
| Role in a voice agent | Primary STT for nearly every agent | Second pass, failover, or primary STT for a custom low-volume harness |
| Shape | WebSocket stream | One HTTP request per clip |
| Partials during the turn | Yes | No |
| Turn detection | Built in, aware of entities | Yours (client-side VAD) |
| Barge-in signal | SpeechStarted as soon as speech begins |
Yours (client-side VAD) |
| Latency | Partials as the caller speaks | ~134 ms p50 after the clip ends |
| Clip length | Unbounded session | 80 ms to 20 min per request |
| Price | $0.45/hr | $0.30/hr |
The short version: build the agent on AssemblyAI-STT-3.7-Realtime-Agent, and add Sync where a turn needs a second look or a connection needs rescuing. Run the whole agent on Sync only if you already own turn detection and your volume is low enough that the savings matter.
Use streaming for every turn and Sync for second passes and recovery, all from one API key. Start free.
Frequently Asked Questions (FAQs)
Should I use the Sync API or streaming for a voice agent?
Use streaming. AssemblyAI-STT-3.7-Realtime-Agent gives a voice agent partial transcripts during the turn, turn detection that waits for entities like phone numbers, and a barge-in signal, all over one connection. The Sync API is best used alongside it: as a second pass on low-confidence turns, or to recover audio when the WebSocket drops. Running an agent on Sync alone only makes sense for low-volume agents whose teams already run their own turn detection.
What is the sync HTTP pattern for voice agents?
It's a design where each turn is transcribed with one stateless HTTP request instead of a streaming connection. Your own voice activity detection decides when a turn has ended, you POST that clip to the Sync API, and the transcript comes back in the same response. It trades away partials and built-in turn detection in exchange for a simpler, request/response architecture.
How can the Sync API improve voice agent accuracy?
Use it as a second pass. Keep streaming as the primary transcript, and when a finished turn has low word confidence or contains a high-stakes value like a card number, send that turn's audio to Sync with the recent dialogue as conversation_context. The finished transcript comes back in about 134 ms at p50, so the extra check adds little to the turn.
How do I recover transcription after a streaming WebSocket disconnects?
Keep a rolling buffer of recent audio on the client. When the connection drops, send the audio since the last finalized turn to the Sync API in one request, insert the returned text into your transcript, and reconnect the stream. This avoids replaying the backlog over the new connection, which the streaming API throttles to about 1.25× real time.
Do I need my own voice activity detection to use Sync in a voice agent?
Only if Sync is your primary STT. Then your VAD decides when every turn starts and ends, and weak turn detection will cut callers off or leave dead air. For the second-pass and failover patterns, streaming still handles turn detection and Sync only re-transcribes audio you already have.
What are the Sync API's limits and pricing?
The HTTP endpoint accepts audio from 80 ms up to 20 minutes per request, and the SDKs and live-upload endpoint accept up to 120 seconds of WAV or raw PCM. Sync runs on Universal-3.6 Pro, returns results in about 134 ms at p50, and is priced at $0.30/hr, with keyterms prompting and conversation context included. See the Sync API docs for the full request format.