genagents  by joonspk-research

Agent simulation research tool using LLMs for social science

created 8 months ago
417 stars

Top 71.3% on sourcepulse

GitHubView on GitHub
Project Summary

This project provides a Python framework for creating and interacting with "generative agents" that simulate human behavior and attitudes. It leverages large language models (LLMs) to process qualitative interview data, enabling researchers to study individual and collective behavior through agent-based simulations. The primary benefit is a novel method for generating realistic agent responses based on rich, personal data.

How It Works

The core of the system is the GenerativeAgent class, which uses LLMs (GPT-4 or GPT-3.5-turbo) to generate responses. Agents maintain a "scratchpad" for personal attributes and a "memory stream" for past experiences. They can recall, reflect on, and use this information to inform their responses to various stimuli, including categorical, numerical, and open-ended questions. This approach allows for nuanced, context-aware agent behavior that goes beyond simple rule-based systems.

Quick Start & Requirements

  • Install dependencies: pip install -r requirements.txt
  • Configuration: Create simulation_engine/settings.py with OPENAI_API_KEY, KEY_OWNER, and other parameters.
  • Prerequisites: Python 3.7+, OpenAI API key (GPT-4 or GPT-3.5-turbo).
  • Example usage and sample agent available in agent_bank/populations/single_agent.

Highlighted Details

  • Simulates attitudes and behaviors based on qualitative interview data.
  • Supports categorical, numerical, and open-ended response generation.
  • Features memory and reflection mechanisms for agent learning.
  • Includes a bank of over 3,000 agents based on GSS demographic data.
  • Plans for restricted API access to 1,000 interview-based agents.

Maintenance & Community

The project originates from research at Stanford University. Contributions are welcomed via standard GitHub pull requests. Contact: Joon Sung Park (joonspk@stanford.edu).

Licensing & Compatibility

Licensed under the MIT License. This permissive license allows for commercial use and integration into closed-source projects.

Limitations & Caveats

The full dataset of 1,000 interview-based agents is not yet publicly available, with access planned via a restricted API requiring a review process. The current codebase focuses on the simulation engine and agent creation, with broader data access still under development.

Health Check
Last commit

8 months ago

Responsiveness

Inactive

Pull Requests (30d)
0
Issues (30d)
0
Star History
45 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.