About the project
Inspiration
In today's fast-paced professional world, the ability to negotiate effectively is more than just a skill—it's a competitive advantage. Whether you're closing a high-stakes B2B deal, navigating a complex real-estate transaction, or simply asking for a well-deserved raise, the quality of your communication determines your outcome. However, practicing these high-stress situations is incredibly difficult. We were inspired to build Negotiations Coach to level the playing field, providing everyone with a safe, realistic, and highly analytical environment to master the art of persuasion.
What it does
Negotiations Coach is an experimental AI-powered training platform that acts as your live sparring partner. It goes far beyond a standard text chatbot by offering:
- The Sparring Ring: A real-time, low-latency voice roleplay environment powered by Gemini's native audio model. The agent listens, speaks, and handles interruptions naturally.
- Live Telemetry & Visual Cues: Real-time tracking of your stress levels and body language (eye contact, posture).
- The "Time Out" Mechanic: At any point, you can ask for a time-out. The AI seamlessly breaks character, switches to "Coach Mode" to offer tactical advice based on frameworks like Chris Voss's Tactical Empathy, and then jumps right back into the simulation.
- Post-Match Analysis: A rigorous breakdown of your performance, calculating a comprehensive score based on your captured deal value, clarity, and persuasion tactics.
The underlying performance index is calculated as a weighted sum of your micro-interactions:
![][image1](Where ![][image2] is Persuasion, ![][image3] is Empathy, ![][image4] is Clarity, and ![][image5] represents the physiological penalty derived from hesitation and visual cues).
How we built it
To achieve sub-second voice latency, we engineered a highly optimized, unified full-stack architecture.
Rather than exposing API keys in a client-side React app, we built a custom Node.js/Express server that acts as a secure middleman. It serves our compiled Vite/React frontend statically while simultaneously managing stateful, bidirectional WebSocket connections to the Gemini 2.5 Live API (gemini-2.5-flash-native-audio-preview-12-2025).
We also utilized the Gemini Function Calling API to enable our complex context-switching (Opponent vs. Coach) and to silently stream real-time telemetry back to the React frontend while the audio is playing. The entire application is containerized via Docker and deployed natively to Google Cloud Run for zero-downtime, scalable access.
Challenges we ran into
Bridging the gap between the browser's Web Audio API and the strict requirements of the Gemini Live API was our biggest hurdle. Browsers operate using Float32 audio, whereas Gemini requires 16-bit PCM at 16kHz.
We had to build a custom digital signal processing (DSP) pipeline in TypeScript that captures the raw audio, downsamples it, converts it to PCM16, and implements a Custom Digital Noise Gate. Without this noise gate, background room noise would keep the microphone channel "open," preventing Gemini's Voice Activity Detection (VAD) from realizing the user had stopped speaking. Furthermore, we implemented linear interpolation to upsample the 16kHz AI audio response back to 24kHz for natural-sounding browser playback.
Accomplishments that we're proud of
We are incredibly proud of achieving true sub-second voice latency. The conversation feels completely natural; you can interrupt the AI, and it stops instantly. We are also proud of the dynamic UI—watching the React Recharts and Stress Meters react in real-time to the hidden telemetry tool-calls sent by Gemini feels like magic.
What we learned
We gained a massive appreciation for real-time audio streaming (WebSockets + Web Audio API) and advanced prompt engineering. We learned how to effectively use Google AI Studio to prototype complex, multi-persona system instructions and seamlessly port them into a production Node.js environment.
What's next for Negotiations Coach
We plan to introduce "Multiplayer Mode" where two humans can negotiate while the AI acts as a silent observer and mediator, providing a joint breakdown at the end. We also want to integrate custom PDF uploads, allowing users to practice negotiating the exact terms of their real-world contracts.
Built With
- docker
- gcr
- genai
- react
- recharts
- tailwind
- typescript
- vite