$ show camel-ai/oasis
OASIS is a Python framework for simulating social media platforms (Twitter, Reddit) populated by LLM-powered agents. It is designed for computational social science research, specifically studying information spread, opinion dynamics, group polarization, and the impact of platform algorithms. The system is built on top of the CAMEL AI framework for LLM interaction. The architecture follows a modular, event-driven pattern. The core simulation loop is managed by OasisEnv, which coordinates agents (SocialAgent), a platform (Platform), an async message channel (Channel), and a social graph (AgentGraph). Actions are generated by agents (either manually or via LLM calls), passed through the channel, and executed by the platform against a SQLite database. A recommendation system (Recsys) provides personalized content feeds using various strategies. The codebase is a hybrid of a software library and a research project. While the core framework is well-structured with clean abstractions (e.g., Channel, AgentGraph, Recsys), it carries significant research code debt: tight coupling to the fast-moving camel-ai framework, global state in recommendation modules, skipped tests, hardcoded paths in experiments, and mixed sync/async patterns. The extensive YAML-driven experiment configurations and visualization scripts are tightly coupled to specific research questions (misinformation, polarization) and datasets. Maintenance is active in the context of ongoing research, but the codebase shows signs of technical drift (skipped tests, commented-out features, dependency on specific LLM API patterns). It is a powerful tool for researchers but would require significant hardening for production use.
The LLM identified 5 files worth highlighting for reuse:
Implements an asynchronous message queue (asyncio.Queue) that decouples agent action generation from platform execution. Agents push actions onto the channel, and the platform processes them. This pattern is highly reusable for any system requiring decoupled, concurrent task processing. It is self-contained and demonstrates a clean separation of concerns.
Provides an abstraction layer over graph backends (in-memory igraph and Neo4j) for managing the social network of agents. It encapsulates graph operations (add/remove nodes/edges, get neighbors) behind a unified interface. The backend switching strategy is cleanly implemented, making it a reusable component for any project needing flexible graph storage.
Implements a modular recommendation system with multiple pluggable strategies (Random, Reddit Hot Score, Personalized via sentence-transformers, TWHIN). The RecsysType enum and dispatch logic allow easy switching between algorithms. The personalized recommendation using embedding similarity is a non-trivial, self-contained feature that could be extracted for other content recommendation tasks.
A self-contained utility for managing simulation time. It supports a configurable time factor to speed up or slow down simulation relative to real time. This is a clean, isolated component that can be reused in any time-based simulation or game loop.
Provides a uniform interface (SocialAction) for wrapping all platform actions (post, like, follow, etc.) as FunctionTool objects compatible with LLM tool calling. This pattern cleanly separates action definition from action execution and agent decision-making, making it highly reusable for any multi-agent system where LLMs need to interact with an environment through a defined set of tools.