←back to Blog

AgentSociety: An Open Source AI Framework for Simulating Large-Scale Societal Interactions with LLM Agents

AgentSociety: An Open Source AI Framework for Simulating Large-Scale Societal Interactions with LLM Agents

AgentSociety is an open-source framework designed to simulate large populations of agents, each powered by Large Language Models (LLMs), to realistically model complex interactions found in human societies. This project leverages distributed processing technologies, especially Ray, achieving simulations involving tens of thousands of simultaneously active agents embedded in detailed, realistic environments that capture social, economic, and mobility behaviors.

Key Capabilities

Massive Scale and Fast Performance

  • Supports large populations: The framework demonstrated simulations with up to 30,000 agents, operating faster than real-time.
  • Parallelization with Ray: AgentSociety uses Ray to manage large-scale parallel execution of agents, critical for handling massive and non-deterministic interactions.
  • Efficient resource usage: By grouping agents and sharing network clients within groups, the framework reduces memory and connection overhead, addressing common bottlenecks in distributed simulations.

Realistic Societal Environments

AgentSociety integrates highly realistic feedback and constraints, enabling agents to behave in a way that mirrors real societal systems:

  • Urban Space: Incorporates real-world map data, road networks, and models of mobility, updated every simulated second.
  • Social Space: Agents form evolving social networks, engaging in online and offline interactions, simulating real-world communication patterns.
  • Economic Space: Implements employment, consumption, banking, and government interactions driven by agent decisions, simulating realistic economic behavior.

Architecture & Technology

Parallelized Interaction Engine

  • Group-Based Distributed Execution: Agents are partitioned into groups managed by Ray actors, optimizing resource use while maintaining high parallelism.
  • High-Performance Messaging: Utilizing Redis’s Pub/Sub capabilities, agents communicate efficiently, supporting agent-agent and user-agent interactions.
  • Time Alignment Mechanism: The framework synchronizes agent and environment progression, ensuring consistent simulations despite variable processing times from LLM API calls.
  • Comprehensive Utilities: Features simulation logging, metric recording, and a GUI for experiment creation/management and results visualization.

Quantitative Results

Scalability and Speed

Performance metrics highlight the efficiency of AgentSociety:

  • Faster than real-time: Simulations of 30,000 agents achieved faster-than-wall-clock operation, completing iterations in less than real-world time.
  • Linear Scaling: Performance scales linearly with computing resources, enabling higher simulation throughput with increased LLM-serving GPUs.
  • Example metrics: In a simulation with 30,000 agents, an average agent round completed in 252 seconds, maintaining a 100% LLM call success rate.

Impact of Realistic Environments

Incorporating realistic environment simulators significantly improved the authenticity of agent behaviors compared to traditional models. Empirical benchmarks indicated that LLM agents with environment support outperformed both prompt-only and classical model baselines, closely matching real-world data.

Use Cases and Applications

The open design and configurable environments make AgentSociety a valuable tool for:

  • Social Science Research: Studying societal patterns, emergent phenomena, and information spread.
  • Urban Planning and Policy Analysis: Evaluating interventions in simulated environments before real-world implementation.
  • Management Science: Modeling organizational dynamics, workforce changes, and economic behaviors.

Conclusion

AgentSociety stands out as the first open-source framework to efficiently and realistically simulate societal interactions at unprecedented scale. Its integration of LLM-powered agents with parallelized, data-driven environments positions it as a critical tool for computational research and practical decision support in understanding complex societal dynamics.

Check out the Paper and Project. All credit for this research goes to the researchers of this project. Also, feel free to follow us on Twitter and don’t forget to join our 100k+ ML SubReddit and Subscribe to our Newsletter.