AIToday

AI Phone Agent Lets You Practice Negotiations with Real-Time Feedback

Hacker News8h ago
AI Phone Agent Lets You Practice Negotiations with Real-Time Feedback

Key takeaway

Telnyx has released an open-source Python application that turns a phone call into a negotiation practice tool. Callers dial in, choose a scenario (salary negotiation, sales deal, or vendor contract), and conduct a live conversation with an AI that plays the opposing role, maintains hidden constraints, and adapts to the caller's moves. After the call ends, the AI evaluates performance across five dimensions and delivers a structured score with specific strengths and areas for improvement, eliminating the need for a paid coach or awkward practice with colleagues.

Summaries like this, in your inbox every morning.

Sign up free →

3 Key Points

  • What happened

    Telnyx has published a walkthrough for building an AI Negotiation Practice Phone — a 110-line Python app that lets callers dial in, select from three negotiation scenarios (salary, sales deal, vendor contract), and conduct a live voice conversation with an AI opponent (powered by Llama 3.3 70B) that stays in character, pushes back, and adapts to the caller's approach.

  • Why it matters

    Most negotiation training is text-based or pre-recorded; this puts callers under real-time pressure on an actual phone call where the AI has hidden constraints (like a budget range) the caller must discover. After hanging up, the AI scores performance across five dimensions — anchoring, concession strategy, active listening, creativity, and confidence — giving immediate, actionable feedback and making it possible to practice the same scenario multiple times and track improvement.

  • What to watch

    The app demonstrates a two-input pattern (DTMF keypad for menu selection, then speech recognition for negotiation) common in real-world IVR workflows. Every practice session is stored and accessible via a GET /sessions endpoint, enabling tracking of progress over time. The code is open-source and ready to clone and run locally with a Telnyx account and phone number.

In Depth

Telnyx has published a complete walkthrough for building an AI Negotiation Practice Phone using a 110-line Python Flask app, Telnyx Call Control, and Telnyx AI Inference (Llama 3.3 70B). The app allows anyone with a Telnyx phone number to dial in and practice negotiation against an AI opponent that adapts to the caller's approach and delivers structured performance feedback after the call.

When a caller dials the number, they hear a menu prompt asking them to press 1 for salary negotiation, 2 for sales deal, or 3 for vendor contract. Each scenario has a defined role and hidden context. In the salary negotiation, the AI plays a hiring manager with a budget range of $155K–$165K and the ability to offer equity or signing bonuses. In the sales deal, the AI plays an enterprise buyer with a competing offer at $35K and a target budget of $45K. In the vendor contract scenario, the AI plays an account manager who can offer a maximum 15% discount. The caller does not see these constraints; they must be discovered through negotiation.

Once the caller selects a scenario by pressing a digit, the app loads that scenario's context into a system prompt, asks the AI for an opening negotiating position, and switches to speech-gathering mode. From that point forward, every exchange follows the same loop: the caller speaks naturally, the app transcribes their speech, sends the full conversation history to the AI along with their new statement, receives the AI's response, and plays it back via text-to-speech. The AI maintains context across all turns, remembering previous offers, constraints mentioned, and alternative solutions proposed.

After the caller hangs up, the app captures the complete conversation and sends it to the AI with a scoring prompt. The AI then evaluates the negotiation across five dimensions — anchoring (1–10), concession strategy (1–10), active listening (1–10), creativity (1–10), and confidence (1–10) — and returns a structured JSON object that includes an overall score, a list of identified strengths, a list of improvements, and a description of the final deal outcome. For example, a caller might receive a score of 6.6 overall, with feedback like "Strong opening anchor at $180K" under strengths and "Conceded too quickly on base salary" under improvements. Every session is stored in memory and can be retrieved via a GET /sessions endpoint, which returns the last 20 sessions as JSON, enabling callers to track their progress across multiple attempts.

To run the app, a user clones the Telnyx code examples repository, installs dependencies (requests, Flask, python-dotenv), configures environment variables with their Telnyx API key and phone number, and starts a Flask server on localhost:5000. They then expose the server to the internet using ngrok, set the ngrok HTTPS URL as the webhook URL in their Telnyx Call Control Application, and assign their Telnyx phone number to that application. From that point, any inbound call to that number triggers the app's webhook handler, which orchestrates the entire negotiation session. The app includes a background cleanup thread that removes stale call state after one hour to prevent memory leaks in long-running deployments.

The walkthrough includes the full source code, architectural diagrams showing the webhook event flow (call.initiated → call.answered → call.speak.ended → call.gather.ended → call.hangup), and instructions for customizing the scenarios — for instance, adding a real estate negotiation, adjusting the AI's aggressiveness, or changing the number of exchanges before the AI begins wrapping up the call. The temperature setting for inference is 0.7 (deliberately higher than a typical customer-service chatbot at 0.5) to introduce enough variability that the AI's responses feel realistic and unpredictable, rather than perfectly scripted.

Context & Analysis

Telnyx's negotiation practice tool addresses a real gap in professional training: most negotiation coaching is either asynchronous (video courses, text chatbots) or logistically difficult (scheduling mock interviews with a human coach). By placing the practice session on an actual phone call, the application captures the psychological pressure of live negotiation — the pauses, the real-time decision-making, the discomfort of pushback. The AI opponent is not static; it has hidden constraints (budget ranges, discount limits) that the caller must discover through conversation, mirroring how real negotiations work.

The scoring mechanism transforms the interaction from mere practice into a coaching tool. By tracking five distinct dimensions — anchoring (setting the opening position), concession strategy (how you move off your initial ask), active listening (acknowledging the other side's constraints), creativity (finding alternative solutions like equity or signing bonuses), and confidence (staying firm or caving) — the app gives the caller specific, actionable feedback. A caller can run the same scenario five times and watch their overall score and individual dimension scores improve, creating measurable progress.

The technical design is notable for its simplicity and its demonstration of a two-input pattern (DTMF menu followed by speech recognition) that appears in many real-world IVR (Interactive Voice Response) systems used by enterprises today. The app's use of Telnyx AI Inference with Llama 3.3 70B, a temperature of 0.7 (higher than typical customer-service chatbots to encourage variability and realism), and a 200-token response limit keeps the AI responses concise and conversational. The full conversation history is retained and sent to the AI for post-call scoring, allowing the scoring prompt to see all offers, counteroffers, and reasoning without hallucination or context loss.

FAQ

What scenarios does the practice phone support?
Three built-in scenarios: salary negotiation (the AI plays a hiring manager with a $155K–$165K budget), sales deal (the AI plays an enterprise buyer looking to negotiate a $50K/year SaaS contract down to $45K), and vendor contract (the AI plays a vendor account manager who can offer up to a 15% discount).
How does the AI score my performance?
After you hang up, the AI evaluates the full conversation across five dimensions — anchoring, concession strategy, active listening, creativity, and confidence — and returns a structured JSON score (1–10 for each dimension, plus an overall score) along with a list of strengths, improvements, and the deal outcome.
What do I need to get started?
Python 3.8 or later, a funded Telnyx account with API key, a Telnyx phone number with voice enabled, a Call Control Application configured with your webhook URL, and ngrok to expose your local server to Telnyx webhooks.

Discussion

No discussion yet for this article

Stay ahead with AI news

Get curated AI news from 200+ sources delivered daily to your inbox. Free to use.

Get Started Free

Free · takes 30 seconds · unsubscribe anytime

1 minute a day. The AI essentials.

200+ sources · Email / LINE / Slack

Get it free →