Skip to main content

No project description provided

Project description

Python compat PyPi GHA Status Documentation Status


econagents

econagents is a Python library that lets you use LLM agents in economic experiments. The framework connects LLM agents to game servers through WebSockets and provides a flexible architecture for designing, customizing, and running economic simulations.

Installation

# Install from PyPI
pip install econagents

# Or install directly from GitHub
pip install git+https://github.com/IBEX-TUDelft/econagents.git

Framework Components

econagents consists of four key components:

  1. Agent Roles: Define player roles with customizable behaviors using a flexible prompt system.
  2. Game State: Hierarchical state management with automatic event-driven updates.
  3. Agent Managers: Manage agent connections to game servers and handle event processing.
  4. Game Runner: Orchestrates experiments by gluing together the other components.

Example Experiments

The repository includes three example games:

  1. prisoner: An iterated Prisoner's Dilemma game with 5 rounds and 2 LLM agents.
  2. ibex_tudelft/harberger: A Harberger Tax simulation with LLM agents.
  3. ibex_tudelft/futarchy: A Futarchy simulation with LLM agents.

Running the Prisoner's Dilemma game

The simplest game to run is a version of the repeated prisoner's dilemma game that runs on your local machine.

# Run the server
python examples/prisoner/server/server.py

# Run the experiment (in a separate terminal)
python examples/prisoner/run_game.py

Note: you still have to set up the connection to the agents.

Key Features

  • Flexible Agent Customization: Customize agent behavior with Jinja templates or custom Python methods
  • Event-Driven State Management: Automatically update game state based on server events
  • Turn-Based and Continuous Action Support: Handle both turn-based games and continuous action phases
  • LangChain Integration: Built-in support for LangChain's agent capabilities

Documentation

For detailed guides and API reference, visit the documentation.

You should also check out the econagents cookbook for more examples.

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

econagents-0.0.9.tar.gz (32.2 kB view details)

Uploaded Source

Built Distribution

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

econagents-0.0.9-py3-none-any.whl (40.3 kB view details)

Uploaded Python 3

File details

Details for the file econagents-0.0.9.tar.gz.

File metadata

  • Download URL: econagents-0.0.9.tar.gz
  • Upload date:
  • Size: 32.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.4 CPython/3.12.11 Linux/6.11.0-1018-azure

File hashes

Hashes for econagents-0.0.9.tar.gz
Algorithm Hash digest
SHA256 49b9e9541aa45d67b4970af5c13d0f395adc7d4f8fad8d89aab2795d9a55076f
MD5 761e5fefdedbacbf7106b90d062601a2
BLAKE2b-256 bea15f793b5fb681337e177e832fe5dcda82a06deab74307f0bec431566b069d

See more details on using hashes here.

File details

Details for the file econagents-0.0.9-py3-none-any.whl.

File metadata

  • Download URL: econagents-0.0.9-py3-none-any.whl
  • Upload date:
  • Size: 40.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.4 CPython/3.12.11 Linux/6.11.0-1018-azure

File hashes

Hashes for econagents-0.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 4f64ef6641d9cbefce1da7e385a1a8739aaf56403d9cc35fab88eba9bbe8df0a
MD5 9acc44b048c4a4440c23fa9e26fdb550
BLAKE2b-256 7072163086d52b7b2a6e640ddd4d53419d09a88857a682cfe2f4bf8c43696868

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