{"id":26649338,"url":"https://github.com/ethanbaker/ai-negotiation","last_synced_at":"2025-03-25T01:01:11.181Z","repository":{"id":282957427,"uuid":"950225783","full_name":"ethanbaker/ai-negotiation","owner":"ethanbaker","description":"A project demonstration testing whether AI's can successfully negotiate in simple scenarios","archived":false,"fork":false,"pushed_at":"2025-03-17T20:40:55.000Z","size":2614,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-17T21:37:34.510Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ethanbaker.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-17T20:36:51.000Z","updated_at":"2025-03-17T20:40:58.000Z","dependencies_parsed_at":"2025-03-17T21:50:18.406Z","dependency_job_id":null,"html_url":"https://github.com/ethanbaker/ai-negotiation","commit_stats":null,"previous_names":["ethanbaker/ai-negotiation"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethanbaker%2Fai-negotiation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethanbaker%2Fai-negotiation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethanbaker%2Fai-negotiation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethanbaker%2Fai-negotiation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ethanbaker","download_url":"https://codeload.github.com/ethanbaker/ai-negotiation/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245377971,"owners_count":20605377,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-25T01:00:37.409Z","updated_at":"2025-03-25T01:01:11.011Z","avatar_url":"https://github.com/ethanbaker.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Human vs AI Negotiation\n\n## Initialization\n\nThis project works with version 3.10.12 of Python in Linux/Unix based\nenvironments and Google Colab. The ideal environment to run this project\nis **Google Colab**, as this allows for easily-implemented graphing\ncapabilities. There is a section below the Google Colab usage that\nentails how to run the project through the command line. However, this\nis unfit for the current implementation and requires significant changes.\n\n*In order to simulate AI agents in any capacity, you must first paste your\nOpenAI key at the top of the notebook/file. If you do not paste a key,\nyou can only run human vs human negotiations.*\n\n## Google Colab Usage\n\nTo run the project on Google Colab, simply upload the file into Google\nDrive. From here, you can paste your OpenAI key and start running blocks.\n\n### Installing Requirements\n\nThe first block in the notebook checks to make sure the `_ctypes` module\ncan be found. There is an error when installing `negmas` on newer\nversions of Python where the `_ctypes` library is outdated, meaning\n`negmas` cannot be installed. You do not have to rerun this block every time\nyou open the notebook and instead can use it as a debugging tool if\nyour packages do not install correctly.\n\nYou can install the necessary requirements by running the block with the\npip imports. This will bring up a warning about needing to restart the session\nin order to fix packages that were previously imported in the runtime. You need\nto click `Restart Session` button for this message to disappear and for the Google\nColab runtime to synchronize the imported packages. Once the session is\nrestarted, you can click on the pip import block, the OpenAI key declaration\nblock, and more blocks further down the project.\n\n### Running a Simulation\n\nEach block contains a comment above it that explains what the code below does.\nMost of these blocks are static and do not need to be rerun during a session.\nThis includes prompts, AI tool calls, and the human and AI negotiator classes.\n\nIn order to run a simulation, edit the `agent_types` list and `starter_role`\nvariables at the top of the *Running the Negotiation* block. This will start\na simulation with the provided agent types where the given starter role\nproposes the first outcome in the negotiation. For example, the configuration\nbelow creates a human vs AI negotiation environment where the seller goes\nfirst. The human would be the seller as they are listed first in the list of\nagents.\n\n```python3\nagent_types = [\"human\", \"ai\"]\nstarter_role = \"seller\"\n```\n\nYou can change any of the different parameters to create any negotiation\nenvironment as you see fit. The `agent_types` array can be any combination of\n`ai` or `human`, whereas the `starter_role` variable can either be `buyer` or\n`seller`.\n\nIf you rerun any simulation, you **need** to rerun the *Negotiation Setup*\nblock.\n\n\n## Command Line Usage (DEPRECATED)\n\nIf you are running this project through the command line you need to\nhave `pip` installed. `pip` is the package manager for python. To\nupgrade pip, run the following command:\n\n```bash\n$ pip install -U pip\n```\n\nNext, you need to download the provided google notebook as a Python\nfile. Once you have the downloaded file (that will end with a `.py`),\nyou need to comment out the *Google Colab Testing* section and uncomment\nout the *Command Line Section*. This ensures that the code can be\nrun through the command line.\n\n### Creating a Virtual Python Environment\n\nThe first step for the program is to create a virtual environment for\nPython inside the project workspace. This should create a `.venv`\ndirectory.\n\nYou can create a virtual environment by using the following command:\n\n```bash\n$ python3 -m venv .venv\n$ . .venv/bin/activate\n```\n\nYou can check if the virtual environment was initialized correctly by \nrunning `which python`. This command should output your current working\ndirectory concatenated with `.venv/bin/python`. If this command does not\noutput this path, the virtual environment was not set up correctly.\n\n### Installing Requirements\n\nMost of these requirements stem from one common libraries: `negmas`. This \nis the Python library that is used to simulate negotiations and provide\nassociated metrics. `negmas` was made specifically to simulate agents\nusing mathematical reasoning (such as using an identity function to\ndescribe utility). However, because `negmas` allows for custom agent\nimplementations, we can create a custom agent implementation that uses\neither human reasoning by asking for human input or large language model\nreasoning.\n\nYou can install `negmas` using the following command:\n\n```bash\n$ pip install negmas\n```\n\nThe other library that is installed currently is `openai`. This is used\nto implement ChatGPT functionality to the `AINegotiator` agent.\n\nYou can install `openai` as follows:\n\n```bash\n$ pip install openai\n```\n\nWhen installing these requirements, you should remove the Google Colab\nimport statements at the top of the file. These lines are:\n\n```\n!pip install negmas\n!pip install openai\n```\n\n### Running a Simulation\n\nYou can run the project by running the `runner.py` script with python\nand the two provided agents you want to test and the role that will\nstart the negotiation. For example, the command below starts the\nnegotiation simulation with an AI agent as the buyer and human agent\nas the seller.\n\n```bash\n$ python runner.py ai human buyer\n```\n\nYou can exchange any of the different parameters. The first two\ncommand line parameters will be either `ai` or `human`, whereas the\nthird command line will either be `buyer` or `seller`.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fethanbaker%2Fai-negotiation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fethanbaker%2Fai-negotiation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fethanbaker%2Fai-negotiation/lists"}