Skip to main content

Web Social Simulator for WWW'25 AgentSociety Challenge

Project description

AgentSociety Challenge Logo

WWW'25 AgentSociety Challenge: WebSocietySimulator

🚀 AgentSociety Challenge

LicenseCompetition Link

Welcome to the WWW'25 AgentSociety Challenge! This repository provides the tools and framework needed to participate in a competition that focuses on building LLM Agents for user behavior simulation and recommendation systems based on open source datasets.

Participants are tasked with developing intelligent agents that interact with a simulated environment and perform specific tasks in two competition tracks:

  1. User Behavior Simulation Track: Agents simulate user behavior, including generating reviews and ratings.
  2. Recommendation Track: Agents generate recommendations based on provided contextual data.

This repository includes:

  • The core library websocietysimulator for environment simulation.
  • Scripts for dataset processing and analysis.
  • Example usage for creating and evaluating agents.

Directory Structure

1. websocietysimulator/

This is the core library containing all source code required for the competition.

  • agents/: Contains base agent classes (SimulationAgent, RecommendationAgent) and their abstractions. Participants must extend these classes for their implementations.
  • task/: Defines task structures for each track (SimulationTask, RecommendationTask).
  • llm/: Contains base LLM client classes (DeepseekLLM, OpenAILLM).
  • tools/: Includes utility tools:
    • InteractionTool: A utility for interacting with the Yelp dataset during simulations.
    • EvaluationTool: Provides comprehensive metrics for both recommendation (HR@1/3/5) and simulation tasks (RMSE, sentiment analysis).
  • simulator.py: The main simulation framework, which handles task and groundtruth setting, evaluation and agent execution.

2. example/

Contains usage examples of the websocietysimulator library. Includes sample agents and scripts to demonstrate how to load scenarios, set agents, and evaluate them.

3. data_process.py

A script to process the raw Yelp dataset into the required format for use with the websocietysimulator library. This script ensures the dataset is cleaned and structured correctly for simulations.


Quick Start

1. Install the Library

The repository is organized using Python Poetry. Follow these steps to install the library:

  1. Clone the repository:

    git clone <this_repo>
    cd websocietysimulator
    
  2. Install dependencies:

  • Option 1: Install dependencies using Poetry: (Recommended)
    poetry install  && \
    poetry shell
    
  • Option 2: Install dependencies using pip:
    pip install -r requirements.txt && \
    pip install .
    
  • Option 3: Install dependencies using conda:
    conda create -n websocietysimulator python=3.11 && \
    conda activate websocietysimulator && \
    pip install -r requirements.txt && \
    pip install .
    
  1. Verify the installation:
    import websocietysimulator
    

2. Download the Dataset

Option One: Process the Raw Yelp Dataset

  1. Download the raw Yelp dataset from the Yelp Dataset Challenge page.
  2. Run the data_process.py script to process the dataset:
    python data_process.py --input <path_to_raw_dataset> --output <path_to_processed_dataset>
    

Option Two: Use a Preprocessed Dataset

  1. Download the preprocessed dataset from TBD.
  2. Unzip the dataset into your working directory.

3. Organize Your Data

Ensure the dataset is organized in a directory structure similar to this:

<your_dataset_directory>/
├── business.json
├── review.json
├── user.json
├── tip.json
└── checkin.json

You can name the dataset directory whatever you prefer (e.g., dataset/).


4. Develop Your Agent

Create a custom agent by extending either SimulationAgent or RecommendationAgent. Refer to the examples in the example/ directory. Here's a quick template:

from yelpsimulator.agents.simulation_agent import SimulationAgent

class MySimulationAgent(SimulationAgent):
    def forward(self):
        # Implement your logic here
        star = 4.0
        review_text = "Great experience!"
        behavior_metrics = (10, 2, 1)
        return star, review_text, behavior_metrics

5. Evaluation your agent with training data

Run the simulation using the provided Simulator class:

from websocietysimulator import Simulator
from my_agent import MySimulationAgent

# Initialize Simulator
simulator = Simulator(data_dir="path/to/your/dataset", device="auto")

# Load scenarios
simulator.set_task_and_groundtruth(task_dir="path/to/task_directory", groundtruth_dir="path/to/groundtruth_directory")

# Set your custom agent
simulator.set_agent(MySimulationAgent)

# Run evaluation
agent_outputs = simulator.run_simulation()

# Evaluate the agent
evaluation_results = simulator.evaluate()

Introduction to the InteractionTool

The InteractionTool is the core utility for interacting with the raw dataset. It provides an interface for querying user, business, review, tip, and check-in data within the context of a task.

Functions

  • Get User Information: Retrieve user data by user ID or current scenario context.

    user_info = interaction_tool.get_user(user_id="example_user_id")
    
  • Get Business Information: Retrieve business data by business ID or current scenario context.

    business_info = interaction_tool.get_business(business_id="example_business_id")
    
  • Get Reviews: Fetch reviews related to a specific business or user, filtered by time.

    reviews = interaction_tool.get_reviews(business_id="example_business_id")
    
  • Get Tips: Fetch tips related to a specific business or user, filtered by time.

    tips = interaction_tool.get_tips(business_id="example_business_id")
    
  • Get Check-ins: Fetch check-in data related to a specific business, filtered by time.

    checkins = interaction_tool.get_checkins(business_id="example_business_id")
    

License

This project is licensed under the MIT License. See the LICENSE file for details.

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

websocietysimulator-1.0.0a1.tar.gz (24.4 kB view details)

Uploaded Source

Built Distribution

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

websocietysimulator-1.0.0a1-py3-none-any.whl (29.1 kB view details)

Uploaded Python 3

File details

Details for the file websocietysimulator-1.0.0a1.tar.gz.

File metadata

  • Download URL: websocietysimulator-1.0.0a1.tar.gz
  • Upload date:
  • Size: 24.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.12.8 Linux/6.5.0-1025-azure

File hashes

Hashes for websocietysimulator-1.0.0a1.tar.gz
Algorithm Hash digest
SHA256 8707d3c75a086f5f9483292a17cf43c58549c86f47e4466a09aa8edff404c8bb
MD5 2da5861eb11b0de6f8ae149a9c417655
BLAKE2b-256 d8dc74351137319596e12b39000c118002182fa5d88eef9e5f67b436c53a27bc

See more details on using hashes here.

File details

Details for the file websocietysimulator-1.0.0a1-py3-none-any.whl.

File metadata

File hashes

Hashes for websocietysimulator-1.0.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 a7a7ee1c2d685325da21b8ffd44889312bdf7db755d1b62655cc394cf79d7a68
MD5 a53762080236ab2947c6a7023b82881c
BLAKE2b-256 1261ee59cb37f4c19d2d38bafda72750ad9d4fce5b8a909d41b3ce40df819c83

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