Voice-First Teaching Voice Agent - System Architecture & Design
Mentors spend hours manually creating lesson plans, slides, and practice sets for each session. Repetitive work steals time from actual teaching.
Mentor speaks topic. Zeno asks 7 discovery questions using Human-in-the-Loop methodology via LiveKit.
Searches 50+ lectures via FAISS semantic search to surface related prior content.
Proprietary two-phase engine: LLM parses intent into JSON spec, then deterministic renderer produces branded PPTX/DOCX. 10x cheaper than raw LLM generation.
Lesson plan + slides + practice sets uploaded automatically to Google Drive via OAuth2. Zero manual steps.
Handles full HITL conversation, calls 5 specialized tools
5 Specialized Tools (Flat Architecture - No Multi-Agent Overhead)
LessonPlans/ | Slides/ | Practice/ (OAuth2, automatic upload)
Single Agent | No Multi-Agent Orchestration | Worker Pattern for Heavy Tasks
1. Data Source
Data_Doc_main.txt | 316KB | 33 lectures
2. Embeddings
OpenAI text-embedding-3-small | 1536 dims
3. Vector DB
FAISS IndexFlatL2 | L2 distance | 202KB
4. Semantic Search
Real-time context injection during HITL conversation
Voice I/O: LiveKit AgentSession
Session LLM: Claude Haiku (120s, $0.80/MTok)
Lesson Generator: Claude Haiku worker (400s)
Embeddings: OpenAI text-embedding-3-small
Vector Search: FAISS CPU (IndexFlatL2)
PDF/PPTX/DOCX: Custom Skill Infrastructure
Storage: Google Drive API (OAuth2)
Anthropic's Skills API with raw LLM generation was costing 10x more per deck and producing inconsistent, off-brand output. We replaced the expensive free-form generation with a deterministic rendering engine — built entirely from scratch.
parser.py extracts slide structure. renderer.py builds PPTX with 9 typed slide templates using Space Grotesk + coral theme.
ps_parser.py extracts 3-level exercises. ps_renderer.py builds DOCX with Beginner/Intermediate/Advanced sections.
Phase 2 runs pure Python. No LLM tokens consumed for formatting, layout, or branding. Only Phase 1 incurs API cost.
Model: Claude Sonnet / Opus for full generation
Tokens per deck: ~8k input + ~5k output
Sonnet cost: ~$0.099/deck
Opus cost: ~$0.495/deck
Quality: Inconsistent, off-brand layout
Failure rate: High (LLM formatting errors)
Phase 1 (LLM): Claude Sonnet for JSON spec only
Tokens for spec: ~3k input + ~2k output
Sonnet spec cost: ~$0.039/deck
Phase 2 (Python): $0.000/deck
Quality: Pixel-perfect, brand-consistent
Failure rate: Near-zero (deterministic)
| Metric | Before (Sonnet raw) | Now (Custom Infra + Sonnet) | Saving |
|---|---|---|---|
| Slide Deck Cost | $0.099 | $0.039 | 60% cheaper |
| Practice Set Cost | $0.099 | $0.039 | 60% cheaper |
| Full Lesson (plan+slides+practice) | ~$0.40 | ~$0.13 | 67% cheaper |
| Output consistency | Unpredictable | 100% deterministic rendering | Zero formatting bugs |
* Switch Phase 1 to Claude Haiku ($0.80/MTok) for further 4x reduction. Full lesson drops to ~$0.05.
Skills/slide-deck/generator/
parser.py — LLM extracts slide JSON spec from lesson plan. Runs Claude API call with typed schema.
schema.py — PresentationSpec + SlideSpec Pydantic models. Validates LLM output.
renderer.py — SlideRenderer dispatches each slide to typed render function via python-pptx.
slide_types.py — 9 typed slide renderers: title, question, comparison, reveal, process, definition, architecture, best-practice, takeaway.
styles.py — Exact RGB colors, Space Grotesk font, coral (#F96846) palette enforced.
Output: 13-20 slide PPTX, 10"x7.5" 16:9, pixel-perfect branding. Uploaded to Google Drive/Slides/
Skills/practice-set-extracted/generator/
ps_parser.py — LLM extracts 3-level exercise spec (Beginner/Intermediate/Advanced) with web search for real-world scenarios.
ps_schema.py — PracticeSetSpec + DifficultyLevel Pydantic models.
ps_renderer.py — PracticeSetRenderer builds DOCX via python-docx with JetBrains Mono for code blocks.
ps_styles.py — Colors, Fonts, FontSizes constants. Consistent brand across every document.
ps_utils.py — JetBrains Mono auto-download. Table styles. Code block formatting.
Output: DOCX with 3 difficulty tiers, real-world problem statements. Uploaded to Google Drive/Practice/
"Edith" wake word triggers session
Mentor speaks topic (e.g., "multi-agent systems")
Agent runs search_curriculum → FAISS top-5
Runs get_full_lecture → 4000-char context
7 discovery questions (Socratic, voice, one-at-a-time)
generate_lesson_plan worker (400s, separate API
call)
Lesson Plan Worker
Extracts HITL chat history → Claude Haiku (400s timeout) → 1500-word Markdown → Drive/LessonPlans/
Slide Generation (voice: "make slides")
skills_handler.generate_slides() → upload .md → Anthropic Skills container → Custom Skill Infrastructure → PPTX → Drive/Slides/
Practice Set (voice: "make practice")
skills_handler.generate_practice_set() → same pipeline → DOCX → Drive/Practice/
End State
Agent speaks Drive links. User says "good night" → session closes. Zero manual steps taken.
A voice agent that listens, reasons, and produces production-quality teaching materials — with a proprietary skill engine that makes it 10x cheaper than out-of-the-box AI generation.
Hands-free from wake word to Drive upload. Built for Raspberry Pi deployment.
33-lecture curriculum always in context. Socratic questions reference actual lecture content.
Deterministic rendering. 10x cost reduction. Pixel-perfect branded output every time.