How salesforce/ai-economist works
AI Economist is a modular socio-economic simulation framework with Gym-style reset/step behavior. Users configure a scenario and submit worker and planner actions; the environment advances component and scenario rules, computes rewards and returns observations, rewards, and completion data. The architecture also includes reusable economic mechanics, COVID-19 health-policy simulation and data, and a separate real-business-cycle training implementation. The graph reflects README documentation and sampled source; links among unsampled scenario features are omitted where their wiring cannot be verified.
Main entry points: base_env.py Environment lifecycle · components Composable components · covid19_env.py COVID economy · env_wrapper.py Environment wrapper
Components 21
Simulation engine
- Environment wrapper
ai_economist/foundation/env_wrapper.py - Environment lifecycle
ai_economist/foundation/base/base_env.py - World state
ai_economist/foundation/base/world.py - Workers and planner
ai_economist/foundation/agents
Economic mechanics
- Composable components
ai_economist/foundation/components - Building and gathering
ai_economist/foundation/components/build.py - Movement rules
ai_economist/foundation/components/move.py - Labor market
ai_economist/foundation/components/simple_labor.py - Double auction
ai_economist/foundation/components/continuous_double_auction.py - Tax redistribution
ai_economist/foundation/components/redistribution.py - Resources and entities
ai_economist/foundation/entities
Simulation scenarios
- Wood and stone
ai_economist/foundation/scenarios/simple_wood_and_stone/dynamic_layout.py - One-step economy
ai_economist/foundation/scenarios/one_step_economy/one_step_economy.py - COVID economy
ai_economist/foundation/scenarios/covid19/covid19_env.py - Health policy mechanics
ai_economist/foundation/components/covid19_components.py
Learning and data
- COVID datasets
ai_economist/datasets/covid19_datasets - Foundation training
ai_economist/training/training_script.py - Business-cycle training
ai_economist/real_business_cycle/rbc/cuda_manager.py - Best-response runner
ai_economist/real_business_cycle/train_bestresponse.py
Other components
- Policy researchers
- COVID data source
Connections 20
- Policy researchers → Environment wrapper: configure and act
- Environment wrapper → Environment lifecycle: reset and step
- Environment lifecycle → World state: updates state
- Environment lifecycle → Workers and planner: manages actors
- Environment lifecycle → Composable components: steps components
- Composable components → World state: apply rules
- Composable components → Building and gathering: includes
- Composable components → Movement rules: includes
- Composable components → Labor market: includes
- Composable components → Double auction: includes
- Composable components → Tax redistribution: includes
- Environment lifecycle → Resources and entities: registers entities
- Environment lifecycle → Wood and stone: scenario behavior
- Environment lifecycle → One-step economy: scenario behavior
- Environment lifecycle → COVID economy: scenario behavior
- COVID economy → Health policy mechanics: uses health rules
- COVID economy → COVID datasets: loads data
- COVID datasets → COVID data source: fetches policy data
- Foundation training → Environment wrapper: trains through
- Best-response runner → Business-cycle training: runs training