How charanms0125/the-negotiator works
The Negotiator is a full-stack application for configuring and running budget-bounded merchant negotiations, then comparing offers and auditing evidence. Buyers use the Streamlit dashboard to manage retailers, create and monitor sessions, and review recommendations and history. The FastAPI API launches session orchestration; the session manager coordinates negotiation strategy, AI dialogue, voice calls, evidence extraction, and persistence. Offer scoring produces normalized comparisons for the frontend. README capabilities are included, though several page and service implementations were not sampled; their connections are shown only where the excerpts, SOURCE INDEX, or README support them.
Main entry points: app.py Streamlit Navigation · api_client.py HTTP API Client · session_manager.py Session Orchestrator · routes.py FastAPI Routes
Components 22
Buyer Dashboard
- Streamlit Navigation
frontend/app.py - Negotiation Setup
frontend/pages/new_negotiation.py - Retailer Directory
frontend/pages/business_management.py - Live Control Room
frontend/pages/live_negotiation.py - Dashboard and History
frontend/pages/dashboard.py - Session Archives
frontend/pages/history.py - Offer Comparison
frontend/pages/offer_comparison.py - Recommendation View
frontend/pages/recommendation.py - HTTP API Client
frontend/services/api_client.py
API and Contracts
- FastAPI Routes
backend/app/api/routes.py - Request and Result Schemas
backend/app/schemas/schemas.py
Negotiation Runtime
- Session Orchestrator
backend/app/services/session_manager.py - Negotiation State Machine
backend/app/services/negotiation_engine.py - Dialogue and Extraction AI
backend/app/services/llm_service.py - Voice Provider
backend/app/services/voice_service.py
Evidence and Results
- Evidence Audit
backend/app/services/evidence_service.py - Offer Normalization
backend/app/services/recommendation_engine.py
Persistence
- Session and Offer Store
backend/app/database/db.py
Other components
- Buyer
- Authorized Retailer
- Gemini API
- Twilio Telephony
Connections 29
- Buyer → Streamlit Navigation: uses
frontend/app.py - Streamlit Navigation → Negotiation Setup: routes to
frontend/app.py - Streamlit Navigation → Retailer Directory: routes to
frontend/app.py - Streamlit Navigation → Live Control Room: routes to
frontend/app.py - Streamlit Navigation → Dashboard and History: routes to
frontend/app.py - Streamlit Navigation → Session Archives: routes to
frontend/app.py - Streamlit Navigation → Offer Comparison: routes to
frontend/app.py - Streamlit Navigation → Recommendation View: routes to
frontend/app.py - Negotiation Setup → HTTP API Client: submits through
frontend/pages/new_negotiation.py - Retailer Directory → HTTP API Client: manages through
frontend/pages/business_management.py - Live Control Room → HTTP API Client: controls through
frontend/pages/live_negotiation.py - Dashboard and History → HTTP API Client: fetches through
frontend/pages/dashboard.py - Session Archives → HTTP API Client: fetches through
frontend/pages/history.py - Offer Comparison → HTTP API Client: fetches through
frontend/pages/offer_comparison.py - Recommendation View → HTTP API Client: fetches through
frontend/pages/recommendation.py - HTTP API Client → FastAPI Routes: sends HTTP
frontend/services/api_client.py - FastAPI Routes → Request and Result Schemas: validates with
backend/app/api/routes.py - FastAPI Routes → Session and Offer Store: reads and writes
backend/app/api/routes.py - FastAPI Routes → Session Orchestrator: starts sessions
backend/app/api/routes.py - FastAPI Routes → Offer Normalization: scores offers
backend/app/api/routes.py - Session Orchestrator → Negotiation State Machine: chooses counters
backend/app/services/session_manager.py - Session Orchestrator → Dialogue and Extraction AI: generates dialogue
backend/app/services/session_manager.py - Session Orchestrator → Evidence Audit: audits transcripts
backend/app/services/session_manager.py - Session Orchestrator → Voice Provider: runs calls
backend/app/services/session_manager.py - Session Orchestrator → Session and Offer Store: persists session data
backend/app/services/session_manager.py - Voice Provider → Authorized Retailer: conducts call
README.md - Voice Provider → Twilio Telephony: can use
README.md - Dialogue and Extraction AI → Gemini API: can query
backend/app/services/llm_service.py - Offer Normalization → Session and Offer Store: scores stored offers