TheNegotiator
A gamified trainer where you practice high-stakes deals against a lifelike AI counterpart that pushes back, and get scored on every move. Built to answer one question: can you put a live LLM at the center of a product and still have it be demo-proof, deterministic to grade, and safe to ship?
Negotiation is a skill you only build by doing it against someone who fights back, and most people never get the reps. An LLM is the obvious sparring partner. The trap is equally obvious: an app whose core loop is a live model call is fragile in exactly the moments that matter. The API key is missing on stage, the model returns prose you can't score, latency spikes mid-demo.
TheNegotiator treats those failure modes as first-class design constraints, not edge cases to apologize for. The AI is the star of the product, and the product still works when the AI is unavailable.
> the client never talks to a raw model. it talks to typed flows that either call Gemini or fall back, and always return the same shape.
Plays with, or without, the AI
Every Genkit flow has a scripted fallback. Give it a GEMINI_API_KEY and the opponent is live; take it away and the game still runs on deterministic scripts. The product demos on a stage with no wifi and ships without betting availability on a third-party API. Graceful degradation is built in, not bolted on.
Scores are data, not prose
Every move is graded through structured output: the model returns typed JSON the game logic can trust, not a paragraph someone has to parse. That's what makes XP, streaks and leagues actually work, the scoring is deterministic to consume even though the reasoning behind it is generated.
AI as typed flows, not loose prompts
Opponent, coaching and scenario generation are separate Genkit flows with input and output schemas, not ad-hoc prompt strings scattered through the UI. Each is composable, swappable and testable on its own, and the client only ever sees a stable contract. The AI layer has a shape you can reason about.
Reproducible from the first clone
The whole dev environment runs in a container (Podman), with dependencies in a named volume so the host machine stays clean. One script starts it; there is no "works on my machine." The same discipline carries the app to Cloud Run, and Firebase handles auth and per-user progress with rules that isolate each player's data.
TheNegotiator is a game, but the constraints are the ones every serious AI feature hits: don't let a third-party model be a single point of failure, make the AI's output a typed contract so the rest of the system can trust it, and structure the AI as flows you can test instead of prompts you hope work. Put an LLM at the center and still sleep at night, that's the job.