The Social Platform module is a core component of Oasis that simulates a social media environment for agent interactions. It provides a complete infrastructure for social network activities, including user management, content creation, engagement metrics, recommendation systems, and user interactions.

We support passing in two types of platforms. One is the DefaultPlatformType, which includes Twitter and Reddit. Otherwise, you can customize the Platform settings and pass them in.

Default Platform Type (Recommend)

OASIS supports two built-in platform types, which can be specified during environment creation:

Twitter-like Platform

env = oasis.make(
    platform=DefaultPlatformType.TWITTER,
    database_path="./data/twitter_simulation.db",
    agent_profile_path="./data/profiles/twitter_users.csv",
    agent_models=models,
    available_actions=available_actions,
)

The Twitter-like platform simulates a microblogging service with features like posts, likes, retweets, and following.

Reddit-like Platform

env = oasis.make(
    platform=DefaultPlatformType.REDDIT,
    database_path="./data/reddit_simulation.db",
    agent_profile_path="./data/profiles/reddit_users.json",
    agent_models=models,
    available_actions=available_actions,
)

Customized Platform

The platform uses an asynchronous architecture to handle agent actions and maintain a consistent timeline within the simulation.

Key Features

Time Management

  • Configurable time acceleration using sandbox_clock
  • Support for simulated timeline progression

Database Integration

  • SQLite-based storage for all social activities and relationships
  • Comprehensive logging of user actions and system events

Recommendation Systems

Several recommendation system types are supported:

  • Random: Simple randomized content recommendation
  • Reddit: Reddit-style recommendation based on engagement metrics
  • Twitter: Personalized recommendations based on user history
  • TWHin: Advanced recommendation using graph embedding (optional OpenAI embedding integration)

Social Actions

The platform supports a wide range of social media actions.

Initialization

from oasis.social_platform.platform import Platform
from oasis.clock.clock import Clock

# Initialize with custom configuration
platform = Platform(
    db_path="social_platform.db",
    sandbox_clock=Clock(k=60),
    show_score=True,
    allow_self_rating=False,
    recsys_type="twitter",
    refresh_rec_post_count=5,
    max_rec_post_len=10,
    following_post_count=3,
    use_openai_embedding=False
)

Configuration Options

ParameterTypeDefaultDescription
db_pathstrRequiredPath to SQLite database
channelAnyChannel()Communication channel for agent interactions
sandbox_clockClockClock(60)Time management for the simulation(for reddit recommendation system)
start_timedatetimedatetime.now()Initial time for the simulation(for reddit recommendation system)
show_scoreboolFalseShow combined score (Reddit style) instead of separate likes/dislikes
allow_self_ratingboolTrueAllow users to like/dislike their own content
recsys_typestr/RecsysType”reddit”Recommendation system type (“random”, “reddit”, “twitter”, “twhin”)
refresh_rec_post_countint1Number of posts returned per refresh
max_rec_post_lenint2Maximum posts per user in recommendation buffer
following_post_countint3Number of posts from followed users
use_openai_embeddingboolFalseUse OpenAI embeddings for TWHin recommendation system. If false, use the local TWHIN-BERT model to get embeddings.

Recommendation System

Different recommendation algorithms can be configured through the recsys_type parameter:

The available recommendation system types are:

RecsysTypeDescription
TWITTERStandard Twitter-like recommendation system
TWHIN(Recommend)TWHINBert-based recommendation system for Twitter-like platforms
REDDITReddit-style recommendation system
RANDOMRandom content recommendation (for baseline testing)