Skip to content
cd ..~/abhay/projects/vaani.md · 6.1K · case study 04 of 09

9 files open · click a tab, or use prev / next at the bottom of the page

// case 04 — Voice + video agent · 2026

Vaani.md

A face-to-face AI companion you can talk to for 20 minutes, in English or Hinglish.

> A real-time voice and avatar agent with plain-code safety rules and evals for every change.

MY ROLESolo build: agent, evals and infra
TIMELINEOct 2026 — now
TEAMJust me
STACK
LiveKit AgentsPythonAnthropicSarvamCartesiaLemonSlicePostgreSQLRedis
vaani · live call · 20:00
room joined · avatar on · 20:00 session clock started
stt sarvam · english + hinglish
rules crisis / age / wrap-up check (plain code, no AI)
brain anthropic · skill: open conversation
voice cartesia (backup: sarvam bulbul)
WAIT brain slow → filler clip "hmm..." while waiting
OK turn done · timing + cost per vendor logged
memory: session log + redis cache · "forget that" honoured
$
PIPELINE
1Speech in
2Rules check
3Brain
4Voice
5Avatar
SESSION20 min
LANGUAGESEN · Hinglish
SKILLS5
face-to-face, in Hinglish
// 01 — context

the problem_

cat problem.md

Voice AI decides turns mostly from silence: stop making sound and it starts talking; make any sound and it stops. People don't talk like that. For a 20-minute conversation in Hinglish, the turn-taking, the latency and the safety rules decide whether it feels like a person or a phone menu.

Vaani is built in versions. Version 0 is the baseline: voice, character, five conversation skills, memory within a call and a face. Version 0.5 adds the Reading Engine, which reads face and voice together to decide turns.

## constraints
  • Real-time latency
  • English + Hinglish
  • Adults only
  • Video never leaves the laptop
  • Any vendor can fail
  • Every change evaluated
./my-role.sh --verbose

abhay@os ~ % what did I actually do?

  1. 01Built the LiveKit agent in Python: a conductor that runs one turn from start to finish against a session clock.
  2. 02Put every outside service behind one swappable connection: Sarvam speech-to-text, Anthropic as the brain, Cartesia voice with Sarvam Bulbul as backup, LemonSlice avatar.
  3. 03Wrote the rules check in plain code, no AI: crisis, heavy disclosure, under-18 and wrap-up patterns in English and Roman Hinglish, applied on the same turn.
  4. 04Built reliability: fallbacks, pre-recorded filler and hiccup clips in Vaani's voice, rejoin and admission control.
  5. 05Built the eval runner with working and hidden test sets, an AI judge calibrated against my own ratings, and a result record for every run.

[ ok ] exit 0 · 5 tasks · owner: abhay

// 02 — results

what moved_

Three numbers I'd put on a slide. Measured in production, not in a benchmark I wrote the night before.

SESSION20 minface-to-face conversationEnglish or Hinglish, five conversation skills.
VENDORS5swappable connectionsSpeech, brain, voice, avatar, decision model.
EVALSevery rungets a result recordWorking and hidden sets, judge calibrated by hand.
// 03 — architecture

how it fits_

The design documents are the source of truth: decisions are numbered (RE-D1, V0-D1…) and each phase names the folders it may touch.

open architecture.excalidraw — vaani
CALL
Web pageNext.js · consent
LiveKit roomaudio + avatar
audio
CONDUCTOR
Speech inSarvam STT
Rules checkplain code
turn
MIND
BrainAnthropic · skills
Backgroundnext skill · safety
reply
OUT
VoiceCartesia · Bulbul
AvatarLemonSlice
MemoryPostgres · Redis
request / write pathresponse / events backonly a few numbers per frame leave the laptop
// 04 — key decisions

git blame me_

adr-001.md
CHOSE

Safety rules in plain code

REJECTED

Asking the model to spot a crisis

TRADE-OFF

Word lists miss vague wording, so a second net runs on the next turn, but the crisis rule always applies on the same turn and never depends on a model.

adr-002.md
CHOSE

One swappable connection per vendor

REJECTED

Calling SDKs from the conductor

TRADE-OFF

An extra layer, but a voice or brain outage falls back without touching the turn logic.

adr-003.md
CHOSE

Report only what is visible

REJECTED

Emotion detection

TRADE-OFF

Less to say about the person, but guessing feelings from faces is unreliable and feels invasive.

// 05 — under the hood

the good bit_

vim agent/rules_check/patterns.pyPython
1def words(*phrases: str) -> re.Pattern[str]:
2 """Any of the phrases as whole words, ignoring case."""
3 joined = '|'.join(re.escape(p).replace(r'\ ', r'\s+') for p in phrases)
4 return re.compile(rf'(?<![a-z])(?:{joined})(?![a-z])', re.IGNORECASE)
5
6
7# Crisis: thoughts of self-harm, or being in danger (English + Hinglish)
8CRISIS = words(
9 'want to die', 'end my life', 'hurt myself', 'self harm',
10 'jeena nahi chahta', 'jeena nahi chahti', 'khudkushi',
11)
NORMAL agent/rules_check/patterns.py11 lines · utf-8

Plain code, no AI: the crisis and age rules must apply on the same turn and never depend on a model. Every list has tests.

less lessons.txt

If I built it again, I'd change…

  1. L1Silence is not a turnA pause can mean thinking, not done. That is the whole reason for the Reading Engine.
  2. L2Measure every stageSteady timers per stage and cost per vendor showed which hop was slow, not just that the call felt slow.
  3. L3Calibrate the judgeAn AI judge is only useful after you check it against your own ratings.

lessons.txt (END) — press q to quit

// 06 — timeline

git log --since_

Oct 2026 — now

git log --reverse --format=milestone vaani
  1. 0119 Oct 2026DesignReading Engine design document and version 0 plan.
  2. 02Oct 2026Talking pipeConductor, vendors, telemetry, reliability.
  3. 03Oct 2026Vaani's mindPrompts, rules check, background decisions, judge.
  4. 04Now20 minutesMemory, the face, then the Reading Engine.
cd ~/work./contact — itsabhay@abhay.si