Negotiation is an artwork that impacts every thing from job provides to enterprise transactions. Whether or not you might be negotiating a wage, closing a enterprise deal, or settling a dispute over a contract, the right method might be the distinction between success and sacrifice. To be able to simplify and streamline the negotiation course of, I developed an AI-Powered Negotiation Agent, a Streamlit internet software constructed on LangChain and DeepSeek-R1. It gives you with clever negotiation methods primarily based on what you enter, and also you negotiate the very best settlement.
Studying Aims
- Perceive the position of AI in enhancing negotiation methods throughout numerous domains.
- Learn the way DeepSeek R1 Distill Llama 70B allows real-time AI-driven negotiation insights.
- Discover key options of the AI Negotiation Agent, together with counteroffers and danger evaluation.
- Achieve hands-on expertise establishing and utilizing the AI-powered negotiation instrument in Streamlit.
- Uncover how AI-generated methods can optimize wage discussions, enterprise offers, and contract negotiations.
This text was revealed as part of the Knowledge Science Blogathon.
What’s DeepSeek R1 Distill Llama 70b?
DeepSeek-R1-Distill-Llama-70B is a high-performance GroqCloud AI mannequin. It’s a distilled model of Llama 3.3 70B and is made clever and environment friendly to reply to math, coding, and factual questions.
This mannequin causes sequentially, step-by-step, and thus is acceptable for high-level decision-making. With Groq’s extraordinarily quick inference, customers can expertise real-time AI reasoning with out latency, unlocking new potentialities for high-end AI purposes.
Drawback Assertion
Folks battle to barter successfully as a consequence of a lack of knowledge, emotional bias, or weak argument structuring.
- Workers might accept decrease salaries as a consequence of poor negotiation abilities.
- Companies might fail to shut offers as a result of they don’t perceive the opposite social gathering’s wants.
- Freelancers and startups battle with pricing and contracts.
Objective: Create an AI agent that analyzes a negotiation situation, predicts counteroffers, and suggests optimum negotiation methods primarily based on logic and previous knowledge.
Key Options of the AI Negotiation Agent
Allow us to now look into the important thing options of AI Negotiation Agent under:
- Helps a number of negotiation sorts (Wage, Enterprise Offers, Freelancing, Contract Disputes)
- AI-generated counteroffers with justifications and danger evaluation
- Customizable enter fields for customized negotiation eventualities
- Confidence scoring for AI-suggested methods
- Quick and environment friendly processing utilizing Groq API
How this Agent Works
The person begins by opening the Streamlit app and deciding on the specified negotiation kind. They then enter the provide particulars, offering key data for the AI mannequin to course of. Upon clicking the ‘Generate AI Technique’ button, the system initializes and hundreds the Massive Language Mannequin (DeepSeek-R1). The enter knowledge is then processed utilizing a predefined immediate template, guaranteeing that the AI understands the negotiation context successfully.
As soon as the processing is full, the AI generates a tailor-made negotiation technique primarily based on the supplied particulars. Lastly, the system shows the AI’s urged technique, providing insights and proposals to help the person of their negotiation course of.

Choose Your Negotiation Sort
Select from 4 predefined choices:
- Wage Negotiation
- Enterprise Deal
- Freelance Pricing
- Contract Dispute
Enter Your Supply and Constraints
Fill in:
- Your proposed provide (₹ or %)
- The opposite social gathering’s anticipated provide
- Key constraints, similar to minimal wage, funding limits, or deadlines
AI Generates a Technique
As soon as submitted, the AI analyzes your negotiation and gives:
- Greatest counteroffer primarily based on inputs
- Justification for the provide
- Danger evaluation (chance of acceptance)
- Confidence rating (out of 100%)
Use AI Insights to Negotiate
Leverage the AI-generated technique to confidently negotiate and safe higher offers.
Setting Up the Base
Under we are going to arrange the bottom by first establishing the atmosphere then adopted by putting in libraries:
Surroundings Setup
# Create a Surroundings
python -m venv env
# Activate it on Home windows
.envScriptsactivate
# Activate in MacOS/Linux
supply env/bin/activate
Set up the Necessities.txt
pip set up -r https://uncooked.githubusercontent.com/Gouravlohar/Negotiation-Agent/refs/heads/fundamental/necessities.txt
API Key Setup
go to Groq for API Key.

Paste the API key in .env File
GROQ_API_KEY="Your API KEY PASTE HERE"
Construct a Negotiation Agent utilizing DeepSeek-R1 Distill LLaMA-70B
Under we’ll stroll you thru constructing an AI negotiation agent utilizing DeepSeek-R1 Distill LLaMA-70B and Streamlit, enabling you to generate sensible, data-driven negotiation methods effortlessly. Let’s dive in!
Step1: Importing Required Libraries
The required libraries, together with Streamlit for UI, LangChain for AI processing, and dotenv for atmosphere variable administration, are imported to arrange the negotiation agent.
import os
import streamlit as st
from langchain.prompts import PromptTemplate
from langchain.chains import LLMChain
from langchain_groq import ChatGroq
from dotenv import load_dotenv
Step2: Loading the Groq API Key
The appliance hundreds the Groq API key from the atmosphere file. If the bottom line is lacking, an error message is displayed, and execution stops to forestall unauthorized entry.
load_dotenv()
groq_api_key = os.getenv("GROQ_API_KEY")
if not groq_api_key:
st.error("Groq API Key not present in .env file")
st.cease()
Step3: Setting Up the Streamlit Interface
The Streamlit app is configured with a title and vast structure. This ensures a structured and user-friendly interface for partaking with the negotiation agent.
st.set_page_config(page_title="AI Negotiation Agent", structure="vast")
st.title("🤝 AI-Powered Negotiation Agent")
A sidebar is added the place customers can choose their most well-liked negotiation kind—Wage Negotiation, Enterprise Deal, Freelance Pricing, or Contract Dispute—to customise AI-generated methods.
st.sidebar.header("Negotiation Settings")
st.sidebar.markdown("Choose your negotiation kind and discover the small print under.")
negotiation_type = st.sidebar.selectbox("Negotiation Sort", [
"Salary Negotiation",
"Business Deal",
"Freelance Pricing",
"Contract Dispute"
])
- Provides a sidebar the place customers choose the kind of negotiation.
- Obtainable choices: Wage, Enterprise Deal, Freelance Pricing, Contract Dispute.
Step5: Directions for Customers
An expandable part gives step-by-step steerage on find out how to use the app. Customers enter their provide particulars, click on the “Generate AI Technique” button, and modify negotiation settings as wanted.
with st.expander("The way to use this app"):
st.markdown("""
- Fill in your provide, the opposing provide, and key constraints.
- Click on **Generate AI Technique** to obtain options.
- Use the sidebar to regulate the negotiation kind.
""")
Step6: Immediate Template for AI Processing
A structured immediate template is outlined to make sure the AI mannequin receives key negotiation particulars. It contains the negotiation kind, provides, constraints, and anticipated AI output like counteroffers, danger assessments, and confidence scores.
negotiation_template = """
You might be an skilled negotiator. Analyze this situation and counsel one of the best negotiation technique:
- **Negotiation Sort:** {negotiation_type}
- **Your Supply:** {your_offer}
- **Different Get together's Anticipated Supply:** {other_party_stance}
- **Key Constraints:** {key_constraints}
### Present:
1. The most effective counteroffer.
2. Justification with reasoning.
3. Danger evaluation (if any).
4. Confidence rating (out of 100%).
"""
- Defines a structured immediate for AI processing.
- AI will generate: counteroffers, reasoning, danger evaluation, confidence rating.
Step7: Perform to Load the AI Mannequin
A operate is applied to initialize the DeepSeek R1 (Distill LLaMA-70B) mannequin utilizing the ChatGroq API. The streaming=True
parameter allows real-time response technology.
def load_LLM(groq_api_key):
"""Masses the ChatGroq mannequin for processing."""
llm = ChatGroq(groq_api_key=groq_api_key, model_name="deepseek-r1-distill-llama-70b", streaming=True)
return llm
- Initializes DeepSeek R1 (Distill LLaMA 70B) through ChatGroq API.
- Streaming=True permits real-time responses.
Step8: Gathering Consumer Inputs
A type captures person inputs, together with their provide, the opponent’s anticipated provide, and key constraints. This data is important for the AI mannequin to generate an efficient negotiation technique.
st.header(f"💼 {negotiation_type}")
st.markdown("Enter particulars of your negotiation situation under:")
with st.type(key="negotiation_form"):
col1, col2 = st.columns(2)
with col1:
your_offer = st.text_input("Your Supply (₹ or %):", placeholder="Enter your proposed provide...")
with col2:
other_party_stance = st.text_input("Different Get together's Anticipated Supply (₹ or %):", placeholder="Enter anticipated counteroffer...")
key_constraints = st.text_area("Key Constraints", top=150, placeholder="Listing deal-breakers, targets, must-haves...")
submit_button = st.form_submit_button("Generate AI Technique")
Creates a type the place customers enter:
- Their provide
- The anticipated counteroffer
- Any constraints or deal-breakers
Step9: Producing AI-Based mostly Negotiation Technique
Upon submission, the app validates enter fields earlier than processing the info. The AI mannequin is loaded, and a immediate is shipped for technique technology. The response contains counteroffers, justifications, danger assessments, and confidence scores. If any subject is lacking, an error message prompts the person to finish the shape.
if submit_button:
if your_offer and other_party_stance and key_constraints:
with st.spinner("Producing negotiation technique..."):
llm = load_LLM(groq_api_key)
prompt_obj = PromptTemplate(
input_variables=["negotiation_type", "your_offer", "other_party_stance", "key_constraints"],
template=negotiation_template
)
chain = LLMChain(llm=llm, immediate=prompt_obj)
end result = chain.run(
negotiation_type=negotiation_type,
your_offer=your_offer,
other_party_stance=other_party_stance,
key_constraints=key_constraints
)
st.success("Technique generated efficiently!")
st.subheader("💡 AI's Urged Technique:")
st.markdown(end result)
else:
st.error("Please fill in all fields earlier than producing a technique.")
- Consumer submits a negotiation situation (Supply, Opponent’s Supply, Constraints).
- Code checks if all fields are stuffed.
- A loading spinner seems whereas AI processes the enter.
- DeepSeek AI generates a negotiation technique primarily based on the immediate.
- The technique is displayed, together with counteroffers, dangers, and justification.
- If enter is lacking, an error message seems as an alternative.
Get full code on GitHub Right here
Output

Enter
Negotiation Sort: Wage Negotiation
- Your Supply: ₹15 LPA (Lakh every year)
- Different Get together’s Anticipated Supply: ₹12 LPA
Key Constraints:
- Minimal ₹14 LPA to satisfy bills.
- Desire hybrid work flexibility.
- Open to performance-based incentives.
Output

Conclusion
Negotiation is a priceless talent in each skilled and private life, and the Negotiation Agent utilizing DeepSeek-R1 employs knowledge to help you in negotiating improved offers. Whether or not you might be negotiating a increase, a enterprise funding, or contract phrases, this app helps you make higher choices with AI-generated counteroffers, danger ranges, and confidence scores.
This utility leverages DeepSeek-R1 Distill LLaMA-70B, LangChain, and Streamlit to facilitate negotiations. It assists you in minimizing uncertainty and maximizing your success fee.
Due to AI, you don’t should second-guess your greatest transfer anymore—you’ll be able to negotiate with confidence!
Key Takeaways
- The app analyzes provides and constraints to supply clever counteroffers.
- Helps wage negotiation, enterprise offers, freelance pricing, and contract disputes.
- AI assesses the likelihood of success and potential dangers in your negotiation.
- Customers can enter their provides and key constraints to generate tailor-made methods.
- Utilizing DeepSeek R1 Distill Llama 70b & LangChain, the app shortly processes knowledge and delivers actionable methods.
Steadily Requested Questions
A. The load_LLM() operate initializes the DeepSeek R1 Distill Llama 70b mannequin utilizing the ChatGroq API. It returns an LLM (Language Mannequin) that processes person enter and generates negotiation methods.
A. PromptTemplate defines the construction of the immediate despatched to the AI. It ensures the AI receives all obligatory particulars (provide, constraints, negotiation kind) to generate a significant response.
A. The API secret is delicate knowledge, and storing it in a .env file retains it safe. The dotenv package deal hundreds this key into the atmosphere with out exposing it within the code.
A. Earlier than submitting, the app validates enter fields (your_offer, other_party_stance, key_constraints). If any subject is empty, it shows an error message to make sure full knowledge entry.
The media proven on this article just isn’t owned by Analytics Vidhya and is used on the Creator’s discretion.