A real-time bidirectional conversational AI agent engineered with GPT-4.1, WebSocket audio streaming, and ElevenLabs TTS synthesis.

Traditional conversational AI agents suffer from jarring latency pauses between user speech and generated voice response. This project eliminates that friction by building an ultra-low latency, bidirectional voice agent pipeline operating with sub-300ms latency.
The architecture uses full-duplex WebSockets to stream raw audio chunks from the client to a Python/FastAPI backend. Incoming audio is processed by streaming speech-to-text with voice activity detection (VAD) and interrupt handling, allowing users to naturally interrupt the agent mid-sentence.
Reasoning is powered by GPT-4.1 with structured system prompts and token streaming directly into ElevenLabs WebSocket synthesis endpoints. Sentences and clauses are synthesized incrementally as tokens generate, enabling instant audio playback with natural cadence and multilingual adaptability.