AssemblyAI-STT-3.7-Realtime-Agent + LiveKit
# LiveKit + AssemblyAI STT in a financial services agent pipeline
from livekit.agents import Agent, AgentSession, TurnHandlingOptions
from livekit.plugins import assemblyai, cartesia, openai, silero
class FinancialAgent(Agent):
def __init__(self):
super().__init__(
instructions=(
"You are an account services agent for First National Bank. "
"Verify identity before disclosing account information. Be concise."
),
)
async def entrypoint(ctx):
session = AgentSession(
stt=assemblyai.STT(
model="assemblyai-stt-3-7-realtime-agent",
min_turn_silence=100,
max_turn_silence=3000, # callers pause to look up accounts / read numbers
vad_threshold=0.3,
keyterms_prompt=["First National", "rewards checking",
"premium savings", "Reg E", "provisional credit"],
),
llm=openai.LLM(model="gpt-4o"),
tts=cartesia.TTS(),
vad=silero.VAD.load(activation_threshold=0.3),
turn_handling=TurnHandlingOptions(
turn_detection="stt",
endpointing={"min_delay": 0}, # avoid additive latency in STT-driven turns
),
)
await session.start(room=ctx.room, agent=FinancialAgent())