Real-time voice AI agent
Jev Voice Agent
A speech-to-speech customer-service agent where a fast decision model routes every turn and an LLM only writes the reply, with safety rules enforced in code.
01 · Context
The problem
A voice agent has a tight latency budget. Every mid-call decision (what the caller wants, whether a person is needed, whether the question can be answered) adds delay, and asking an LLM to make those calls is slow and inconsistent.
02 · Approach
The solution
A browser voice agent for Nabda, a fictional Egyptian telecom. Speech is transcribed by Whisper, TypeSafe's Jev model scores intent, mood, urgency, hand-off and account needs, code enforces the rules and picks the knowledge files, a second Jev check decides whether those files can answer, then Qwen writes a reply of at most three sentences that Cartesia voices sentence by sentence. It runs as a Python/WebRTC version and on Cloudflare Workers.
03 · Ownership
Hassan’s documented contribution
The public repository on Hassan’s GitHub documents the whole system: turn logic, identity checks, knowledge routing, a 100-question benchmark harness, voice-cue analysis, and both the Python and Cloudflare Workers deployments.
04 · Engineering
Decisions that shaped the work
- Jev decides, the LLM writes: routing is separated from generation so a fast decision model handles mid-call choices
- Safety lives in code, not the prompt: a customer record never reaches the LLM until identity is verified, so it cannot leak what it never received
- An answerable gate declines politely instead of guessing when the knowledge base does not cover the question
- Replies stream sentence by sentence into text-to-speech, and speaking over the agent stops its audio immediately
- Voice cues compare loudness, pitch and speaking rate with the caller’s own baseline, and are explicitly not an emotion detector
- Swappable speech, LLM and TTS providers, with a benchmark harness comparing one-call, two-call and parallel modes
05 · Reflection
Lesson and next step
Splitting decisions from generation pays off twice: the fast model keeps the call responsive, and rules in code make the safety properties checkable instead of hoped-for.
Rerun the benchmarks on the current version, finish the full speech-to-speech benchmark beyond 2 of 25 turns, and give the agent real tools instead of only describing the next step.
Want the recruiter version or the technical version?
Ask Hassan AI