An extensible multi-agent economic world simulation framework for simulating continuous decision-making, interactions, and emergent macro outcomes of large numbers of heterogeneous economic agents under dynamically evolving macro environments and institutional rules.
Core Goal: Observe how policies regulate resident consumption
- Layer 0: Simulation Engine (time progression/scheduling/parallel processing)
- Layer 1: World State (global world state, componentized)
- Layer 2: Agent State (individual local state, subset of world)
- Layer 3: Perception (LLM) - Ollama Cloud
- Layer 4: Decision (action selection)
- Layer 5: Interaction & Transition (interactions/state transitions)
- Backend: Python 3.10+
- Database: PostgreSQL
- LLM: Ollama Cloud
- API: Flask
- Frontend: HTML/CSS/JavaScript (Chart.js for visualization)
./scripts/start.sh- Create virtual environment:
python3 -m venv venv && source venv/bin/activate - Install dependencies:
pip install -r requirements.txt - Initialize database:
python3 scripts/init_db.py - Start backend:
python3 backend/app.py - Access frontend:
http://localhost:5000
./scripts/run_tests.shpython3 examples/simple_simulation.py-
Copy the example configuration file:
cp config/config.yaml.example config/config.yaml
-
Edit
config/config.yamland set your Ollama API key:ollama: api_key: "YOUR_API_KEY_HERE" # Replace with your actual Ollama API key
-
Other configuration options:
- All other settings in
config.yamlare pre-configured and can be used as-is - You can modify database, simulation, world, server, and timezone settings as needed
- The
modelfield inollamasection sets the default LLM model (can be changed via frontend dropdown)
- All other settings in
Note: The config/config.yaml file is excluded from Git to protect your API key. Only config/config.yaml.example (template file) is tracked in the repository.
Percepta/
│
├── core/ # Layer 0: Simulation engine
├── world/ # World state and transitions
│ ├── state/ # Layer 1: World state components
│ └── transitions/ # Layer 5: State transitions
├── agents/ # Layer 2: Agents and state components
├── perception/ # Layer 3: LLM perception layer
├── decision/ # Layer 4: Decision models
├── metrics/ # Metrics and observations
├── backend/ # API service + database
├── frontend/ # Web interface
├── config/ # Configuration files
├── scripts/ # Utility scripts
├── tests/ # Test code
├── examples/ # Example code
└── docs/ # Documentation
For detailed structure, see PROJECT_STRUCTURE.md
- Quick Start Guide - Detailed installation and usage instructions
- Project Structure - Complete project structure documentation
- API Documentation - Complete RESTful API documentation
- Architecture Design - System architecture and extension guide
- Policy and institutional evolution simulation
- Technology diffusion and structural transformation research
- Behavioral assumptions and macro outcome correlation analysis
- AI + Economics / Social Science interdisciplinary research
- How policies regulate resident consumption (core goal of this project)
- World-First Architecture: World state is primary, agents are participants in the world
- Componentized Design: Easy to extend with new state components, agent types, interactions
- Continuous Evolution: System runs continuously, updating state in real-time
- Policy Regulation: Adjust policy variables in real-time, observe impact on consumption
- Data Persistence: All state changes saved to PostgreSQL
- Real-time Visualization: Web interface displays key metrics in real-time
✅ Core simulation engine
✅ World state component system
✅ Agent system (consumer)
✅ LLM perception integration (Ollama Cloud)
✅ PostgreSQL data storage
✅ Web frontend interface
✅ RESTful API
✅ Test framework
✅ Example code
✅ Complete documentation
Issues and Pull Requests are welcome!
MIT License