8000 GitHub - ShenzheZhu/A2A-NT: Official code of "The Automated but Risky Game: Modeling Agent-to-Agent Negotiations and Transactions in Consumer Markets"
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Official code of "The Automated but Risky Game: Modeling Agent-to-Agent Negotiations and Transactions in Consumer Markets"

Notifications You must be signed in to change notification settings

ShenzheZhu/A2A-NT

Repository files navigation

The Automated but Risky Game: Modeling Agent-to-Agent Negotiations and Transactions in Consumer Markets

Shenzhe Zhu $^{1}$, Jiao Sun $^{2}$, Yi Nian $^{3}$, Tobin South $^4$, Alex Pentland $^{4,5}$, Jiaxin Pei $^{5,\dagger}$
$^1$ University of Toronto, $^2$ Google DeepMind, $^3$ University of Southern California
$^4$ Massachusetts Institute of Technology, $^5$ Stanford University
($^{\dagger}$ Corresponding Author)

teaser

📰 News

  • 2025/05/17: We have released our code and dataset.

📡 Overview

This repository contains the implementation of an automated negotiation system that simulates agent-to-agent negotiations in consumer markets. The system uses large language models (LLMs) to power both buyer and seller agents, enabling realistic and dynamic price negotiations. We also provide methods for detecting model anomalies and potential risks in automated negotiations.

🛠️ Agent-to-Agent Negotiations and Transaction Framework

Setup

  1. Create a conda environment:
conda create -n negotiation python=3.9
conda activate negotiation
  1. Install dependencies:
pip install -r requirements.txt
  1. Set up API keys in a Config.py file:
OPENAI_API_KEY = "your_openai_api_key"
DEEPSEEK_API_KEY = ["your_deepseek_api_key1", "your_deepseek_api_key2"]
ZHI_API_KEY = ["your_zhizengzeng_api_key1", "your_zhizengzeng_api_key2"]
GOOGLE_API_KEY = "your_google_api_key"

Usage

Run experiments using the provided shell script:

./run_all.sh

Or run individual experiments using main.py:

python main.py \
    --products-file dataset/products.json \
    --buyer-model gpt-3.5-turbo \
    --seller-model gpt-3.5-turbo \
    --summary-model gpt-3.5-turbo \
    --max-turns 30 \
    --num-experiments 1 \
    --output-dir results

Budget Scenarios

The system tests five different budget scenarios for each product:

  • High: Retail Price * 1.2
  • Retail: Retail Price
  • Mid: (Retail Price + Wholesale Price) / 2
  • Wholesale: Wholesale Price
  • Low: Wholesale Price * 0.8

Supported Models

  • OpenAI
  • DeepSeek
  • Qwen
  • Google

Results

Results are saved in the results directory with the following structure:

results/
└── seller_{seller_model}/
    └── {buyer_model}/
        └── product_{product_id}/
            └── budget_{scenario}/
                └── product_{product_id}_exp_{experiment_num}.json

Each result file contains:

  • Complete conversation history
  • Price offers
  • Negotiation outcome
  • Budget scenario
  • Model information

Main Result Analysis

In data_postprocess/draw_result.ipynb, we provide methods for calculating various metrics and generating visualizations, including:

  • Price Reduction Rate
  • Total Profit
  • Deal Rate
  • Profit Rate

Model Anomaly Analysis

We provide comprehensive model anomaly analysis tools in data_postprocess/draw_risk.ipynb, which includes methods for analyzing various types of model anomalies:

  • Overpayment: Cases where the buyer pays significantly more than the market value
  • Constraint Violation: Instances where negotiation constraints are not properly followed
  • Deadlock: Situations where negotiations reach an impasse

🚀 Project Structure

.
├── main.py                 # Main experiment runner
├── Conversation.py         # Conversation management and negotiation logic
├── LanguageModel.py        # LLM interface and API handling
├── run_all.sh             # Shell script for running multiple experiments
├── dataset/               # Contains product information
│   ├── products.json
│   └── products_mini.json
└── data_postprocess/      # Data processing and analysis tools
    ├── draw_result.ipynb       # Calculate metrics and generate visualizations
    └── draw_risk.ipynb         # Model anomaly analysis

🧾 Citation If you find our work useful in your research or applications, please consider citing:

BibTeX:

@misc{zhu2025automatedriskygamemodeling,
      title={The Automated but Risky Game: Modeling Agent-to-Agent Negotiations and Transactions in Consumer Markets}, 
      author={Shenzhe Zhu and Jiao Sun and Yi Nian and Tobin South and Alex Pentland and Jiaxin Pei},
      year={2025},
      eprint={2506.00073},
      archivePrefix={arXiv},
      primaryClass={cs.AI},
      url={https://arxiv.org/abs/2506.00073}, 
}

About

Official code of "The Automated but Risky Game: Modeling Agent-to-Agent Negotiations and Transactions in Consumer Markets"

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0