How amritpalsingh0007/interview_agent works
Project Type & Purpose
• This is a full-stack, real-time “interview agent” prototype.
• It consists of three coordinated services:
• A React/Vite frontend for user interaction
• A FastAPI backend exposing REST/WebSocket endpoints
• A Python “livekitAgent” service managing real-time media, LLM / STT / TTS integration, and persistence
File Structure
• Top-level directories:
• frontend/ – React app (Vite, JSX, CSS, ESLint config)
• backend/ – FastAPI server (server.py)
• livekitAgent/ – AgentSession orchestration, RPC layer, config, data classes, Mongo & Redis clients
• Config files signal environment-specific setup (.env.example), build tooling (vite.config.js), and Python deps (requirements.txt).
Readme Insights
• The Readme instructs running three separate processes (frontend, backend, livekitAgent), points to LLM/STT/TTS pluggable providers, and uses LiveKit for real-time voice.
Main Components & Their Interactions
1. User’s Browser (React Frontend)
2. FastAPI Backend (server.py)
3. livekitAgent Service
– AgentSession core
– RPC endpoint (agent_rpc.py)
– Data classes (interview_data.py)
– Config (config.py)
– Persistence: MongoDB client, Redis client
4. LiveKit Media Server (external real-time streaming)
5. External ML Services (STT, LLM, TTS providers)
6. Data Stores: MongoDB, Redis
b. Relationships & data flow:
• The Browser connects to the LiveKit Media Server (WebRTC) for real-time voice streams.
• The Browser also calls the FastAPI backend (REST/WebSocket) for session control, metadata retrieval.
• FastAPI backend communicates (RPC/HTTP) with livekitAgent to orchestrate LLM/STT/TTS and store conversation state.
• livekitAgent:
• Ingests audio from LiveKit, sends to STT provider -> obtains transcript.
• Sends transcript + context to LLM provider -> obtains response text.
• Sends response text to TTS provider -> obtains audio.
• Pushes audio back into LiveKit Media Server.
• livekitAgent persists transcripts and session data in MongoDB and caches state or rate-limits in Redis.
c. Architectural patterns & design principles:
• Three-tier separation: Presentation | Application | Data
• Microservice-style: independent deployable agent service
• Pluggable provider pattern for STT/LLM/TTS
• RPC abstraction between backend and agent
• Event-driven media flow via LiveKit
d. Key technologies / frameworks:
• Frontend: React, Vite, JSX, CSS
• Backend: Python, FastAPI, Uvicorn
• Agent: Python 3.x, livekit-python, custom STT/LLM/TTS clients, Pydantic data classes
• Datastores: MongoDB, Redis
• Dev tooling: ESLint, npm, pip
Essential Details to Capture
• ENV config at each service (pointing to .env files).
• Plug-in points in livekitAgent (“CustomSTT”, “CustomTTS”, “google.LLM”).
• Redis usage for caching/session and MongoDB for persistence.
• Don’t overcrowd: group components logically but label them fully.