CoolFace
Apppublic

anjgotnochill/bargaining-agent

sourceHugging Facemitupdated 5mo agoView on Hugging Face
0likes
App README

๐Ÿค 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.

  1. 1.Pick an item (or create a custom one)
  2. 2.Choose the buyer's strategy (Aggressive / Balanced / Cooperative)
  3. 3.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:

ComponentBased OnPaper
Game-theoretic reasoningStep-by-step best-response computationGame-theoretic LLM
Self-play + critic feedbackMulti-agent improvement loopSelf-Play Bargaining
Verifiable reward designEconomic surplus as reward signalRLVR for Negotiation

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 response

Three Strategy Modes

ModeAnchorMax Concession/RoundStyle
๐Ÿ”ฅ Aggressive40% of asking3%Pressure tactics, mentions alternatives
โš–๏ธ Balanced55% of asking6%Fair but strategic, uses market data
๐Ÿค Cooperative65% of asking10%Friendly, flexible, seeks win-win

๐Ÿ“š Programmatic Usage

python
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:

python
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

DatasetTypeSizeBest For
CraigslistBargainsPrice negotiation6,682 dialoguesSFT warm-start
Deal or No DealMulti-item division10,095 dialoguesSelf-play RL
CaSiNoMulti-issue + strategy1,030 dialoguesStrategy-conditioned 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

  1. 1.Liu et al. (2025). Instructing LLMs to Negotiate using Reinforcement Learning with Verifiable Rewards. arxiv:2604.09855
  2. 2.Huang et al. (2024). Game-theoretic LLM: Agent Workflow for Negotiation Games. arxiv:2411.05990
  3. 3.Fu et al. (2023). Improving Language Model Negotiation with Self-Play and In-Context Learning from AI Feedback. arxiv:2305.10142
  4. 4.Lewis et al. (2017). Deal or No Deal? End-to-End Learning for Negotiation Dialogues. arxiv:1706.05125
  5. 5.GameTalk (2025). Training LLMs for Strategic Conversation. arxiv:2601.16276