anjgotnochill/bargaining-agent
๐ค Bargaining Agent
An AI-powered negotiation agent that uses game-theoretic reasoning to bargain strategically. Built on research from three landmark papers in LLM negotiation.
๐ฎ Try It
You play as the SELLER. The AI buyer agent will try to negotiate the best deal using strategic reasoning.
- Pick an item (or create a custom one)
- Choose the buyer's strategy (Aggressive / Balanced / Cooperative)
- Start negotiating!
The buyer has a hidden budget and uses game-theoretic reasoning to optimize its offers. A dashboard shows the offer trajectory and hidden information after the deal.
๐ง How It Works
Architecture
The agent uses a structured reasoning pipeline based on three research papers:
Buyer Agent Strategy
At each turn, the buyer agent follows this workflow:
1. Enumerate possible actions (3 price offers)
2. Predict seller's rational best response to each
3. Calculate expected surplus for each scenario
4. Select action maximizing expected value
5. Generate natural conversational responseThree Strategy Modes
๐ Programmatic Usage
from bargaining_agent import BargainingAgent
# Create a buyer agent
agent = BargainingAgent(
budget=900,
item="MacBook Pro 2022",
item_description="M1 Pro, 16GB RAM, minor scratches",
strategy="balanced" # aggressive, balanced, cooperative
)
# Negotiate turn by turn
response = agent.negotiate_turn("I'm selling this MacBook Pro for $1200")
print(response) # "Hey, I'm interested but $1200 seems high..."
response = agent.negotiate_turn("I can do $1000, it's in great shape")
print(response) # "How about $750? I've seen similar ones for less..."๐ฌ Research Background
SOTA: RLVR for Negotiation (2025)
The current state-of-the-art uses Reinforcement Learning with Verifiable Rewards (RLVR) โ training directly on economic surplus as a reward signal. Key findings from Liu et al. 2025:
- A 30B RLVR-trained model achieves Reward 0.7664 vs GPT-5.4-high-reasoning at 0.4081 (nearly 2x)
- Training produces four emergent phases: Aggressive Greed โ Deadlock โ Rational Concession โ Advanced Persuasion
- The reward function:
R = (Budget - FinalPrice) / |Budget - Cost|
Training Recipe (for fine-tuning)
To train your own negotiation agent:
from trl import GRPOConfig, GRPOTrainer
# Reward function based on economic surplus
def reward_func(completions, **kwargs):
rewards = []
for completion in completions:
# Parse action, compute surplus
price = extract_price(completion)
if price and price <= buyer_budget:
reward = (buyer_budget - price) / abs(buyer_budget - seller_cost)
else:
reward = -1.0 # budget violation
rewards.append(max(-1, min(1, reward)))
return rewards
config = GRPOConfig(
learning_rate=1e-6,
num_generations=8,
max_completion_length=512,
bf16=True,
)
trainer = GRPOTrainer(
model="Qwen/Qwen3-14B",
reward_funcs=reward_func,
train_dataset=negotiation_prompts,
args=config,
)
trainer.train()Datasets for Training
๐ ๏ธ Technical Details
- Model: Qwen/Qwen2.5-72B-Instruct (via HF Inference API)
- Framework: Gradio 6 + HuggingFace Hub
- Agent Library: smolagents (for programmatic multi-agent mode)
- Reward Design: Economic surplus
R = (B - P) / |B - C|from RLVR paper
๐ References
- Liu et al. (2025). Instructing LLMs to Negotiate using Reinforcement Learning with Verifiable Rewards. arxiv:2604.09855
- Huang et al. (2024). Game-theoretic LLM: Agent Workflow for Negotiation Games. arxiv:2411.05990
- Fu et al. (2023). Improving Language Model Negotiation with Self-Play and In-Context Learning from AI Feedback. arxiv:2305.10142
- Lewis et al. (2017). Deal or No Deal? End-to-End Learning for Negotiation Dialogues. arxiv:1706.05125
- GameTalk (2025). Training LLMs for Strategic Conversation. arxiv:2601.16276
