Skip to main content

LLM Agents for Game Theory Experiments

Project description

econ-llm

A python package that uses LLM agents to automate experiments using the VEcon Lab Website.

Installation

To install the package, run the following command:

pip install econ-llm

Dependencies

Python Dependeny

sudo apt install python3
sudo apt install python3-pip
sudo apt install python3-venv

secrets.txt

OpenAI_API_KEY
GitHub_Username GitHub_Access_Token

secrets.txt should be in the same directory as execution.

Upload

Assumes git credentials are set

git config --global user.email "YOUR_EMAIL"
git config --global user.name "YOUR_NAME"
git config pull.rebase true

Commands

Run

To run an experiment (multi-round ultimatum game), use the following command:

econ-llm run [experiment_id] [user_id] [(optional) experiment_version]

The agent automatically detects if it is a proposer or responder. Versions supported:

  • "human_ai_classic": (default) matches instructions given to humans

Upload

Upload output to econ-llm-data using the following command:

econ-llm upload

Visualize

Visualize the output using the following command:

econ-llm visualize [filter one] [filter two] ...

Filters are used to select the data to visualize. For example, to select logs from a specific user on a specific day, use the following command:

econ-llm visualize [user_id] [yyyy-mm-dd]

parse can also be used in place of visualize. Both commands produce in the conversation in a readable format.

Upgrade

To update the package, use the following command:

econ-llm upgrade

Download

To get data from VeconLab, use the following command:

econ-llm download [session_id] [admin_password]

Suggested Process Flow

Add agents as needed:

econ-llm run [experiment_id] [user_id]

Visualize the data:

econ-llm visualize

Get the data from VeconLab:

econ-llm download [session_id] [admin_password]

Make sure data is uploaded:

econ-llm upload

Output

The output will be saved in the ~/econ-llm-data directory. File names contains experiment_id, user_id, and timestamp. Metadata includes the previous and the role of the agent.

Specification

The package is currently using gpt-4o-2024-08-06 as the model from OpenAI.

Change Log

Version 3.X.X - critical fix for the proposer history

NOTE: running proposer in version previous to this will not produce valid results.

  • 3.0.1
    • Update proposer history to correctly track value for you/other

Version 2.X.X - production release

Version 2.0.X

  • 2.0.7
    • Add delay for the responder on the final page
    • Update data pull from VeconLab
  • 2.0.6
    • Make sure it runs in visible mode
    • Add a delay for the proposer on the final page
  • 2.0.5
    • Stable version for experiments
  • 2.0.4
    • Add a 5-10 second random delay before sending a message
  • 2.0.3
    • Remove misleading version after upgrade
  • 2.0.2
    • Add version command to check the version of the package
    • Fix issues with git initialization
  • 2.0.1
    • Stable version used for AI-responder experiments

Version 1.X.X

Version 1.2.X - bug fix with proposer

  • 1.2.6
    • Update logs before running experiment
  • 1.2.5
    • Add download command to get data from VeconLab
  • 1.2.4
    • Fix typo with '%%'
  • 1.2.3
    • Add a parse command to make the conversations human readable
    • Use markdown for past results
  • 1.2.2
    • Update how context is built/stored
    • Critical fixes to the context for proposer/responder
  • 1.2.1
    • Fix bug with the proposer not getting all information
    • Add delays in interactions
    • Add spinner when proposer is waiting on a response

Version 1.1.X

  • 1.1.3:
    • Add visualizer command
  • 1.1.2:
    • Update logging structure
    • Add log parsing
    • Auality of life improvements
      • Use aboslute import paths
      • Better argument parsing
  • 1.1.1:
    • Initial prototype release

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

econ_llm-3.0.1.tar.gz (52.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

econ_llm-3.0.1-py3-none-any.whl (40.8 kB view details)

Uploaded Python 3

File details

Details for the file econ_llm-3.0.1.tar.gz.

File metadata

  • Download URL: econ_llm-3.0.1.tar.gz
  • Upload date:
  • Size: 52.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for econ_llm-3.0.1.tar.gz
Algorithm Hash digest
SHA256 6c17cf20761e9ea06abe28ff3376859e8a54dfc5657fed6fd8ad5af56f0a0741
MD5 8f627cffa621ff4258c6582ad68f83f5
BLAKE2b-256 23aea779084e503c5dc164313c745f20c8cb9c5623cee4132faa9f2eb85dfc6e

See more details on using hashes here.

File details

Details for the file econ_llm-3.0.1-py3-none-any.whl.

File metadata

  • Download URL: econ_llm-3.0.1-py3-none-any.whl
  • Upload date:
  • Size: 40.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for econ_llm-3.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 929d95e97a3bf00b97be9f01b90e7b650eb0aba76fe3213043d55973c8ef6ef7
MD5 df5c55c580bfc856c66d5d5d17183e42
BLAKE2b-256 a3fed329a84f1b009360555e81d66d935b8b9bdeeeb134833e414d0ee88bbcb0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page